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 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 one_click_signin::HISTOGRAM_ACCEPTED); | 1244 one_click_signin::HISTOGRAM_ACCEPTED); |
1245 } else { | 1245 } else { |
1246 LogHistogramValue(source_, one_click_signin::HISTOGRAM_ACCEPTED); | 1246 LogHistogramValue(source_, one_click_signin::HISTOGRAM_ACCEPTED); |
1247 LogHistogramValue(source_, one_click_signin::HISTOGRAM_WITH_DEFAULTS); | 1247 LogHistogramValue(source_, one_click_signin::HISTOGRAM_WITH_DEFAULTS); |
1248 } | 1248 } |
1249 | 1249 |
1250 // - If sign in was initiated from the NTP or the hotdog menu, sync with | 1250 // - If sign in was initiated from the NTP or the hotdog menu, sync with |
1251 // default settings. | 1251 // default settings. |
1252 // - If sign in was initiated from the settings page for first time sync | 1252 // - If sign in was initiated from the settings page for first time sync |
1253 // set up, show the advanced sync settings dialog. | 1253 // set up, show the advanced sync settings dialog. |
1254 // - If sign in was initiated from the settings page due to a re-auth when | 1254 // - If sign in was initiated from the settings page due to a re-auth, |
1255 // sync was already setup, simply navigate back to the settings page. | 1255 // simply navigate back to the settings page. |
1256 ProfileSyncService* sync_service = | |
1257 ProfileSyncServiceFactory::GetForProfile(profile); | |
1258 OneClickSigninSyncStarter::StartSyncMode start_mode = | 1256 OneClickSigninSyncStarter::StartSyncMode start_mode = |
1259 source_ == signin::SOURCE_SETTINGS ? | 1257 source_ == signin::SOURCE_SETTINGS ? |
1260 (SigninGlobalError::GetForProfile(profile)->HasMenuItem() && | 1258 SigninGlobalError::GetForProfile(profile)->HasMenuItem() ? |
1261 sync_service && sync_service->HasSyncSetupCompleted()) ? | |
1262 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE : | 1259 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE : |
1263 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST : | 1260 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST : |
1264 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; | 1261 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; |
1265 | 1262 |
1266 std::string last_email = | 1263 std::string last_email = |
1267 profile->GetPrefs()->GetString(prefs::kGoogleServicesLastUsername); | 1264 profile->GetPrefs()->GetString(prefs::kGoogleServicesLastUsername); |
1268 | 1265 |
1269 if (!last_email.empty() && !gaia::AreEmailsSame(last_email, email_)) { | 1266 if (!last_email.empty() && !gaia::AreEmailsSame(last_email, email_)) { |
1270 // If the new email address is different from the email address that | 1267 // If the new email address is different from the email address that |
1271 // just signed in, show a confirmation dialog. | 1268 // just signed in, show a confirmation dialog. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 // If the web contents is showing a blank page and not about to be closed, | 1394 // If the web contents is showing a blank page and not about to be closed, |
1398 // redirect to the NTP or apps page. | 1395 // redirect to the NTP or apps page. |
1399 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && | 1396 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && |
1400 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { | 1397 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { |
1401 RedirectToNtpOrAppsPage( | 1398 RedirectToNtpOrAppsPage( |
1402 web_contents(), | 1399 web_contents(), |
1403 signin::GetSourceForPromoURL(original_continue_url_)); | 1400 signin::GetSourceForPromoURL(original_continue_url_)); |
1404 } | 1401 } |
1405 } | 1402 } |
1406 } | 1403 } |
OLD | NEW |