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 3de1851f9b60f8cfd6565b48a79d4843ef0a661d..168fb20c9673e9ae6aefc2836c66fa063526de42 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. |
| + virtual void Init(ui::SimpleMenuModel* menu_model) = 0; |
| + |
| + virtual void Cancel() = 0; |
| + |
| + // Updates the actual menu items controlled by the toolkit. |
| + 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 |
|
sky
2014/07/31 21:23:43
nit: remove em
oshima
2014/07/31 22:02:15
Done.
|
| 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); |
| }; |