Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Unified Diff: chrome/browser/renderer_context_menu/render_view_context_menu.h

Issue 417063004: Separate Toolkit specific impl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
};
« no previous file with comments | « chrome/browser/apps/app_browsertest.cc ('k') | chrome/browser/renderer_context_menu/render_view_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698