diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 21:55:50 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 21:55:50 +0000 |
commit | 28a4d4e616ab6c3010bfefa4ec56b38b25cc1b73 (patch) | |
tree | 3c4b3daabda7f9f0d68675bca529a16ee2bef924 /chrome/browser/app_menu_model.cc | |
parent | 1ba1e38aaf8a1665d2b700eb53c9c893108d540b (diff) | |
download | chromium_src-28a4d4e616ab6c3010bfefa4ec56b38b25cc1b73.zip chromium_src-28a4d4e616ab6c3010bfefa4ec56b38b25cc1b73.tar.gz chromium_src-28a4d4e616ab6c3010bfefa4ec56b38b25cc1b73.tar.bz2 |
Simplifying appmenu impl.
Using command id instead of index.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/554038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/app_menu_model.cc')
-rw-r--r-- | chrome/browser/app_menu_model.cc | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/chrome/browser/app_menu_model.cc b/chrome/browser/app_menu_model.cc index f42c920..e6d242e 100644 --- a/chrome/browser/app_menu_model.cc +++ b/chrome/browser/app_menu_model.cc @@ -22,11 +22,7 @@ AppMenuModel::AppMenuModel(menus::SimpleMenuModel::Delegate* delegate, Browser* browser) : menus::SimpleMenuModel(delegate), - browser_(browser), - // For now, we assume that sync cannot be enabled/disabled after - // launch. - sync_item_enabled_(ProfileSyncService::IsSyncEnabled()), - sync_item_index_(-1) { + browser_(browser) { Build(); } @@ -73,11 +69,11 @@ void AppMenuModel::Build() { AddItemWithStringId(IDC_MANAGE_EXTENSIONS, IDS_SHOW_EXTENSIONS); AddSeparator(); - if (sync_item_enabled_) { + + // We assume that IsSyncEnabled() is constant for the lifetime of the + // program (it just checks command-line flags). + if (ProfileSyncService::IsSyncEnabled()) { AddItem(IDC_SYNC_BOOKMARKS, GetSyncMenuLabel()); - // TODO(akalin): Make it possible to get the index in a less - // hackish way. - sync_item_index_ = GetItemCount() - 1; AddSeparator(); } #if defined(OS_MACOSX) @@ -85,6 +81,7 @@ void AppMenuModel::Build() { #else AddItemWithStringId(IDC_OPTIONS, IDS_OPTIONS); #endif + if (browser_defaults::kShowAboutMenuItem) { AddItem(IDC_ABOUT, l10n_util::GetStringFUTF16( @@ -129,12 +126,10 @@ void AppMenuModel::BuildProfileSubMenu() { } string16 AppMenuModel::GetSyncMenuLabel() const { - DCHECK(sync_item_enabled_); return sync_ui_util::GetSyncMenuLabel( browser_->profile()->GetOriginalProfile()->GetProfileSyncService()); } bool AppMenuModel::IsSyncItem(int index) const { - return sync_item_enabled_ && (index == sync_item_index_); + return GetCommandIdAt(index) == IDC_SYNC_BOOKMARKS; } - |