OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webui/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/sync_setup_handler.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_CUSTOMIZE); | 722 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_CUSTOMIZE); |
723 if (configuration.encrypt_all) | 723 if (configuration.encrypt_all) |
724 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_ENCRYPT); | 724 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_ENCRYPT); |
725 if (configuration.passphrase_is_gaia && !configuration.passphrase.empty()) | 725 if (configuration.passphrase_is_gaia && !configuration.passphrase.empty()) |
726 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_PASSPHRASE); | 726 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_PASSPHRASE); |
727 if (!configuration.sync_everything) | 727 if (!configuration.sync_everything) |
728 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_CHOOSE); | 728 ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_CHOOSE); |
729 } | 729 } |
730 | 730 |
731 void SyncSetupHandler::HandleShowSetupUI(const base::ListValue* args) { | 731 void SyncSetupHandler::HandleShowSetupUI(const base::ListValue* args) { |
732 ProfileSyncService* service = GetSyncService(); | 732 if (!GetSyncService()) { |
733 DCHECK(service); | 733 DLOG(WARNING) << "Cannot display sync UI when sync is disabled"; |
| 734 CloseUI(); |
| 735 return; |
| 736 } |
734 | 737 |
735 SigninManagerBase* signin = | 738 SigninManagerBase* signin = |
736 SigninManagerFactory::GetForProfile(GetProfile()); | 739 SigninManagerFactory::GetForProfile(GetProfile()); |
737 if (signin->GetAuthenticatedUsername().empty()) { | 740 if (signin->GetAuthenticatedUsername().empty()) { |
738 // For web-based signin, the signin page is not displayed in an overlay | 741 // For web-based signin, the signin page is not displayed in an overlay |
739 // on the settings page. So if we get here, it must be due to the user | 742 // on the settings page. So if we get here, it must be due to the user |
740 // cancelling signin (by reloading the sync settings page during initial | 743 // cancelling signin (by reloading the sync settings page during initial |
741 // signin) or by directly navigating to settings/syncSetup | 744 // signin) or by directly navigating to settings/syncSetup |
742 // (http://crbug.com/229836). So just exit and go back to the settings page. | 745 // (http://crbug.com/229836). So just exit and go back to the settings page. |
743 DLOG(WARNING) << "Cannot display sync setup UI when not signed in"; | 746 DLOG(WARNING) << "Cannot display sync setup UI when not signed in"; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 | 922 |
920 LoginUIService* service = GetLoginUIService(); | 923 LoginUIService* service = GetLoginUIService(); |
921 DCHECK(service); | 924 DCHECK(service); |
922 service->current_login_ui()->FocusUI(); | 925 service->current_login_ui()->FocusUI(); |
923 return true; | 926 return true; |
924 } | 927 } |
925 | 928 |
926 LoginUIService* SyncSetupHandler::GetLoginUIService() const { | 929 LoginUIService* SyncSetupHandler::GetLoginUIService() const { |
927 return LoginUIServiceFactory::GetForProfile(GetProfile()); | 930 return LoginUIServiceFactory::GetForProfile(GetProfile()); |
928 } | 931 } |
OLD | NEW |