OLD | NEW |
---|---|
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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 } | 222 } |
223 | 223 |
224 // Start syncing with the given user information. | 224 // Start syncing with the given user information. |
225 void StartSync(const StartSyncArgs& args, | 225 void StartSync(const StartSyncArgs& args, |
226 OneClickSigninSyncStarter::StartSyncMode start_mode) { | 226 OneClickSigninSyncStarter::StartSyncMode start_mode) { |
227 if (start_mode == OneClickSigninSyncStarter::UNDO_SYNC) { | 227 if (start_mode == OneClickSigninSyncStarter::UNDO_SYNC) { |
228 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_UNDO); | 228 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_UNDO); |
229 return; | 229 return; |
230 } | 230 } |
231 | 231 |
232 // If we are giving the user the option to configure sync, then that will | |
233 // suffice as a confirmation. | |
234 OneClickSigninSyncStarter::ConfirmationRequired confirmation = | |
235 args.confirmation_required; | |
236 if (start_mode == OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST && | |
237 confirmation == OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN) { | |
238 confirmation = OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; | |
239 } | |
240 | |
241 // The starter deletes itself once its done. | 232 // The starter deletes itself once its done. |
242 new OneClickSigninSyncStarter(args.profile, args.browser, args.session_index, | 233 new OneClickSigninSyncStarter(args.profile, args.browser, args.session_index, |
243 args.email, args.password, start_mode, | 234 args.email, args.password, start_mode, |
244 args.force_same_tab_navigation, | 235 args.force_same_tab_navigation, |
245 confirmation); | 236 args.confirmation_required, |
237 args.source); | |
246 | 238 |
247 int action = one_click_signin::HISTOGRAM_MAX; | 239 int action = one_click_signin::HISTOGRAM_MAX; |
248 switch (args.auto_accept) { | 240 switch (args.auto_accept) { |
249 case OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT: | 241 case OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT: |
250 break; | 242 break; |
251 case OneClickSigninHelper::AUTO_ACCEPT_ACCEPTED: | 243 case OneClickSigninHelper::AUTO_ACCEPT_ACCEPTED: |
252 action = | 244 action = |
253 start_mode == OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS ? | 245 start_mode == OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS ? |
254 one_click_signin::HISTOGRAM_AUTO_WITH_DEFAULTS : | 246 one_click_signin::HISTOGRAM_AUTO_WITH_DEFAULTS : |
255 one_click_signin::HISTOGRAM_AUTO_WITH_ADVANCED; | 247 one_click_signin::HISTOGRAM_AUTO_WITH_ADVANCED; |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1143 StartSync(StartSyncArgs(profile, browser, auto_accept_, | 1135 StartSync(StartSyncArgs(profile, browser, auto_accept_, |
1144 session_index_, email_, password_, | 1136 session_index_, email_, password_, |
1145 false /* force_same_tab_navigation */, | 1137 false /* force_same_tab_navigation */, |
1146 true /* confirmation_required */, source_), | 1138 true /* confirmation_required */, source_), |
1147 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); | 1139 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); |
1148 break; | 1140 break; |
1149 case AUTO_ACCEPT_CONFIGURE: | 1141 case AUTO_ACCEPT_CONFIGURE: |
1150 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_ACCEPTED); | 1142 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_ACCEPTED); |
1151 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_WITH_ADVANCED); | 1143 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_WITH_ADVANCED); |
1152 SigninManager::DisableOneClickSignIn(profile); | 1144 SigninManager::DisableOneClickSignIn(profile); |
1153 // Don't bother displaying an extra confirmation (even in the SAML case) | 1145 // Display the extra confirmation (even in the SAML case) in case this |
1154 // since the user will get prompted to setup sync anyway. | 1146 // was an untrusted renderer. |
1155 StartSync( | 1147 StartSync( |
1156 StartSyncArgs(profile, browser, auto_accept_, session_index_, email_, | 1148 StartSyncArgs(profile, browser, auto_accept_, session_index_, email_, |
1157 password_, false /* force_same_tab_navigation */, | 1149 password_, false /* force_same_tab_navigation */, |
1158 false /* confirmation_required */, source_), | 1150 true /* confirmation_required */, source_), |
Andrew T Wilson (Slow)
2013/06/24 08:48:13
Why are we *always* displaying this confirmation,
| |
1159 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST); | 1151 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST); |
1160 break; | 1152 break; |
1161 case AUTO_ACCEPT_EXPLICIT: { | 1153 case AUTO_ACCEPT_EXPLICIT: { |
1162 if (switched_to_advanced_) { | 1154 if (switched_to_advanced_) { |
1163 LogHistogramValue(original_source_, | 1155 LogHistogramValue(original_source_, |
1164 one_click_signin::HISTOGRAM_WITH_ADVANCED); | 1156 one_click_signin::HISTOGRAM_WITH_ADVANCED); |
1165 LogHistogramValue(original_source_, | 1157 LogHistogramValue(original_source_, |
1166 one_click_signin::HISTOGRAM_ACCEPTED); | 1158 one_click_signin::HISTOGRAM_ACCEPTED); |
1167 } else { | 1159 } else { |
1168 LogHistogramValue(source_, one_click_signin::HISTOGRAM_ACCEPTED); | 1160 LogHistogramValue(source_, one_click_signin::HISTOGRAM_ACCEPTED); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1251 contents->GetController().LoadURL(redirect_url_, | 1243 contents->GetController().LoadURL(redirect_url_, |
1252 content::Referrer(), | 1244 content::Referrer(), |
1253 content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 1245 content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
1254 std::string()); | 1246 std::string()); |
1255 } | 1247 } |
1256 | 1248 |
1257 // Clear the redirect URL. | 1249 // Clear the redirect URL. |
1258 redirect_url_ = GURL(); | 1250 redirect_url_ = GURL(); |
1259 sync_service->RemoveObserver(this); | 1251 sync_service->RemoveObserver(this); |
1260 } | 1252 } |
OLD | NEW |