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

Unified Diff: chrome/browser/wrench_menu_model.h

Issue 2879002: Reapply r50859 with chromeos fixes. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: add explicit menus:: to chromeos Created 10 years, 6 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/wrench_menu_model.h
diff --git a/chrome/browser/wrench_menu_model.h b/chrome/browser/wrench_menu_model.h
index f86a17020dcffe3599e232bae9f10586a23f05e7..5b7d2d595b916da09f18775de06d9d8e8c10d9d5 100644
--- a/chrome/browser/wrench_menu_model.h
+++ b/chrome/browser/wrench_menu_model.h
@@ -11,14 +11,19 @@
#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:
- explicit ToolsMenuModel(menus::SimpleMenuModel::Delegate* delegate,
- Browser* browser);
+ ToolsMenuModel(menus::SimpleMenuModel::Delegate* delegate, Browser* browser);
virtual ~ToolsMenuModel();
private:
@@ -30,10 +35,12 @@ class ToolsMenuModel : public menus::SimpleMenuModel {
};
// A menu model that builds the contents of the wrench menu.
-class WrenchMenuModel : public menus::SimpleMenuModel {
+class WrenchMenuModel : public menus::SimpleMenuModel,
+ public menus::ButtonMenuItemModel::Delegate,
+ public NotificationObserver {
public:
- explicit WrenchMenuModel(menus::SimpleMenuModel::Delegate* delegate,
- Browser* browser);
+ WrenchMenuModel(menus::SimpleMenuModel::Delegate* delegate,
+ Browser* browser);
virtual ~WrenchMenuModel();
// Returns true if the WrenchMenuModel is enabled.
@@ -45,27 +52,48 @@ class WrenchMenuModel : public menus::SimpleMenuModel {
virtual bool HasIcons() const { return true; }
virtual bool GetIconAt(int index, SkBitmap* icon) const;
- 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 menus::ButtonMenuItemModel::Delegate:
+ virtual bool IsLabelForCommandIdDynamic(int command_id) const;
+ virtual string16 GetLabelForCommandId(int command_id) const;
+ virtual void ExecuteCommand(int command_id);
- // Adds the zoom/fullscreen items to the menu. Like CreateCutCopyPaste().
- virtual void CreateZoomFullscreen();
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
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);
};
« no previous file with comments | « chrome/browser/gtk/notifications/notification_options_menu_model.cc ('k') | chrome/browser/wrench_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698