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

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

Issue 1862963003: Only handle the first AccountAddedToCookie event in OneClickSigninSyncStarter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« 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.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 const GURL& current_url, 83 const GURL& current_url,
84 const GURL& continue_url, 84 const GURL& continue_url,
85 Callback sync_setup_completed_callback) 85 Callback sync_setup_completed_callback)
86 : content::WebContentsObserver(web_contents), 86 : content::WebContentsObserver(web_contents),
87 profile_(NULL), 87 profile_(NULL),
88 start_mode_(start_mode), 88 start_mode_(start_mode),
89 confirmation_required_(confirmation_required), 89 confirmation_required_(confirmation_required),
90 current_url_(current_url), 90 current_url_(current_url),
91 continue_url_(continue_url), 91 continue_url_(continue_url),
92 sync_setup_completed_callback_(sync_setup_completed_callback), 92 sync_setup_completed_callback_(sync_setup_completed_callback),
93 first_account_added_to_cookie_(false),
93 weak_pointer_factory_(this) { 94 weak_pointer_factory_(this) {
94 DCHECK(profile); 95 DCHECK(profile);
95 DCHECK(web_contents || continue_url.is_empty()); 96 DCHECK(web_contents || continue_url.is_empty());
96 BrowserList::AddObserver(this); 97 BrowserList::AddObserver(this);
97 Initialize(profile, browser); 98 Initialize(profile, browser);
98 99
99 // Policy is enabled, so pass in a callback to do extra policy-related UI 100 // Policy is enabled, so pass in a callback to do extra policy-related UI
100 // before signin completes. 101 // before signin completes.
101 SigninManagerFactory::GetForProfile(profile_)-> 102 SigninManagerFactory::GetForProfile(profile_)->
102 StartSignInWithRefreshToken( 103 StartSignInWithRefreshToken(
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 return; 452 return;
452 signin_metrics::LogSigninAccessPointCompleted( 453 signin_metrics::LogSigninAccessPointCompleted(
453 signin::GetAccessPointForPromoURL(current_url_)); 454 signin::GetAccessPointForPromoURL(current_url_));
454 signin_metrics::LogSigninReason( 455 signin_metrics::LogSigninReason(
455 signin::GetSigninReasonForPromoURL(current_url_)); 456 signin::GetSigninReasonForPromoURL(current_url_));
456 content::RecordAction(base::UserMetricsAction("Signin_Signin_Succeed")); 457 content::RecordAction(base::UserMetricsAction("Signin_Signin_Succeed"));
457 } 458 }
458 459
459 void OneClickSigninSyncStarter::AccountAddedToCookie( 460 void OneClickSigninSyncStarter::AccountAddedToCookie(
460 const GoogleServiceAuthError& error) { 461 const GoogleServiceAuthError& error) {
462 if (first_account_added_to_cookie_)
463 return;
464
465 first_account_added_to_cookie_ = true;
466
461 // Regardless of whether the account was successfully added or not, 467 // Regardless of whether the account was successfully added or not,
462 // continue with sync starting. 468 // continue with sync starting.
463 469
464 if (switches::UsePasswordSeparatedSigninFlow()) { 470 if (switches::UsePasswordSeparatedSigninFlow()) {
465 // Under the new signin flow, the sync confirmation dialog should always be 471 // Under the new signin flow, the sync confirmation dialog should always be
466 // shown regardless of |start_mode_|. |sync_setup_completed_callback_| will 472 // shown regardless of |start_mode_|. |sync_setup_completed_callback_| will
467 // be run after the modal is closed. 473 // be run after the modal is closed.
468 DisplayModalSyncConfirmationWindow(); 474 DisplayModalSyncConfirmationWindow();
469 return; 475 return;
470 } 476 }
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 false /* user_gesture */); 648 false /* user_gesture */);
643 } 649 }
644 650
645 void OneClickSigninSyncStarter::LoadContinueUrl() { 651 void OneClickSigninSyncStarter::LoadContinueUrl() {
646 web_contents()->GetController().LoadURL( 652 web_contents()->GetController().LoadURL(
647 continue_url_, 653 continue_url_,
648 content::Referrer(), 654 content::Referrer(),
649 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 655 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
650 std::string()); 656 std::string());
651 } 657 }
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