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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 ~RenderViewContextMenu() override; | 57 ~RenderViewContextMenu() override; |
58 | 58 |
59 // SimpleMenuModel::Delegate: | 59 // SimpleMenuModel::Delegate: |
60 bool IsCommandIdChecked(int command_id) const override; | 60 bool IsCommandIdChecked(int command_id) const override; |
61 bool IsCommandIdEnabled(int command_id) const override; | 61 bool IsCommandIdEnabled(int command_id) const override; |
62 void ExecuteCommand(int command_id, int event_flags) override; | 62 void ExecuteCommand(int command_id, int event_flags) override; |
63 | 63 |
64 protected: | 64 protected: |
65 Profile* GetProfile(); | 65 Profile* GetProfile(); |
66 | 66 |
| 67 // Returns a (possibly truncated) version of the current selection text |
| 68 // suitable for putting in the title of a menu item. |
| 69 base::string16 PrintableSelectionText(); |
| 70 |
| 71 // Helper function to escape "&" as "&&". |
| 72 void EscapeAmpersands(base::string16* text); |
| 73 |
67 #if defined(ENABLE_EXTENSIONS) | 74 #if defined(ENABLE_EXTENSIONS) |
68 extensions::ContextMenuMatcher extension_items_; | 75 extensions::ContextMenuMatcher extension_items_; |
69 #endif | 76 #endif |
70 | 77 |
71 private: | 78 private: |
72 friend class RenderViewContextMenuTest; | 79 friend class RenderViewContextMenuTest; |
73 friend class RenderViewContextMenuPrefsTest; | 80 friend class RenderViewContextMenuPrefsTest; |
74 | 81 |
75 static bool IsDevToolsURL(const GURL& url); | 82 static bool IsDevToolsURL(const GURL& url); |
76 static bool IsInternalResourcesURL(const GURL& url); | 83 static bool IsInternalResourcesURL(const GURL& url); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 const blink::WebMediaPlayerAction& action); | 146 const blink::WebMediaPlayerAction& action); |
140 void PluginActionAt(const gfx::Point& location, | 147 void PluginActionAt(const gfx::Point& location, |
141 const blink::WebPluginAction& action); | 148 const blink::WebPluginAction& action); |
142 | 149 |
143 bool IsDevCommandEnabled(int id) const; | 150 bool IsDevCommandEnabled(int id) const; |
144 | 151 |
145 // Returns a list of registered ProtocolHandlers that can handle the clicked | 152 // Returns a list of registered ProtocolHandlers that can handle the clicked |
146 // on URL. | 153 // on URL. |
147 ProtocolHandlerRegistry::ProtocolHandlerList GetHandlersForLinkUrl(); | 154 ProtocolHandlerRegistry::ProtocolHandlerList GetHandlersForLinkUrl(); |
148 | 155 |
149 // Returns a (possibly truncated) version of the current selection text | |
150 // suitable or putting in the title of a menu item. | |
151 base::string16 PrintableSelectionText(); | |
152 | |
153 // The destination URL to use if the user tries to search for or navigate to | 156 // The destination URL to use if the user tries to search for or navigate to |
154 // a text selection. | 157 // a text selection. |
155 GURL selection_navigation_url_; | 158 GURL selection_navigation_url_; |
156 | 159 |
157 ui::SimpleMenuModel protocol_handler_submenu_model_; | 160 ui::SimpleMenuModel protocol_handler_submenu_model_; |
158 ProtocolHandlerRegistry* protocol_handler_registry_; | 161 ProtocolHandlerRegistry* protocol_handler_registry_; |
159 | 162 |
160 // An observer that handles spelling-menu items. | 163 // An observer that handles spelling-menu items. |
161 scoped_ptr<SpellingMenuObserver> spelling_menu_observer_; | 164 scoped_ptr<SpellingMenuObserver> spelling_menu_observer_; |
162 | 165 |
163 // An observer that handles a 'spell-checker options' submenu. | 166 // An observer that handles a 'spell-checker options' submenu. |
164 scoped_ptr<SpellCheckerSubMenuObserver> spellchecker_submenu_observer_; | 167 scoped_ptr<SpellCheckerSubMenuObserver> spellchecker_submenu_observer_; |
165 | 168 |
166 #if defined(ENABLE_PRINT_PREVIEW) | 169 #if defined(ENABLE_PRINT_PREVIEW) |
167 // An observer that disables menu items when print preview is active. | 170 // An observer that disables menu items when print preview is active. |
168 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; | 171 scoped_ptr<PrintPreviewContextMenuObserver> print_preview_menu_observer_; |
169 #endif | 172 #endif |
170 | 173 |
171 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); | 174 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); |
172 }; | 175 }; |
173 | 176 |
174 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ | 177 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ |
OLD | NEW |