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/sync/one_click_signin_helper.cc

Issue 12256015: Signing in to sync as a different user is redirecting to sync settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix continue url check Created 7 years, 10 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 | « no previous file | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | 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_helper.h" 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 // The starter deletes itself once its done. 130 // The starter deletes itself once its done.
131 new OneClickSigninSyncStarter(args.profile, args.browser, args.session_index, 131 new OneClickSigninSyncStarter(args.profile, args.browser, args.session_index,
132 args.email, args.password, start_mode, 132 args.email, args.password, start_mode,
133 /* force_same_tab_navigation */ 133 /* force_same_tab_navigation */
134 args.last_minute_source_change); 134 args.last_minute_source_change);
135 135
136 int action = one_click_signin::HISTOGRAM_MAX; 136 int action = one_click_signin::HISTOGRAM_MAX;
137 switch (args.auto_accept) { 137 switch (args.auto_accept) {
138 case OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT: 138 case OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT:
139 action = one_click_signin::HISTOGRAM_AUTO_WITH_DEFAULTS;
140 break;
141 case OneClickSigninHelper::AUTO_ACCEPT_ACCEPTED:
142 action = 139 action =
143 start_mode == OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS ? 140 start_mode == OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS ?
144 one_click_signin::HISTOGRAM_AUTO_WITH_DEFAULTS : 141 one_click_signin::HISTOGRAM_AUTO_WITH_DEFAULTS :
145 one_click_signin::HISTOGRAM_AUTO_WITH_ADVANCED; 142 one_click_signin::HISTOGRAM_AUTO_WITH_ADVANCED;
146 break; 143 break;
144 case OneClickSigninHelper::AUTO_ACCEPT_ACCEPTED:
145 action = one_click_signin::HISTOGRAM_AUTO_WITH_DEFAULTS;
146 break;
Roger Tawa OOO till Jul 10th 2013/02/13 19:39:29 This change is not related to this bug, but I noti
147 case OneClickSigninHelper::AUTO_ACCEPT_NONE: 147 case OneClickSigninHelper::AUTO_ACCEPT_NONE:
148 action = 148 action =
149 start_mode == OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS ? 149 start_mode == OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS ?
150 one_click_signin::HISTOGRAM_WITH_DEFAULTS : 150 one_click_signin::HISTOGRAM_WITH_DEFAULTS :
151 one_click_signin::HISTOGRAM_WITH_ADVANCED; 151 one_click_signin::HISTOGRAM_WITH_ADVANCED;
152 break; 152 break;
153 case OneClickSigninHelper::AUTO_ACCEPT_CONFIGURE: 153 case OneClickSigninHelper::AUTO_ACCEPT_CONFIGURE:
154 DCHECK(start_mode == OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST); 154 DCHECK(start_mode == OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST);
155 action = one_click_signin::HISTOGRAM_AUTO_WITH_ADVANCED; 155 action = one_click_signin::HISTOGRAM_AUTO_WITH_ADVANCED;
156 break; 156 break;
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 const bool continue_url_match = (url.ReplaceComponents(replacements) == 986 const bool continue_url_match = (url.ReplaceComponents(replacements) ==
987 continue_url_.ReplaceComponents(replacements)); 987 continue_url_.ReplaceComponents(replacements));
988 if (!continue_url_match) { 988 if (!continue_url_match) {
989 VLOG(1) << "OneClickSigninHelper::DidStopLoading: invalid url='" 989 VLOG(1) << "OneClickSigninHelper::DidStopLoading: invalid url='"
990 << url.spec() 990 << url.spec()
991 << "' expected continue url=" << continue_url_; 991 << "' expected continue url=" << continue_url_;
992 CleanTransientState(); 992 CleanTransientState();
993 return; 993 return;
994 } 994 }
995 995
996 // In explicit sign ins, the user may have checked the box 996 // In explicit sign ins, the user may have changed the box
997 // "Let me choose what to sync". This is reflected as a change in the 997 // "Let me choose what to sync". This is reflected as a change in the
998 // source of the continue URL. Make one last check of the current URL 998 // source of the continue URL. Make one last check of the current URL
999 // to see if there is a valid source and its set to settings. If so, 999 // to see if there is a valid source. If so, it overrides the
1000 // it overrides the current source. 1000 // current source.
1001 SyncPromoUI::Source source = 1001 SyncPromoUI::Source source =
1002 SyncPromoUI::GetSourceForSyncPromoURL(url); 1002 SyncPromoUI::GetSourceForSyncPromoURL(url);
1003 if (source == SyncPromoUI::SOURCE_SETTINGS && 1003 if (source != source_) {
guohui 2013/02/13 21:59:55 Why do we care about source changes other than fro
Roger Tawa OOO till Jul 10th 2013/02/14 15:53:36 As mentioned in the description, it is now possibl
1004 source_ != SyncPromoUI::SOURCE_SETTINGS) { 1004 source_ = source;
1005 source_ = SyncPromoUI::SOURCE_SETTINGS;
1006 last_minute_source_change = true; 1005 last_minute_source_change = true;
1007 } 1006 }
1008 } 1007 }
1009 } 1008 }
1010 1009
1011 Browser* browser = chrome::FindBrowserWithWebContents(contents); 1010 Browser* browser = chrome::FindBrowserWithWebContents(contents);
1012 Profile* profile = 1011 Profile* profile =
1013 Profile::FromBrowserContext(contents->GetBrowserContext()); 1012 Profile::FromBrowserContext(contents->GetBrowserContext());
1014 1013
1015 VLOG(1) << "OneClickSigninHelper::DidStopLoading: signin is go." 1014 VLOG(1) << "OneClickSigninHelper::DidStopLoading: signin is go."
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 StartExplicitSync( 1076 StartExplicitSync(
1078 StartSyncArgs(profile, browser, auto_accept_, session_index_, 1077 StartSyncArgs(profile, browser, auto_accept_, session_index_,
1079 email_, password_, last_minute_source_change), 1078 email_, password_, last_minute_source_change),
1080 contents, 1079 contents,
1081 start_mode, 1080 start_mode,
1082 IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_CANCEL_BUTTON); 1081 IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_CANCEL_BUTTON);
1083 } 1082 }
1084 1083
1085 if (last_minute_source_change && 1084 if (last_minute_source_change &&
1086 SyncPromoUI::GetSourceForSyncPromoURL(continue_url_) == 1085 SyncPromoUI::GetSourceForSyncPromoURL(continue_url_) ==
1087 SyncPromoUI::SOURCE_WEBSTORE_INSTALL) { 1086 SyncPromoUI::SOURCE_WEBSTORE_INSTALL) {
Roger Tawa OOO till Jul 10th 2013/02/13 19:39:29 Hui: how does this change affect signing in from t
guohui 2013/02/13 21:59:55 Before this CL, last_minute_source_change is only
guohui 2013/02/13 22:15:30 And yes, if last_minute_source_change is true in a
Roger Tawa OOO till Jul 10th 2013/02/14 15:53:36 OK, I added the check. But I think the last minut
guohui 2013/02/14 16:43:29 yes, if you add a check for 'source_ == settings',
1088 redirect_url_ = continue_url_; 1087 redirect_url_ = continue_url_;
1089 ProfileSyncService* sync_service = 1088 ProfileSyncService* sync_service =
1090 ProfileSyncServiceFactory::GetForProfile(profile); 1089 ProfileSyncServiceFactory::GetForProfile(profile);
1091 if (sync_service) 1090 if (sync_service)
1092 sync_service->AddObserver(this); 1091 sync_service->AddObserver(this);
1093 } 1092 }
1094 1093
1095 // If this explicit sign in is not from settings page/webstore, show the 1094 // If this explicit sign in is not from settings page/webstore, show the
1096 // NTP after sign in completes. In the case of the settings page, it will 1095 // NTP after sign in completes. In the case of the settings page, it will
1097 // get closed by SyncSetupHandler. In the case of webstore, it will 1096 // get closed by SyncSetupHandler. In the case of webstore, it will
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 break; 1163 break;
1165 } 1164 }
1166 } 1165 }
1167 1166
1168 RedirectToNTP(); 1167 RedirectToNTP();
1169 } 1168 }
1170 1169
1171 void OneClickSigninHelper::SigninSuccess() { 1170 void OneClickSigninHelper::SigninSuccess() {
1172 RedirectToNTP(); 1171 RedirectToNTP();
1173 } 1172 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698