diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-04 01:15:14 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-04 01:15:14 +0000 |
commit | fa7ced97069ff5fcf343880814c7155447966edb (patch) | |
tree | ea67bea5b79c8e087703ab6346a1cd31cd92db11 /chrome/browser | |
parent | bcf415cf6d1c8291c8bbca16c141adb7b94f6c78 (diff) | |
download | chromium_src-fa7ced97069ff5fcf343880814c7155447966edb.zip chromium_src-fa7ced97069ff5fcf343880814c7155447966edb.tar.gz chromium_src-fa7ced97069ff5fcf343880814c7155447966edb.tar.bz2 |
Multi-Profiles: Only show the avatar icon if user has multiple profiles
BUG=88878
TEST=None
Review URL: http://codereview.chromium.org/7484040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95362 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/ui/cocoa/browser_window_controller.mm | 18 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/browser_titlebar.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_view.cc | 7 |
3 files changed, 25 insertions, 5 deletions
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index be6845e..6df4d70 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -15,9 +15,11 @@ #include "base/sys_string_conversions.h" #include "chrome/app/chrome_command_ids.h" // IDC_* #include "chrome/browser/bookmarks/bookmark_editor.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/google/google_util.h" #include "chrome/browser/instant/instant_controller.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/sync_ui_util_mac.h" @@ -1353,8 +1355,20 @@ typedef NSInteger NSWindowAnimationBehavior; } - (BOOL)shouldShowAvatar { - return [self hasTabStrip] && (browser_->profile()->IsOffTheRecord() || - ProfileManager::IsMultipleProfilesEnabled()); + if (![self hasTabStrip]) + return NO; + + if (browser_->profile()->IsOffTheRecord()) + return YES; + + if (ProfileManager::IsMultipleProfilesEnabled()) { + // Show the profile avatar after the user has created more than one profile. + ProfileInfoCache& cache = + g_browser_process->profile_manager()->GetProfileInfoCache(); + return cache.GetNumberOfProfiles() > 1; + } + + return NO; } - (BOOL)isBookmarkBarVisible { diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc index a8325f8..051c68e 100644 --- a/chrome/browser/ui/gtk/browser_titlebar.cc +++ b/chrome/browser/ui/gtk/browser_titlebar.cc @@ -16,8 +16,10 @@ #include "base/string_tokenizer.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/gtk/accelerators_gtk.h" @@ -310,7 +312,10 @@ void BrowserTitlebar::Init() { // If multi-profile is enabled set up profile button and login notifications. // The button lives in its own vbox in container_hbox_. + ProfileInfoCache& cache = + g_browser_process->profile_manager()->GetProfileInfoCache(); if (ProfileManager::IsMultipleProfilesEnabled() && + cache.GetNumberOfProfiles() > 1 && !browser_window_->browser()->profile()->IsOffTheRecord()) { PrefService* prefs = browser_window_->browser()->profile()->GetPrefs(); usernamePref_.Init(prefs::kGoogleServicesUsername, prefs, this); diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 9d053ed..d30e353 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -478,9 +478,10 @@ bool BrowserView::ShouldShowAvatar() const { return true; if (ProfileManager::IsMultipleProfilesEnabled()) { - // TODO(sail): Once the multi-profile options UI is done we only want to - // show the avatar if the user has more than one profile. - return true; + // Show the profile avatar after the user has created more than one profile. + ProfileInfoCache& cache = + g_browser_process->profile_manager()->GetProfileInfoCache(); + return cache.GetNumberOfProfiles() > 1; } return false; |