diff options
author | rlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-22 22:11:07 +0000 |
---|---|---|
committer | rlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-22 22:11:07 +0000 |
commit | c64fce81fdc943c326a57768a2a92dc82e9291bc (patch) | |
tree | 2d982d0e05237090c9464980bc9f7d12e320a627 /chrome/browser/background | |
parent | f21ed6f5ea007d05256d4621ebe87c8a24a882ad (diff) | |
download | chromium_src-c64fce81fdc943c326a57768a2a92dc82e9291bc.zip chromium_src-c64fce81fdc943c326a57768a2a92dc82e9291bc.tar.gz chromium_src-c64fce81fdc943c326a57768a2a92dc82e9291bc.tar.bz2 |
Updating status tray to show just the apps if there's only one profile, not if there's only one profile running background apps. If there is more than one profile, it shoudl always show the profile name.
BUG=106136
TEST=none
Review URL: http://codereview.chromium.org/9006032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115623 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/background')
-rw-r--r-- | chrome/browser/background/background_mode_manager.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc index f3af71a..1ab9fb3 100644 --- a/chrome/browser/background/background_mode_manager.cc +++ b/chrome/browser/background/background_mode_manager.cc @@ -673,7 +673,7 @@ void BackgroundModeManager::UpdateStatusTrayIconContextMenu() { menu->AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); menu->AddSeparator(); - if (background_mode_data_.size() > 1) { + if (profile_cache_->GetNumberOfProfiles() > 1) { std::vector<BackgroundModeData*> bmd_vector; for (BackgroundModeInfoMap::iterator it = background_mode_data_.begin(); @@ -683,18 +683,29 @@ void BackgroundModeManager::UpdateStatusTrayIconContextMenu() { } std::sort(bmd_vector.begin(), bmd_vector.end(), &BackgroundModeData::BackgroundModeDataCompare); + int profiles_with_apps = 0; for (std::vector<BackgroundModeData*>::const_iterator bmd_it = bmd_vector.begin(); bmd_it != bmd_vector.end(); ++bmd_it) { BackgroundModeData* bmd = *bmd_it; - ui::SimpleMenuModel* submenu = new ui::SimpleMenuModel(bmd); - bmd->BuildProfileMenu(submenu, menu); + // We should only display the profile in the status icon if it has at + // least one background app. + if (bmd->GetBackgroundAppCount() > 0) { + ui::SimpleMenuModel* submenu = new ui::SimpleMenuModel(bmd); + bmd->BuildProfileMenu(submenu, menu); + profiles_with_apps++; + } } + // We should only be displaying the status tray icon if there is at least + // one profile with a background app. + DCHECK_GT(profiles_with_apps, 0); } else { - // We should only have one profile in the list if we are not - // using multi-profiles. - DCHECK_EQ(background_mode_data_.size(), size_t(1)); + // We should only have one profile in the cache if we are not + // using multi-profiles. If keep_alive_for_test_ is set, then we may not + // have any profiles in the cache. + DCHECK(profile_cache_->GetNumberOfProfiles() == size_t(1) || + keep_alive_for_test_); background_mode_data_.begin()->second->BuildProfileMenu(menu, NULL); menu->AddSeparator(); } |