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

Side by Side Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 2920853004: [sync] Display an error when sync settings aren't confirmed (Closed)
Patch Set: fix compile Created 3 years, 6 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 unified diff | Download patch
OLDNEW
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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 chrome::NewIncognitoWindow(browser_); 805 chrome::NewIncognitoWindow(browser_);
806 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_GO_INCOGNITO); 806 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_GO_INCOGNITO);
807 } else if (sender == lock_button_) { 807 } else if (sender == lock_button_) {
808 profiles::LockProfile(browser_->profile()); 808 profiles::LockProfile(browser_->profile());
809 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); 809 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK);
810 } else if (sender == close_all_windows_button_) { 810 } else if (sender == close_all_windows_button_) {
811 profiles::CloseProfileWindows(browser_->profile()); 811 profiles::CloseProfileWindows(browser_->profile());
812 } else if (sender == auth_error_email_button_ || 812 } else if (sender == auth_error_email_button_ ||
813 sender == sync_error_signin_button_) { 813 sender == sync_error_signin_button_) {
814 ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH); 814 ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH);
815 } else if (sender == sync_error_passphrase_button_) { 815 } else if (sender == sync_error_passphrase_button_ ||
816 sender == sync_error_settings_unconfirmed_button_) {
816 chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage); 817 chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage);
817 } else if (sender == sync_error_upgrade_button_) { 818 } else if (sender == sync_error_upgrade_button_) {
818 chrome::OpenUpdateChromeDialog(browser_); 819 chrome::OpenUpdateChromeDialog(browser_);
819 } else if (sender == sync_error_signin_again_button_) { 820 } else if (sender == sync_error_signin_again_button_) {
820 if (ProfileSyncServiceFactory::GetForProfile(browser_->profile())) 821 if (ProfileSyncServiceFactory::GetForProfile(browser_->profile()))
821 browser_sync::ProfileSyncService::SyncEvent( 822 browser_sync::ProfileSyncService::SyncEvent(
822 browser_sync::ProfileSyncService::STOP_FROM_OPTIONS); 823 browser_sync::ProfileSyncService::STOP_FROM_OPTIONS);
823 SigninManagerFactory::GetForProfile(browser_->profile()) 824 SigninManagerFactory::GetForProfile(browser_->profile())
824 ->SignOut(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS, 825 ->SignOut(signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS,
825 signin_metrics::SignoutDelete::IGNORE_METRIC); 826 signin_metrics::SignoutDelete::IGNORE_METRIC);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 if (option_buttons_view) { 987 if (option_buttons_view) {
987 layout->StartRow(0, 0); 988 layout->StartRow(0, 0);
988 layout->AddView(option_buttons_view); 989 layout->AddView(option_buttons_view);
989 } 990 }
990 return view; 991 return view;
991 } 992 }
992 993
993 views::View* ProfileChooserView::CreateSyncErrorViewIfNeeded() { 994 views::View* ProfileChooserView::CreateSyncErrorViewIfNeeded() {
994 int content_string_id, button_string_id; 995 int content_string_id, button_string_id;
995 views::LabelButton** button_out = nullptr; 996 views::LabelButton** button_out = nullptr;
997 SigninManagerBase* signin_manager =
998 SigninManagerFactory::GetForProfile(browser_->profile());
996 sync_ui_util::AvatarSyncErrorType error = 999 sync_ui_util::AvatarSyncErrorType error =
997 sync_ui_util::GetMessagesForAvatarSyncError( 1000 sync_ui_util::GetMessagesForAvatarSyncError(
998 browser_->profile(), &content_string_id, &button_string_id); 1001 browser_->profile(), *signin_manager, &content_string_id,
1002 &button_string_id);
999 switch (error) { 1003 switch (error) {
1000 case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR: 1004 case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR:
1001 button_out = &sync_error_signout_button_; 1005 button_out = &sync_error_signout_button_;
1002 break; 1006 break;
1003 case sync_ui_util::UNRECOVERABLE_ERROR: 1007 case sync_ui_util::UNRECOVERABLE_ERROR:
1004 button_out = &sync_error_signin_again_button_; 1008 button_out = &sync_error_signin_again_button_;
1005 break; 1009 break;
1006 case sync_ui_util::SUPERVISED_USER_AUTH_ERROR: 1010 case sync_ui_util::SUPERVISED_USER_AUTH_ERROR:
1007 button_out = nullptr; 1011 button_out = nullptr;
1008 break; 1012 break;
1009 case sync_ui_util::AUTH_ERROR: 1013 case sync_ui_util::AUTH_ERROR:
1010 button_out = &sync_error_signin_button_; 1014 button_out = &sync_error_signin_button_;
1011 break; 1015 break;
1012 case sync_ui_util::UPGRADE_CLIENT_ERROR: 1016 case sync_ui_util::UPGRADE_CLIENT_ERROR:
1013 button_out = &sync_error_upgrade_button_; 1017 button_out = &sync_error_upgrade_button_;
1014 break; 1018 break;
1015 case sync_ui_util::PASSPHRASE_ERROR: 1019 case sync_ui_util::PASSPHRASE_ERROR:
1016 button_out = &sync_error_passphrase_button_; 1020 button_out = &sync_error_passphrase_button_;
1017 break; 1021 break;
1022 case sync_ui_util::SETTINGS_UNCONFIRMED_ERROR:
1023 button_out = &sync_error_settings_unconfirmed_button_;
1024 break;
1018 case sync_ui_util::NO_SYNC_ERROR: 1025 case sync_ui_util::NO_SYNC_ERROR:
1019 return nullptr; 1026 return nullptr;
1020 default: 1027 default:
1021 NOTREACHED(); 1028 NOTREACHED();
1022 } 1029 }
1023 1030
1024 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); 1031 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
1025 1032
1026 // Sets an overall horizontal layout. 1033 // Sets an overall horizontal layout.
1027 views::View* view = new views::View(); 1034 views::View* view = new views::View();
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1632 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1626 IncognitoModePrefs::DISABLED; 1633 IncognitoModePrefs::DISABLED;
1627 return incognito_available && !browser_->profile()->IsGuestSession(); 1634 return incognito_available && !browser_->profile()->IsGuestSession();
1628 } 1635 }
1629 1636
1630 void ProfileChooserView::PostActionPerformed( 1637 void ProfileChooserView::PostActionPerformed(
1631 ProfileMetrics::ProfileDesktopMenu action_performed) { 1638 ProfileMetrics::ProfileDesktopMenu action_performed) {
1632 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1639 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1633 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1640 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1634 } 1641 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698