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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_sync_starter.cc

Issue 2600473002: Remove the temporary flag to disable the sync confirmation page. (Closed)
Patch Set: Fix upstream branch Created 4 years 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
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_sync_starter.h ('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/sync/one_click_signin_sync_starter.h" 5 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // Let the sync service know that setup is in progress so it doesn't start 135 // Let the sync service know that setup is in progress so it doesn't start
136 // syncing until the user has finished any configuration. 136 // syncing until the user has finished any configuration.
137 ProfileSyncService* profile_sync_service = GetProfileSyncService(); 137 ProfileSyncService* profile_sync_service = GetProfileSyncService();
138 if (profile_sync_service) 138 if (profile_sync_service)
139 sync_blocker_ = profile_sync_service->GetSetupInProgressHandle(); 139 sync_blocker_ = profile_sync_service->GetSetupInProgressHandle();
140 140
141 // Make sure the syncing is requested, otherwise the SigninManager 141 // Make sure the syncing is requested, otherwise the SigninManager
142 // will not be able to complete successfully. 142 // will not be able to complete successfully.
143 syncer::SyncPrefs sync_prefs(profile_->GetPrefs()); 143 syncer::SyncPrefs sync_prefs(profile_->GetPrefs());
144 sync_prefs.SetSyncRequested(true); 144 sync_prefs.SetSyncRequested(true);
145 skip_sync_confirm_ = false;
146 } 145 }
147 146
148 void OneClickSigninSyncStarter::ConfirmSignin(const std::string& oauth_token) { 147 void OneClickSigninSyncStarter::ConfirmSignin(const std::string& oauth_token) {
149 DCHECK(!oauth_token.empty()); 148 DCHECK(!oauth_token.empty());
150 SigninManager* signin = SigninManagerFactory::GetForProfile(profile_); 149 SigninManager* signin = SigninManagerFactory::GetForProfile(profile_);
151 // If this is a new signin (no account authenticated yet) try loading 150 // If this is a new signin (no account authenticated yet) try loading
152 // policy for this user now, before any signed in services are initialized. 151 // policy for this user now, before any signed in services are initialized.
153 if (!signin->IsAuthenticated()) { 152 if (!signin->IsAuthenticated()) {
154 policy::UserPolicySigninService* policy_service = 153 policy::UserPolicySigninService* policy_service =
155 policy::UserPolicySigninServiceFactory::GetForProfile(profile_); 154 policy::UserPolicySigninServiceFactory::GetForProfile(profile_);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 DCHECK(!new_signin_manager->IsAuthenticated()); 304 DCHECK(!new_signin_manager->IsAuthenticated());
306 DCHECK(!dm_token_.empty()); 305 DCHECK(!dm_token_.empty());
307 DCHECK(!client_id_.empty()); 306 DCHECK(!client_id_.empty());
308 307
309 // Copy credentials from the old profile to the just-created profile, 308 // Copy credentials from the old profile to the just-created profile,
310 // and switch over to tracking that profile. 309 // and switch over to tracking that profile.
311 new_signin_manager->CopyCredentialsFrom(*old_signin_manager); 310 new_signin_manager->CopyCredentialsFrom(*old_signin_manager);
312 FinishProfileSyncServiceSetup(); 311 FinishProfileSyncServiceSetup();
313 Initialize(new_profile, nullptr); 312 Initialize(new_profile, nullptr);
314 DCHECK_EQ(profile_, new_profile); 313 DCHECK_EQ(profile_, new_profile);
315 skip_sync_confirm_ = true;
316 314
317 // We've transferred our credentials to the new profile - notify that 315 // We've transferred our credentials to the new profile - notify that
318 // the signin for the original profile was cancelled (must do this after 316 // the signin for the original profile was cancelled (must do this after
319 // we have called Initialize() with the new profile, as otherwise this 317 // we have called Initialize() with the new profile, as otherwise this
320 // object will get freed when the signin on the old profile is cancelled. 318 // object will get freed when the signin on the old profile is cancelled.
321 old_signin_manager->SignOut(signin_metrics::TRANSFER_CREDENTIALS, 319 old_signin_manager->SignOut(signin_metrics::TRANSFER_CREDENTIALS,
322 signin_metrics::SignoutDelete::IGNORE_METRIC); 320 signin_metrics::SignoutDelete::IGNORE_METRIC);
323 321
324 // Load policy for the just-created profile - once policy has finished 322 // Load policy for the just-created profile - once policy has finished
325 // loading the signin process will complete. 323 // loading the signin process will complete.
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 void OneClickSigninSyncStarter::AccountAddedToCookie( 469 void OneClickSigninSyncStarter::AccountAddedToCookie(
472 const GoogleServiceAuthError& error) { 470 const GoogleServiceAuthError& error) {
473 if (first_account_added_to_cookie_) 471 if (first_account_added_to_cookie_)
474 return; 472 return;
475 473
476 first_account_added_to_cookie_ = true; 474 first_account_added_to_cookie_ = true;
477 475
478 // Regardless of whether the account was successfully added or not, 476 // Regardless of whether the account was successfully added or not,
479 // continue with sync starting. 477 // continue with sync starting.
480 478
481 // TODO(zmin): Remove this hack once the https://crbug.com/657924 fixed.
482 // Skip the Sync confirmation dialog if user choose to create a new profile
483 // for the corp signin. This is because the dialog doesn't work properly
484 // after the corp signin.
485 if (skip_sync_confirm_) {
486 OnSyncConfirmationUIClosed(LoginUIService::ABORT_SIGNIN);
487 return;
488 }
489 479
490 if (switches::UsePasswordSeparatedSigninFlow()) { 480 if (switches::UsePasswordSeparatedSigninFlow()) {
491 // Under the new signin flow, the sync confirmation dialog should always be 481 // Under the new signin flow, the sync confirmation dialog should always be
492 // shown regardless of |start_mode_|. |sync_setup_completed_callback_| will 482 // shown regardless of |start_mode_|. |sync_setup_completed_callback_| will
493 // be run after the modal is closed. 483 // be run after the modal is closed.
494 DisplayModalSyncConfirmationWindow(); 484 DisplayModalSyncConfirmationWindow();
495 return; 485 return;
496 } 486 }
497 487
498 if (!sync_setup_completed_callback_.is_null()) 488 if (!sync_setup_completed_callback_.is_null())
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 false /* user_gesture */); 653 false /* user_gesture */);
664 } 654 }
665 655
666 void OneClickSigninSyncStarter::LoadContinueUrl() { 656 void OneClickSigninSyncStarter::LoadContinueUrl() {
667 web_contents()->GetController().LoadURL( 657 web_contents()->GetController().LoadURL(
668 continue_url_, 658 continue_url_,
669 content::Referrer(), 659 content::Referrer(),
670 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 660 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
671 std::string()); 661 std::string());
672 } 662 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_sync_starter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698