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

Unified Diff: chrome/browser/page_menu_model.h

Issue 465130: Share the code that builds the page menu in a common model, make Mac and Win ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years 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
« no previous file with comments | « chrome/browser/cocoa/toolbar_controller_unittest.mm ('k') | chrome/browser/page_menu_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/page_menu_model.h
===================================================================
--- chrome/browser/page_menu_model.h (revision 0)
+++ chrome/browser/page_menu_model.h (revision 0)
@@ -0,0 +1,82 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
+// source code is governed by a BSD-style license that can be found in the
+// LICENSE file.
+
+#ifndef CHROME_BROWSER_PAGE_MENU_MODEL_H_
+#define CHROME_BROWSER_PAGE_MENU_MODEL_H_
+
+#include "app/menus/simple_menu_model.h"
+#include "base/scoped_ptr.h"
+
+class Browser;
+
+// A menu model that builds the contents of an encoding menu.
+class EncodingMenuModel : public menus::SimpleMenuModel,
+ public menus::SimpleMenuModel::Delegate {
+ public:
+ explicit EncodingMenuModel(Browser* browser);
+ virtual ~EncodingMenuModel() {}
+
+ // Overridden from menus::SimpleMenuModel::Delegate:
+ virtual bool IsCommandIdChecked(int command_id) const;
+ virtual bool IsCommandIdEnabled(int command_id) const;
+ virtual bool GetAcceleratorForCommandId(int command_id,
+ menus::Accelerator* accelerator);
+ virtual void ExecuteCommand(int command_id);
+
+ private:
+ void Build();
+
+ Browser* browser_; // weak
+
+ DISALLOW_COPY_AND_ASSIGN(EncodingMenuModel);
+};
+
+// A menu model that builds the contents of the zoom menu.
+class ZoomMenuModel : public menus::SimpleMenuModel {
+ public:
+ explicit ZoomMenuModel(menus::SimpleMenuModel::Delegate* delegate);
+ virtual ~ZoomMenuModel() {}
+
+ private:
+ void Build();
+
+ DISALLOW_COPY_AND_ASSIGN(ZoomMenuModel);
+};
+
+// A menu model that builds the contents of the dev tools menu.
+class DevToolsMenuModel : public menus::SimpleMenuModel {
+ public:
+ explicit DevToolsMenuModel(menus::SimpleMenuModel::Delegate* delegate);
+ virtual ~DevToolsMenuModel() {}
+
+ private:
+ void Build();
+
+ DISALLOW_COPY_AND_ASSIGN(DevToolsMenuModel);
+};
+
+// A menu model that builds the contents of the page menu and all of its
+// submenus.
+class PageMenuModel : public menus::SimpleMenuModel {
+ public:
+ explicit PageMenuModel(menus::SimpleMenuModel::Delegate* delegate,
+ Browser* browser);
+ virtual ~PageMenuModel() { }
+
+ private:
+ void Build();
+
+ // The top-level model.
+ scoped_ptr<menus::SimpleMenuModel> model_;
+ // Models for submenus referenced by model_. SimpleMenuModel only uses weak
+ // references so these must be kept for the lifetime of the top-level model.
+ scoped_ptr<ZoomMenuModel> zoom_menu_model_;
+ scoped_ptr<EncodingMenuModel> encoding_menu_model_;
+ scoped_ptr<DevToolsMenuModel> devtools_menu_model_;
+ Browser* browser_; // weak
+
+ DISALLOW_COPY_AND_ASSIGN(PageMenuModel);
+};
+
+#endif // CHROME_BROWSER_PAGE_MENU_MODEL_H_
Property changes on: chrome/browser/page_menu_model.h
___________________________________________________________________
Name: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/cocoa/toolbar_controller_unittest.mm ('k') | chrome/browser/page_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698