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

Side by Side Diff: chrome/browser/ui/webui/sync_setup_handler.cc

Issue 277433003: Fix a crash on showing sync setup dialog in guest mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test Created 6 years, 7 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 (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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/sync_setup_handler.h ('k') | chrome/browser/ui/webui/sync_setup_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698