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

Unified Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 869793004: Bring up the Fast User Switcher on Shift+Click on the new Avatar Button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/ui/views/profiles/profile_chooser_view.cc
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
index 86f0e2a590bb1d60e19fe17f9ee938e53ce65e7b..27fa9a236cc2466771b4570ff3344ea14950d766 100644
--- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
@@ -80,6 +80,11 @@ const int kLargeImageSide = 88;
const int kVerticalSpacing = 16;
+bool IsProfileChooser(profiles::BubbleViewMode mode) {
+ return mode == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER ||
+ mode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER;
Roger Tawa OOO till Jul 10th 2015/01/26 20:30:40 Indent 85 only 4 spaces.
anthonyvd 2015/01/28 22:04:38 Done.
+}
+
// Creates a GridLayout with a single column. This ensures that all the child
// views added get auto-expanded to fill the full width of the bubble.
views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) {
@@ -586,7 +591,7 @@ void ProfileChooserView::ResetView() {
void ProfileChooserView::Init() {
// If view mode is PROFILE_CHOOSER but there is an auth error, force
// ACCOUNT_MANAGEMENT mode.
- if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER &&
+ if (IsProfileChooser(view_mode_) &&
HasAuthError(browser_->profile()) &&
switches::IsEnableAccountConsistency() &&
avatar_menu_->GetItemAt(avatar_menu_->GetActiveProfileIndex()).
@@ -603,7 +608,7 @@ void ProfileChooserView::Init() {
void ProfileChooserView::OnAvatarMenuChanged(
AvatarMenu* avatar_menu) {
- if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER ||
+ if (IsProfileChooser(view_mode_) ||
view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) {
// Refresh the view with the new menu. We can't just update the local copy
// as this may have been triggered by a sign out action, in which case
@@ -908,7 +913,7 @@ views::View* ProfileChooserView::CreateProfileChooserView(
option_buttons_view = CreateOptionsView(
item.signed_in && profiles::IsLockAvailable(browser_->profile()));
current_profile_view = CreateCurrentProfileView(item, false);
- if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) {
+ if (IsProfileChooser(view_mode_)) {
switch (tutorial_mode_) {
case profiles::TUTORIAL_MODE_NONE:
case profiles::TUTORIAL_MODE_WELCOME_UPGRADE:
@@ -948,7 +953,7 @@ views::View* ProfileChooserView::CreateProfileChooserView(
layout->StartRow(1, 0);
layout->AddView(current_profile_view);
- if (view_mode_ != profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) {
+ if (!IsProfileChooser(view_mode_)) {
DCHECK(current_profile_accounts);
layout->StartRow(0, 0);
layout->AddView(new views::Separator(views::Separator::HORIZONTAL));
@@ -963,9 +968,10 @@ views::View* ProfileChooserView::CreateProfileChooserView(
layout->AddView(CreateSupervisedUserDisclaimerView());
}
- if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) {
+ if (IsProfileChooser(view_mode_)) {
layout->StartRow(1, 0);
- if (switches::IsFastUserSwitching())
+ if (switches::IsFastUserSwitching() ||
+ view_mode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER)
layout->AddView(CreateOtherProfilesView(other_profiles));
Roger Tawa OOO till Jul 10th 2015/01/26 20:30:40 Add { and } to if body.
anthonyvd 2015/01/28 22:04:38 Done.
}
@@ -1163,7 +1169,7 @@ views::View* ProfileChooserView::CreateCurrentProfileView(
layout->StartRow(1, 0);
if (switches::IsEnableAccountConsistency()) {
base::string16 link_title = l10n_util::GetStringUTF16(
- view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER ?
+ IsProfileChooser(view_mode_) ?
IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON :
IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON);
manage_accounts_link_ = CreateLink(link_title, this);

Powered by Google App Engine
This is Rietveld 408576698