OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 protected: | 47 protected: |
48 void InitMenu(); | 48 void InitMenu(); |
49 | 49 |
50 // Platform specific functions. | 50 // Platform specific functions. |
51 virtual void PlatformInit() = 0; | 51 virtual void PlatformInit() = 0; |
52 virtual bool GetAcceleratorForCommandId( | 52 virtual bool GetAcceleratorForCommandId( |
53 int command_id, | 53 int command_id, |
54 menus::Accelerator* accelerator) = 0; | 54 menus::Accelerator* accelerator) = 0; |
55 | 55 |
| 56 // Attempts to get an ExtensionMenuItem given the id of a context menu item. |
| 57 ExtensionMenuItem* GetExtensionMenuItem(int id) const; |
| 58 |
56 ContextMenuParams params_; | 59 ContextMenuParams params_; |
57 TabContents* source_tab_contents_; | 60 TabContents* source_tab_contents_; |
58 Profile* profile_; | 61 Profile* profile_; |
59 | 62 |
60 menus::SimpleMenuModel menu_model_; | 63 menus::SimpleMenuModel menu_model_; |
61 | 64 |
62 // True if we are showing for an external tab contents. The default is false. | 65 // True if we are showing for an external tab contents. The default is false. |
63 bool external_; | 66 bool external_; |
64 | 67 |
| 68 |
| 69 // Maps the id from a context menu item to the ExtensionMenuItem's internal |
| 70 // id. |
| 71 std::map<int, ExtensionMenuItem::Id> extension_item_map_; |
| 72 |
65 private: | 73 private: |
66 static bool IsDevToolsURL(const GURL& url); | 74 static bool IsDevToolsURL(const GURL& url); |
67 static bool IsSyncResourcesURL(const GURL& url); | 75 static bool IsSyncResourcesURL(const GURL& url); |
68 bool AppendCustomItems(); | 76 bool AppendCustomItems(); |
69 void AppendDeveloperItems(); | 77 void AppendDeveloperItems(); |
70 void AppendLinkItems(); | 78 void AppendLinkItems(); |
71 void AppendImageItems(); | 79 void AppendImageItems(); |
72 void AppendAudioItems(); | 80 void AppendAudioItems(); |
73 void AppendVideoItems(); | 81 void AppendVideoItems(); |
74 void AppendMediaItems(); | 82 void AppendMediaItems(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 120 |
113 void MediaPlayerActionAt(const gfx::Point& location, | 121 void MediaPlayerActionAt(const gfx::Point& location, |
114 const WebKit::WebMediaPlayerAction& action); | 122 const WebKit::WebMediaPlayerAction& action); |
115 | 123 |
116 bool IsDevCommandEnabled(int id) const; | 124 bool IsDevCommandEnabled(int id) const; |
117 | 125 |
118 // Returns a (possibly truncated) version of the current selection text | 126 // Returns a (possibly truncated) version of the current selection text |
119 // suitable or putting in the title of a menu item. | 127 // suitable or putting in the title of a menu item. |
120 string16 PrintableSelectionText(); | 128 string16 PrintableSelectionText(); |
121 | 129 |
122 // Attempts to get an ExtensionMenuItem given the id of a context menu item. | |
123 ExtensionMenuItem* GetExtensionMenuItem(int id) const; | |
124 | |
125 // The destination URL to use if the user tries to search for or navigate to | 130 // The destination URL to use if the user tries to search for or navigate to |
126 // a text selection. | 131 // a text selection. |
127 GURL selection_navigation_url_; | 132 GURL selection_navigation_url_; |
128 | 133 |
129 // Maps the id from a context menu item to the ExtensionMenuItem's internal | |
130 // id. | |
131 std::map<int, ExtensionMenuItem::Id> extension_item_map_; | |
132 | |
133 menus::SimpleMenuModel spellcheck_submenu_model_; | 134 menus::SimpleMenuModel spellcheck_submenu_model_; |
134 menus::SimpleMenuModel bidi_submenu_model_; | 135 menus::SimpleMenuModel bidi_submenu_model_; |
135 ScopedVector<menus::SimpleMenuModel> extension_menu_models_; | 136 ScopedVector<menus::SimpleMenuModel> extension_menu_models_; |
136 | 137 |
137 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); | 138 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); |
138 }; | 139 }; |
139 | 140 |
140 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ | 141 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_H_ |
OLD | NEW |