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

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

Issue 10534075: [sync] Make SetSetupInProgress kick sync engine when needed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove call to SetSyncSetupCompleted, and change kick-mechanism Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_sync_starter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 ProfileSyncService::CANCEL_DURING_CONFIGURE); 855 ProfileSyncService::CANCEL_DURING_CONFIGURE);
856 } else { 856 } else {
857 ProfileSyncService::SyncEvent( 857 ProfileSyncService::SyncEvent(
858 ProfileSyncService::CANCEL_FROM_SIGNON_WITHOUT_AUTH); 858 ProfileSyncService::CANCEL_FROM_SIGNON_WITHOUT_AUTH);
859 } 859 }
860 } 860 }
861 861
862 // Let the various services know that we're no longer active. 862 // Let the various services know that we're no longer active.
863 GetLoginUIService()->LoginUIClosed(this); 863 GetLoginUIService()->LoginUIClosed(this);
864 if (sync_service) 864 if (sync_service)
865 sync_service->set_setup_in_progress(false); 865 sync_service->SetSetupInProgress(false);
866 866
867 // Make sure user isn't left half-logged-in (signed in, but without sync 867 // Make sure user isn't left half-logged-in (signed in, but without sync
868 // started up). If the user hasn't finished setting up sync, then sign out 868 // started up). If the user hasn't finished setting up sync, then sign out
869 // and shut down sync. 869 // and shut down sync.
870 if (sync_service && !sync_service->HasSyncSetupCompleted()) { 870 if (sync_service && !sync_service->HasSyncSetupCompleted()) {
871 DVLOG(1) << "Signin aborted by user action"; 871 DVLOG(1) << "Signin aborted by user action";
872 // Calling DisableForUser() will also sign the user out on desktop 872 // Calling DisableForUser() will also sign the user out on desktop
873 // platforms (platforms without sync auto-start enabled). 873 // platforms (platforms without sync auto-start enabled).
874 sync_service->DisableForUser(); 874 sync_service->DisableForUser();
875 875
(...skipping 29 matching lines...) Expand all
905 905
906 // If the wizard is already visible, just focus that one. 906 // If the wizard is already visible, just focus that one.
907 if (FocusExistingWizardIfPresent()) { 907 if (FocusExistingWizardIfPresent()) {
908 if (!IsActiveLogin()) 908 if (!IsActiveLogin())
909 CloseOverlay(); 909 CloseOverlay();
910 return; 910 return;
911 } 911 }
912 912
913 // Notify services that we are now active. 913 // Notify services that we are now active.
914 GetLoginUIService()->SetLoginUI(this); 914 GetLoginUIService()->SetLoginUI(this);
915 service->set_setup_in_progress(true); 915 service->SetSetupInProgress(true);
916 916
917 // There are several different UI flows that can bring the user here: 917 // There are several different UI flows that can bring the user here:
918 // 1) Signin promo (passes force_login=true) 918 // 1) Signin promo (passes force_login=true)
919 // 2) Normal signin through options page (IsSyncEnabledAndLoggedIn() will 919 // 2) Normal signin through options page (IsSyncEnabledAndLoggedIn() will
920 // return false). 920 // return false).
921 // 3) Previously working credentials have expired 921 // 3) Previously working credentials have expired
922 // (service->GetAuthError() != NONE). 922 // (service->GetAuthError() != NONE).
923 // 4) User is already signed in, but App Notifications needs to force another 923 // 4) User is already signed in, but App Notifications needs to force another
924 // login so it can fetch an oauth token (passes force_login=true) 924 // login so it can fetch an oauth token (passes force_login=true)
925 // 5) User clicks [Advanced Settings] button on options page while already 925 // 5) User clicks [Advanced Settings] button on options page while already
(...skipping 22 matching lines...) Expand all
948 948
949 void SyncSetupHandler::PrepareConfigDialog() { 949 void SyncSetupHandler::PrepareConfigDialog() {
950 // On Chrome OS user is always logged in. Instead of showing login dialog, 950 // On Chrome OS user is always logged in. Instead of showing login dialog,
951 // show spinner until the backend gets ready to configure sync. 951 // show spinner until the backend gets ready to configure sync.
952 ProfileSyncService* service = GetSyncService(); 952 ProfileSyncService* service = GetSyncService();
953 if (!service->sync_initialized()) { 953 if (!service->sync_initialized()) {
954 // To listen to the token available notifications, start SigninTracker. 954 // To listen to the token available notifications, start SigninTracker.
955 signin_tracker_.reset( 955 signin_tracker_.reset(
956 new SigninTracker(GetProfile(), this, 956 new SigninTracker(GetProfile(), this,
957 SigninTracker::SERVICES_INITIALIZING)); 957 SigninTracker::SERVICES_INITIALIZING));
958 service->set_setup_in_progress(true); 958 service->SetSetupInProgress(true);
959 service->UnsuppressAndStart(); 959 service->UnsuppressAndStart();
960 DisplaySpinner(); 960 DisplaySpinner();
961 } else { 961 } else {
962 DisplayConfigureSync(true, false); 962 DisplayConfigureSync(true, false);
963 } 963 }
964 } 964 }
965 965
966 void SyncSetupHandler::FocusUI() { 966 void SyncSetupHandler::FocusUI() {
967 DCHECK(IsActiveLogin()); 967 DCHECK(IsActiveLogin());
968 WebContents* web_contents = web_ui()->GetWebContents(); 968 WebContents* web_contents = web_ui()->GetWebContents();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 if (i != current_profile_index && AreUserNamesEqual( 1021 if (i != current_profile_index && AreUserNamesEqual(
1022 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { 1022 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) {
1023 *error_message = l10n_util::GetStringUTF16( 1023 *error_message = l10n_util::GetStringUTF16(
1024 IDS_SYNC_USER_NAME_IN_USE_ERROR); 1024 IDS_SYNC_USER_NAME_IN_USE_ERROR);
1025 return false; 1025 return false;
1026 } 1026 }
1027 } 1027 }
1028 1028
1029 return true; 1029 return true;
1030 } 1030 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_sync_starter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698