OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 avatar_menu_->GetItemAt(avatar_menu_->GetActiveProfileIndex()). | 592 avatar_menu_->GetItemAt(avatar_menu_->GetActiveProfileIndex()). |
593 signed_in) { | 593 signed_in) { |
594 view_mode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; | 594 view_mode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; |
595 } | 595 } |
596 | 596 |
597 ShowView(view_mode_, avatar_menu_.get()); | 597 ShowView(view_mode_, avatar_menu_.get()); |
598 } | 598 } |
599 | 599 |
600 void ProfileChooserView::OnAvatarMenuChanged( | 600 void ProfileChooserView::OnAvatarMenuChanged( |
601 AvatarMenu* avatar_menu) { | 601 AvatarMenu* avatar_menu) { |
602 // Do not refresh the avatar menu if the user is on a signin related view. | 602 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER || |
603 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || | 603 view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) { |
604 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || | 604 // Refresh the view with the new menu. We can't just update the local copy |
605 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH) { | 605 // as this may have been triggered by a sign out action, in which case |
606 return; | 606 // the view is being destroyed. |
| 607 ShowView(view_mode_, avatar_menu); |
607 } | 608 } |
608 | |
609 // Refresh the view with the new menu. We can't just update the local copy | |
610 // as this may have been triggered by a sign out action, in which case | |
611 // the view is being destroyed. | |
612 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu); | |
613 } | 609 } |
614 | 610 |
615 void ProfileChooserView::OnRefreshTokenAvailable( | 611 void ProfileChooserView::OnRefreshTokenAvailable( |
616 const std::string& account_id) { | 612 const std::string& account_id) { |
617 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT || | 613 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT || |
618 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || | 614 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || |
619 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH) { | 615 view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH) { |
620 // The account management UI is only available through the | 616 // The account management UI is only available through the |
621 // --enable-account-consistency flag. | 617 // --enable-account-consistency flag. |
622 ShowView(switches::IsEnableAccountConsistency() ? | 618 ShowView(switches::IsEnableAccountConsistency() ? |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1640 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1645 IncognitoModePrefs::DISABLED; | 1641 IncognitoModePrefs::DISABLED; |
1646 return incognito_available && !browser_->profile()->IsGuestSession(); | 1642 return incognito_available && !browser_->profile()->IsGuestSession(); |
1647 } | 1643 } |
1648 | 1644 |
1649 void ProfileChooserView::PostActionPerformed( | 1645 void ProfileChooserView::PostActionPerformed( |
1650 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1646 ProfileMetrics::ProfileDesktopMenu action_performed) { |
1651 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1647 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
1652 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1648 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
1653 } | 1649 } |
OLD | NEW |