| 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/app/vector_icons/vector_icons.h" | 10 #include "chrome/app/vector_icons/vector_icons.h" |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 if (oauth2_token_service) | 569 if (oauth2_token_service) |
| 570 oauth2_token_service->RemoveObserver(this); | 570 oauth2_token_service->RemoveObserver(this); |
| 571 } | 571 } |
| 572 | 572 |
| 573 void ProfileChooserView::ResetView() { | 573 void ProfileChooserView::ResetView() { |
| 574 open_other_profile_indexes_map_.clear(); | 574 open_other_profile_indexes_map_.clear(); |
| 575 delete_account_button_map_.clear(); | 575 delete_account_button_map_.clear(); |
| 576 reauth_account_button_map_.clear(); | 576 reauth_account_button_map_.clear(); |
| 577 sync_error_signin_button_ = nullptr; | 577 sync_error_signin_button_ = nullptr; |
| 578 sync_error_passphrase_button_ = nullptr; | 578 sync_error_passphrase_button_ = nullptr; |
| 579 sync_error_settings_unconfirmed_button_ = nullptr; |
| 579 sync_error_upgrade_button_ = nullptr; | 580 sync_error_upgrade_button_ = nullptr; |
| 580 sync_error_signin_again_button_ = nullptr; | 581 sync_error_signin_again_button_ = nullptr; |
| 581 sync_error_signout_button_ = nullptr; | 582 sync_error_signout_button_ = nullptr; |
| 582 manage_accounts_link_ = nullptr; | 583 manage_accounts_link_ = nullptr; |
| 583 manage_accounts_button_ = nullptr; | 584 manage_accounts_button_ = nullptr; |
| 584 signin_current_profile_button_ = nullptr; | 585 signin_current_profile_button_ = nullptr; |
| 585 current_profile_card_ = nullptr; | 586 current_profile_card_ = nullptr; |
| 586 first_profile_button_ = nullptr; | 587 first_profile_button_ = nullptr; |
| 587 guest_profile_button_ = nullptr; | 588 guest_profile_button_ = nullptr; |
| 588 users_button_ = nullptr; | 589 users_button_ = nullptr; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 DCHECK(ShouldShowGoIncognito()); | 799 DCHECK(ShouldShowGoIncognito()); |
| 799 chrome::NewIncognitoWindow(browser_); | 800 chrome::NewIncognitoWindow(browser_); |
| 800 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_GO_INCOGNITO); | 801 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_GO_INCOGNITO); |
| 801 } else if (sender == lock_button_) { | 802 } else if (sender == lock_button_) { |
| 802 profiles::LockProfile(browser_->profile()); | 803 profiles::LockProfile(browser_->profile()); |
| 803 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); | 804 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); |
| 804 } else if (sender == close_all_windows_button_) { | 805 } else if (sender == close_all_windows_button_) { |
| 805 profiles::CloseProfileWindows(browser_->profile()); | 806 profiles::CloseProfileWindows(browser_->profile()); |
| 806 } else if (sender == sync_error_signin_button_) { | 807 } else if (sender == sync_error_signin_button_) { |
| 807 ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH); | 808 ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH); |
| 808 } else if (sender == sync_error_passphrase_button_) { | 809 } else if (sender == sync_error_passphrase_button_ || |
| 810 sender == sync_error_settings_unconfirmed_button_) { |
| 809 chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage); | 811 chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage); |
| 810 } else if (sender == sync_error_upgrade_button_) { | 812 } else if (sender == sync_error_upgrade_button_) { |
| 811 chrome::OpenUpdateChromeDialog(browser_); | 813 chrome::OpenUpdateChromeDialog(browser_); |
| 812 } else if (sender == sync_error_signin_again_button_) { | 814 } else if (sender == sync_error_signin_again_button_) { |
| 813 if (ProfileSyncServiceFactory::GetForProfile(browser_->profile())) | 815 if (ProfileSyncServiceFactory::GetForProfile(browser_->profile())) |
| 814 browser_sync::ProfileSyncService::SyncEvent( | 816 browser_sync::ProfileSyncService::SyncEvent( |
| 815 browser_sync::ProfileSyncService::STOP_FROM_OPTIONS); | 817 browser_sync::ProfileSyncService::STOP_FROM_OPTIONS); |
| 816 SigninManagerFactory::GetForProfile(browser_->profile()) | 818 SigninManagerFactory::GetForProfile(browser_->profile()) |
| 817 ->SignOut(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS, | 819 ->SignOut(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS, |
| 818 signin_metrics::SignoutDelete::IGNORE_METRIC); | 820 signin_metrics::SignoutDelete::IGNORE_METRIC); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 if (option_buttons_view) { | 981 if (option_buttons_view) { |
| 980 layout->StartRow(0, 0); | 982 layout->StartRow(0, 0); |
| 981 layout->AddView(option_buttons_view); | 983 layout->AddView(option_buttons_view); |
| 982 } | 984 } |
| 983 return view; | 985 return view; |
| 984 } | 986 } |
| 985 | 987 |
| 986 views::View* ProfileChooserView::CreateSyncErrorViewIfNeeded() { | 988 views::View* ProfileChooserView::CreateSyncErrorViewIfNeeded() { |
| 987 int content_string_id, button_string_id; | 989 int content_string_id, button_string_id; |
| 988 views::LabelButton** button_out = nullptr; | 990 views::LabelButton** button_out = nullptr; |
| 991 SigninManagerBase* signin_manager = |
| 992 SigninManagerFactory::GetForProfile(browser_->profile()); |
| 989 sync_ui_util::AvatarSyncErrorType error = | 993 sync_ui_util::AvatarSyncErrorType error = |
| 990 sync_ui_util::GetMessagesForAvatarSyncError( | 994 sync_ui_util::GetMessagesForAvatarSyncError( |
| 991 browser_->profile(), &content_string_id, &button_string_id); | 995 browser_->profile(), *signin_manager, &content_string_id, |
| 996 &button_string_id); |
| 992 switch (error) { | 997 switch (error) { |
| 993 case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR: | 998 case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR: |
| 994 button_out = &sync_error_signout_button_; | 999 button_out = &sync_error_signout_button_; |
| 995 break; | 1000 break; |
| 996 case sync_ui_util::UNRECOVERABLE_ERROR: | 1001 case sync_ui_util::UNRECOVERABLE_ERROR: |
| 997 button_out = &sync_error_signin_again_button_; | 1002 button_out = &sync_error_signin_again_button_; |
| 998 break; | 1003 break; |
| 999 case sync_ui_util::SUPERVISED_USER_AUTH_ERROR: | 1004 case sync_ui_util::SUPERVISED_USER_AUTH_ERROR: |
| 1000 button_out = nullptr; | 1005 button_out = nullptr; |
| 1001 break; | 1006 break; |
| 1002 case sync_ui_util::AUTH_ERROR: | 1007 case sync_ui_util::AUTH_ERROR: |
| 1003 button_out = &sync_error_signin_button_; | 1008 button_out = &sync_error_signin_button_; |
| 1004 break; | 1009 break; |
| 1005 case sync_ui_util::UPGRADE_CLIENT_ERROR: | 1010 case sync_ui_util::UPGRADE_CLIENT_ERROR: |
| 1006 button_out = &sync_error_upgrade_button_; | 1011 button_out = &sync_error_upgrade_button_; |
| 1007 break; | 1012 break; |
| 1008 case sync_ui_util::PASSPHRASE_ERROR: | 1013 case sync_ui_util::PASSPHRASE_ERROR: |
| 1009 button_out = &sync_error_passphrase_button_; | 1014 button_out = &sync_error_passphrase_button_; |
| 1010 break; | 1015 break; |
| 1016 case sync_ui_util::SETTINGS_UNCONFIRMED_ERROR: |
| 1017 button_out = &sync_error_settings_unconfirmed_button_; |
| 1018 break; |
| 1011 case sync_ui_util::NO_SYNC_ERROR: | 1019 case sync_ui_util::NO_SYNC_ERROR: |
| 1012 return nullptr; | 1020 return nullptr; |
| 1013 default: | 1021 default: |
| 1014 NOTREACHED(); | 1022 NOTREACHED(); |
| 1015 } | 1023 } |
| 1016 | 1024 |
| 1017 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); | 1025 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
| 1018 | 1026 |
| 1019 // Sets an overall horizontal layout. | 1027 // Sets an overall horizontal layout. |
| 1020 views::View* view = new views::View(); | 1028 views::View* view = new views::View(); |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1626 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1619 IncognitoModePrefs::DISABLED; | 1627 IncognitoModePrefs::DISABLED; |
| 1620 return incognito_available && !browser_->profile()->IsGuestSession(); | 1628 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1621 } | 1629 } |
| 1622 | 1630 |
| 1623 void ProfileChooserView::PostActionPerformed( | 1631 void ProfileChooserView::PostActionPerformed( |
| 1624 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1632 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1625 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1633 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1626 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1634 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1627 } | 1635 } |
| OLD | NEW |