Chromium Code Reviews| Index: chrome/browser/renderer_context_menu/render_view_context_menu.h |
| diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.h b/chrome/browser/renderer_context_menu/render_view_context_menu.h |
| index 57eb5a8c7f9bf46d3f2b5652b44b1362cea17ee5..b84497bcfa4f795a999eca7db75d79accb8285b6 100644 |
| --- a/chrome/browser/renderer_context_menu/render_view_context_menu.h |
| +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.h |
| @@ -49,6 +49,23 @@ struct WebPluginAction; |
| class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate, |
| public RenderViewContextMenuProxy { |
| public: |
| + // A delegate interface to communicate with the toolkit used by |
| + // the embedder. |
| + class ToolkitDelegate { |
| + public: |
| + virtual ~ToolkitDelegate() {} |
| + // Initialize the toolkit's menu. |
|
lazyboy
2014/07/31 18:59:04
nit: Initializes the ...
oshima
2014/07/31 19:51:15
Done.
|
| + virtual void Init(ui::SimpleMenuModel* menu_model) = 0; |
| + |
| + virtual void Cancel() = 0; |
| + |
| + // Update the actual menu items controlled by the toolkit. |
|
lazyboy
2014/07/31 18:59:04
nit: // Updates the actual ....
oshima
2014/07/31 19:51:15
Done.
|
| + virtual void UpdateMenuItem(int command_id, |
| + bool enabled, |
| + bool hidden, |
| + const base::string16& title) = 0; |
| + }; |
| + |
| static const size_t kMaxSelectionTextLength; |
| // Convert a command ID so that it fits within the range for |
| @@ -79,7 +96,7 @@ class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate, |
| virtual void MenuWillShow(ui::SimpleMenuModel* source) OVERRIDE; |
| virtual void MenuClosed(ui::SimpleMenuModel* source) OVERRIDE; |
| - // RenderViewContextMenuProxy implementation. |
| + // RenderViewContextMenuProxy implementation.em |
| virtual void AddMenuItem(int command_id, |
| const base::string16& title) OVERRIDE; |
| virtual void AddCheckItem(int command_id, |
| @@ -97,12 +114,18 @@ class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate, |
| virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; |
| protected: |
| + void set_toolkit_delegate(scoped_ptr<ToolkitDelegate> delegate) { |
| + toolkit_delegate_ = delegate.Pass(); |
| + } |
| + |
| + ToolkitDelegate* toolkit_delegate() { |
| + return toolkit_delegate_.get(); |
| + } |
| + |
| void InitMenu(); |
| Profile* GetProfile(); |
| // Platform specific functions. |
| - virtual void PlatformInit() = 0; |
| - virtual void PlatformCancel() = 0; |
| virtual bool GetAcceleratorForCommandId( |
| int command_id, |
| ui::Accelerator* accelerator) = 0; |
| @@ -217,6 +240,8 @@ class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate, |
| scoped_ptr<ContextMenuContentType> content_type_; |
| + scoped_ptr<ToolkitDelegate> toolkit_delegate_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); |
| }; |