summaryrefslogtreecommitdiffstats
path: root/chrome/browser/wrench_menu_model.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/wrench_menu_model.h')
-rw-r--r--chrome/browser/wrench_menu_model.h52
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);
};