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 COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ | 5 #ifndef COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ |
6 #define COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ | 6 #define COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // Initialize the toolkit's menu. | 44 // Initialize the toolkit's menu. |
45 virtual void Init(ui::SimpleMenuModel* menu_model) = 0; | 45 virtual void Init(ui::SimpleMenuModel* menu_model) = 0; |
46 | 46 |
47 virtual void Cancel() = 0; | 47 virtual void Cancel() = 0; |
48 | 48 |
49 // Updates the actual menu items controlled by the toolkit. | 49 // Updates the actual menu items controlled by the toolkit. |
50 virtual void UpdateMenuItem(int command_id, | 50 virtual void UpdateMenuItem(int command_id, |
51 bool enabled, | 51 bool enabled, |
52 bool hidden, | 52 bool hidden, |
53 const base::string16& title) = 0; | 53 const base::string16& title) = 0; |
| 54 // Sets icon to the actual menu items controlled by the toolkit. |
| 55 virtual void SetIcon(int command_id, const gfx::ImageSkia& icon) = 0; |
54 }; | 56 }; |
55 | 57 |
56 static const size_t kMaxSelectionTextLength; | 58 static const size_t kMaxSelectionTextLength; |
57 | 59 |
58 static void SetContentCustomCommandIdRange(int first, int last); | 60 static void SetContentCustomCommandIdRange(int first, int last); |
59 | 61 |
60 // Convert a command ID so that it fits within the range for | 62 // Convert a command ID so that it fits within the range for |
61 // content context menu. | 63 // content context menu. |
62 static int ConvertToContentCustomCommandId(int id); | 64 static int ConvertToContentCustomCommandId(int id); |
63 | 65 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 void AddMenuItem(int command_id, const base::string16& title) override; | 99 void AddMenuItem(int command_id, const base::string16& title) override; |
98 void AddCheckItem(int command_id, const base::string16& title) override; | 100 void AddCheckItem(int command_id, const base::string16& title) override; |
99 void AddSeparator() override; | 101 void AddSeparator() override; |
100 void AddSubMenu(int command_id, | 102 void AddSubMenu(int command_id, |
101 const base::string16& label, | 103 const base::string16& label, |
102 ui::MenuModel* model) override; | 104 ui::MenuModel* model) override; |
103 void UpdateMenuItem(int command_id, | 105 void UpdateMenuItem(int command_id, |
104 bool enabled, | 106 bool enabled, |
105 bool hidden, | 107 bool hidden, |
106 const base::string16& title) override; | 108 const base::string16& title) override; |
| 109 void SetIcon(int command_id, const gfx::ImageSkia& icon) override; |
107 content::RenderViewHost* GetRenderViewHost() const override; | 110 content::RenderViewHost* GetRenderViewHost() const override; |
108 content::WebContents* GetWebContents() const override; | 111 content::WebContents* GetWebContents() const override; |
109 content::BrowserContext* GetBrowserContext() const override; | 112 content::BrowserContext* GetBrowserContext() const override; |
110 | 113 |
111 protected: | 114 protected: |
112 friend class RenderViewContextMenuTest; | 115 friend class RenderViewContextMenuTest; |
113 friend class RenderViewContextMenuPrefsTest; | 116 friend class RenderViewContextMenuPrefsTest; |
114 | 117 |
115 void set_content_type(ContextMenuContentType* content_type) { | 118 void set_content_type(ContextMenuContentType* content_type) { |
116 content_type_.reset(content_type); | 119 content_type_.reset(content_type); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 187 |
185 // The RenderFrameHost's IDs. | 188 // The RenderFrameHost's IDs. |
186 int render_process_id_; | 189 int render_process_id_; |
187 | 190 |
188 scoped_ptr<ToolkitDelegate> toolkit_delegate_; | 191 scoped_ptr<ToolkitDelegate> toolkit_delegate_; |
189 | 192 |
190 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuBase); | 193 DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuBase); |
191 }; | 194 }; |
192 | 195 |
193 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ | 196 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BASE_H_ |
OLD | NEW |