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..5b5932eedbe389723dccce7742d091b2821454c6 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 |
@@ -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); |
}; |