diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-14 01:44:32 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-14 01:44:32 +0000 |
commit | 057569b793e3b55e37ef20c1f2701159230ce9da (patch) | |
tree | 64a279fdc2222fe16cb5449ccb41fb034b6ca7d9 /chrome/browser/ui/toolbar/wrench_menu_model.h | |
parent | 87d5eb4dd3a416166993d856af6353e2a74aa2b8 (diff) | |
download | chromium_src-057569b793e3b55e37ef20c1f2701159230ce9da.zip chromium_src-057569b793e3b55e37ef20c1f2701159230ce9da.tar.gz chromium_src-057569b793e3b55e37ef20c1f2701159230ce9da.tar.bz2 |
Add profiles to wrench menu
This change adds a profile menu to the wrench menu.
If the user has one profile then the wrench menu looks like this:
Wrench Menu >
...
Downloads
-------
New Browsing Profile...
-------
...
If the user has two or more profile then the wrench menu looks like this:
Wrench Menu >
...
Downloads
-------
Browsing Profiles >
Profile 1
Profile 2
--------
New Browsing Profile...
-------
...
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/7138002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88942 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/toolbar/wrench_menu_model.h')
-rw-r--r-- | chrome/browser/ui/toolbar/wrench_menu_model.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.h b/chrome/browser/ui/toolbar/wrench_menu_model.h index 9d5ff90..48622fc 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.h +++ b/chrome/browser/ui/toolbar/wrench_menu_model.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ #pragma once +#include "base/file_path.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/tabs/tab_strip_model_observer.h" #include "content/common/notification_observer.h" @@ -81,6 +82,36 @@ class BookmarkSubMenuModel : public ui::SimpleMenuModel { DISALLOW_COPY_AND_ASSIGN(BookmarkSubMenuModel); }; +class ProfilesSubMenuModel : public ui::SimpleMenuModel, + public ui::SimpleMenuModel::Delegate { + public: + ProfilesSubMenuModel(ui::SimpleMenuModel::Delegate* delegate, + Browser* browser); + + virtual void ExecuteCommand(int command_id) OVERRIDE; + virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; + virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; + virtual bool GetAcceleratorForCommandId( + int command_id, + ui::Accelerator* accelerator) OVERRIDE; + + private: + enum { + // The profiles submenu contains a menu item for each profile. For + // the i'th profile the command ID is COMMAND_SWITCH_TO_PROFILE + i. + // If the profile matches the profile of the wrench button's browser + // then the menu item is checked. + COMMAND_SWITCH_TO_PROFILE, + }; + + void Build(); + + Browser* browser_; // weak + ui::SimpleMenuModel::Delegate* delegate_; // weak + + DISALLOW_COPY_AND_ASSIGN(ProfilesSubMenuModel); +}; + // A menu model that builds the contents of the wrench menu. class WrenchMenuModel : public ui::SimpleMenuModel, public ui::SimpleMenuModel::Delegate, @@ -156,6 +187,9 @@ class WrenchMenuModel : public ui::SimpleMenuModel, // Bookmark submenu. scoped_ptr<BookmarkSubMenuModel> bookmark_sub_menu_model_; + // Profiles submenu. + scoped_ptr<ProfilesSubMenuModel> profiles_sub_menu_model_; + ui::AcceleratorProvider* provider_; // weak Browser* browser_; // weak |