diff options
author | rafaelw@google.com <rafaelw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-25 17:51:47 +0000 |
---|---|---|
committer | rafaelw@google.com <rafaelw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-25 17:51:47 +0000 |
commit | ead554754ca0a23e0b132b3e84566be703456730 (patch) | |
tree | 6ebf4dcdc3fa6f60bae4bc07d18becf62b0512d5 /chrome/browser/wrench_menu_model.h | |
parent | 0b26c592f978b858fc6a9accf1e7d689df4cfd97 (diff) | |
download | chromium_src-ead554754ca0a23e0b132b3e84566be703456730.zip chromium_src-ead554754ca0a23e0b132b3e84566be703456730.tar.gz chromium_src-ead554754ca0a23e0b132b3e84566be703456730.tar.bz2 |
Revert 50859 - GTK: First draft of the unified cut/copy/paste and +/-/Fullscreen menu items.
Adds special menu item types that allow shoving buttons into them, along with
tracking which button is selected. We now are halfway to the mocks that the
chrome-ui-leads sent out.
BUG=45757
TEST=none
Review URL: http://codereview.chromium.org/2800015
TBR=erg@chromium.org
Review URL: http://codereview.chromium.org/2836029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50865 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/wrench_menu_model.h')
-rw-r--r-- | chrome/browser/wrench_menu_model.h | 52 |
1 files changed, 12 insertions, 40 deletions
diff --git a/chrome/browser/wrench_menu_model.h b/chrome/browser/wrench_menu_model.h index 5b7d2d5..f86a170 100644 --- a/chrome/browser/wrench_menu_model.h +++ b/chrome/browser/wrench_menu_model.h @@ -11,19 +11,14 @@ #include "app/menus/simple_menu_model.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" -#include "chrome/common/notification_observer.h" -#include "chrome/common/notification_registrar.h" class Browser; class EncodingMenuModel; -namespace menus { -class ButtonMenuItemModel; -} // namespace menus - class ToolsMenuModel : public menus::SimpleMenuModel { public: - ToolsMenuModel(menus::SimpleMenuModel::Delegate* delegate, Browser* browser); + explicit ToolsMenuModel(menus::SimpleMenuModel::Delegate* delegate, + Browser* browser); virtual ~ToolsMenuModel(); private: @@ -35,12 +30,10 @@ class ToolsMenuModel : public menus::SimpleMenuModel { }; // A menu model that builds the contents of the wrench menu. -class WrenchMenuModel : public menus::SimpleMenuModel, - public menus::ButtonMenuItemModel::Delegate, - public NotificationObserver { +class WrenchMenuModel : public menus::SimpleMenuModel { public: - WrenchMenuModel(menus::SimpleMenuModel::Delegate* delegate, - Browser* browser); + explicit WrenchMenuModel(menus::SimpleMenuModel::Delegate* delegate, + Browser* browser); virtual ~WrenchMenuModel(); // Returns true if the WrenchMenuModel is enabled. @@ -52,48 +45,27 @@ class WrenchMenuModel : public menus::SimpleMenuModel, virtual bool HasIcons() const { return true; } virtual bool GetIconAt(int index, SkBitmap* icon) const; - // Overridden from menus::ButtonMenuItemModel::Delegate: - virtual bool IsLabelForCommandIdDynamic(int command_id) const; - virtual string16 GetLabelForCommandId(int command_id) const; - virtual void ExecuteCommand(int command_id); + protected: + // Adds the cut/copy/paste items to the menu. The default implementation adds + // three real menu items, while platform specific subclasses add their own + // native monstrosities. + virtual void CreateCutCopyPaste(); - // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); + // Adds the zoom/fullscreen items to the menu. Like CreateCutCopyPaste(). + virtual void CreateZoomFullscreen(); private: void Build(); - // Adds custom items to the menu. Deprecated in favor of a cross platform - // model for button items. - void CreateCutCopyPaste(); - void CreateZoomFullscreen(); - - // Calculates |zoom_label_| in response to a zoom change. - void UpdateZoomControls(); - double GetZoom(bool* enable_increment, bool* enable_decrement); - string16 GetSyncMenuLabel() const; string16 GetAboutEntryMenuLabel() const; bool IsDynamicItem(int index) const; - // Models for the special menu items with buttons. - scoped_ptr<menus::ButtonMenuItemModel> edit_menu_item_model_; - scoped_ptr<menus::ButtonMenuItemModel> zoom_menu_item_model_; - - // Label of the zoom label in the zoom menu item. - string16 zoom_label_; - // Tools menu. scoped_ptr<ToolsMenuModel> tools_menu_model_; - menus::SimpleMenuModel::Delegate* delegate_; // weak - Browser* browser_; // weak - NotificationRegistrar registrar_; - DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); }; |