OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ |
6 #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ | 6 #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Returns a (possibly truncated) version of the current selection text | 75 // Returns a (possibly truncated) version of the current selection text |
76 // suitable for putting in the title of a menu item. | 76 // suitable for putting in the title of a menu item. |
77 base::string16 PrintableSelectionText(); | 77 base::string16 PrintableSelectionText(); |
78 | 78 |
79 // Helper function to escape "&" as "&&". | 79 // Helper function to escape "&" as "&&". |
80 void EscapeAmpersands(base::string16* text); | 80 void EscapeAmpersands(base::string16* text); |
81 | 81 |
82 #if defined(ENABLE_EXTENSIONS) | 82 #if defined(ENABLE_EXTENSIONS) |
83 extensions::ContextMenuMatcher extension_items_; | 83 extensions::ContextMenuMatcher extension_items_; |
84 #endif | 84 #endif |
| 85 void RecordUsedItem(int id) override; |
85 | 86 |
86 private: | 87 private: |
87 friend class RenderViewContextMenuTest; | 88 friend class RenderViewContextMenuTest; |
88 friend class RenderViewContextMenuPrefsTest; | 89 friend class RenderViewContextMenuPrefsTest; |
89 | 90 |
90 static bool IsDevToolsURL(const GURL& url); | 91 static bool IsDevToolsURL(const GURL& url); |
91 static bool IsInternalResourcesURL(const GURL& url); | 92 static bool IsInternalResourcesURL(const GURL& url); |
92 #if defined(ENABLE_EXTENSIONS) | 93 #if defined(ENABLE_EXTENSIONS) |
93 static bool ExtensionContextAndPatternMatch( | 94 static bool ExtensionContextAndPatternMatch( |
94 const content::ContextMenuParams& params, | 95 const content::ContextMenuParams& params, |
95 const extensions::MenuItem::ContextList& contexts, | 96 const extensions::MenuItem::ContextList& contexts, |
96 const extensions::URLPatternSet& target_url_patterns); | 97 const extensions::URLPatternSet& target_url_patterns); |
97 static bool MenuItemMatchesParams(const content::ContextMenuParams& params, | 98 static bool MenuItemMatchesParams(const content::ContextMenuParams& params, |
98 const extensions::MenuItem* item); | 99 const extensions::MenuItem* item); |
99 #endif | 100 #endif |
100 | 101 |
101 // RenderViewContextMenuBase: | 102 // RenderViewContextMenuBase: |
102 void InitMenu() override; | 103 void InitMenu() override; |
103 void RecordShownItem(int id) override; | 104 void RecordShownItem(int id) override; |
104 void RecordUsedItem(int id) override; | |
105 #if defined(ENABLE_PLUGINS) | 105 #if defined(ENABLE_PLUGINS) |
106 void HandleAuthorizeAllPlugins() override; | 106 void HandleAuthorizeAllPlugins() override; |
107 #endif | 107 #endif |
108 void NotifyMenuShown() override; | 108 void NotifyMenuShown() override; |
109 void NotifyURLOpened(const GURL& url, | 109 void NotifyURLOpened(const GURL& url, |
110 content::WebContents* new_contents) override; | 110 content::WebContents* new_contents) override; |
111 | 111 |
112 // Gets the extension (if any) associated with the WebContents that we're in. | 112 // Gets the extension (if any) associated with the WebContents that we're in. |
113 const extensions::Extension* GetExtension() const; | 113 const extensions::Extension* GetExtension() const; |
114 | 114 |
115 void AppendDeveloperItems(); | 115 void AppendDeveloperItems(); |
116 void AppendDevtoolsForUnpackedExtensions(); | 116 void AppendDevtoolsForUnpackedExtensions(); |
117 void AppendLinkItems(); | 117 void AppendLinkItems(); |
118 void AppendImageItems(); | 118 void AppendImageItems(); |
119 void AppendAudioItems(); | 119 void AppendAudioItems(); |
120 void AppendCanvasItems(); | 120 void AppendCanvasItems(); |
121 void AppendVideoItems(); | 121 void AppendVideoItems(); |
122 void AppendMediaItems(); | |
123 void AppendPluginItems(); | 122 void AppendPluginItems(); |
124 void AppendPageItems(); | 123 void AppendPageItems(); |
125 void AppendFrameItems(); | |
126 void AppendCopyItem(); | 124 void AppendCopyItem(); |
127 void AppendPrintItem(); | 125 void AppendPrintItem(); |
128 void AppendRotationItems(); | 126 void AppendRotationItems(); |
129 void AppendEditableItems(); | 127 void AppendEditableItems(); |
| 128 void AppendLanguageSettings(); |
130 void AppendSearchProvider(); | 129 void AppendSearchProvider(); |
131 #if defined(ENABLE_EXTENSIONS) | 130 #if defined(ENABLE_EXTENSIONS) |
132 void AppendAllExtensionItems(); | 131 void AppendAllExtensionItems(); |
133 void AppendCurrentExtensionItems(); | 132 void AppendCurrentExtensionItems(); |
134 #endif | 133 #endif |
135 void AppendPrintPreviewItems(); | 134 void AppendPrintPreviewItems(); |
136 void AppendSearchWebForImageItems(); | 135 void AppendSearchWebForImageItems(); |
137 void AppendSpellingSuggestionsSubMenu(); | 136 void AppendSpellingSuggestionsSubMenu(); |
138 void AppendSpellcheckOptionsSubMenu(); | |
139 void AppendProtocolHandlerSubMenu(); | 137 void AppendProtocolHandlerSubMenu(); |
140 void AppendPasswordItems(); | 138 void AppendPasswordItems(); |
141 | 139 |
142 // Copy to the clipboard an image located at a point in the RenderView | 140 // Copy to the clipboard an image located at a point in the RenderView |
143 void CopyImageAt(int x, int y); | 141 void CopyImageAt(int x, int y); |
144 | 142 |
145 // Load the original image located at a point in the RenderView. | 143 // Load the original image located at a point in the RenderView. |
146 void LoadOriginalImage(); | 144 void LoadOriginalImage(); |
147 | 145 |
148 // Get an image located at a point in the RenderView for search. | 146 // Get an image located at a point in the RenderView for search. |
(...skipping 19 matching lines...) Expand all Loading... |
168 // The destination URL to use if the user tries to search for or navigate to | 166 // The destination URL to use if the user tries to search for or navigate to |
169 // a text selection. | 167 // a text selection. |
170 GURL selection_navigation_url_; | 168 GURL selection_navigation_url_; |
171 | 169 |
172 ui::SimpleMenuModel protocol_handler_submenu_model_; | 170 ui::SimpleMenuModel protocol_handler_submenu_model_; |
173 ProtocolHandlerRegistry* protocol_handler_registry_; | 171 ProtocolHandlerRegistry* protocol_handler_registry_; |
174 | 172 |
175 // An observer that handles spelling-menu items. | 173 // An observer that handles spelling-menu items. |
176 scoped_ptr<SpellingMenuObserver> spelling_menu_observer_; | 174 scoped_ptr<SpellingMenuObserver> spelling_menu_observer_; |
177 | 175 |
178 // An observer that handles a 'spell-checker options' submenu. | |
179 scoped_ptr<SpellCheckerSubMenuObserver> spellchecker_submenu_observer_; | |
180 | |
181 #if defined(ENABLE_PRINT_PREVIEW) | 176 #if defined(ENABLE_PRINT_PREVIEW) |
182 // An observer that disables menu items when print preview is active. | 177 // An observer that disables menu items when print preview is active. |
183 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; | 178 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; |
184 #endif | 179 #endif |
185 | 180 |
186 // In the case of a MimeHandlerView this will point to the WebContents that | 181 // In the case of a MimeHandlerView this will point to the WebContents that |
187 // embeds the MimeHandlerViewGuest. Otherwise this will be the same as | 182 // embeds the MimeHandlerViewGuest. Otherwise this will be the same as |
188 // |source_web_contents_|. | 183 // |source_web_contents_|. |
189 content::WebContents* const embedder_web_contents_; | 184 content::WebContents* const embedder_web_contents_; |
190 | 185 |
191 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); | 186 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); |
192 }; | 187 }; |
193 | 188 |
194 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ | 189 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ |
OLD | NEW |