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

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

Issue 23005016: [sync] Force re-auth during sync setup if Oauth2 token is unavailable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More feedback Created 7 years, 4 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 | « chrome/browser/signin/profile_oauth2_token_service.cc ('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_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 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 one_click_signin::HISTOGRAM_ACCEPTED); 1256 one_click_signin::HISTOGRAM_ACCEPTED);
1257 } else { 1257 } else {
1258 LogHistogramValue(source_, one_click_signin::HISTOGRAM_ACCEPTED); 1258 LogHistogramValue(source_, one_click_signin::HISTOGRAM_ACCEPTED);
1259 LogHistogramValue(source_, one_click_signin::HISTOGRAM_WITH_DEFAULTS); 1259 LogHistogramValue(source_, one_click_signin::HISTOGRAM_WITH_DEFAULTS);
1260 } 1260 }
1261 1261
1262 // - If sign in was initiated from the NTP or the hotdog menu, sync with 1262 // - If sign in was initiated from the NTP or the hotdog menu, sync with
1263 // default settings. 1263 // default settings.
1264 // - If sign in was initiated from the settings page for first time sync 1264 // - If sign in was initiated from the settings page for first time sync
1265 // set up, show the advanced sync settings dialog. 1265 // set up, show the advanced sync settings dialog.
1266 // - If sign in was initiated from the settings page due to a re-auth, 1266 // - If sign in was initiated from the settings page due to a re-auth when
1267 // simply navigate back to the settings page. 1267 // sync was already setup, simply navigate back to the settings page.
1268 ProfileSyncService* sync_service =
1269 ProfileSyncServiceFactory::GetForProfile(profile);
1268 OneClickSigninSyncStarter::StartSyncMode start_mode = 1270 OneClickSigninSyncStarter::StartSyncMode start_mode =
1269 source_ == signin::SOURCE_SETTINGS ? 1271 source_ == signin::SOURCE_SETTINGS ?
1270 SigninGlobalError::GetForProfile(profile)->HasMenuItem() ? 1272 (SigninGlobalError::GetForProfile(profile)->HasMenuItem() &&
1273 sync_service && sync_service->HasSyncSetupCompleted()) ?
1271 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE : 1274 OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE :
1272 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST : 1275 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST :
1273 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; 1276 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS;
1274 1277
1275 std::string last_email = 1278 std::string last_email =
1276 profile->GetPrefs()->GetString(prefs::kGoogleServicesLastUsername); 1279 profile->GetPrefs()->GetString(prefs::kGoogleServicesLastUsername);
1277 1280
1278 if (!last_email.empty() && !gaia::AreEmailsSame(last_email, email_)) { 1281 if (!last_email.empty() && !gaia::AreEmailsSame(last_email, email_)) {
1279 // If the new email address is different from the email address that 1282 // If the new email address is different from the email address that
1280 // just signed in, show a confirmation dialog. 1283 // just signed in, show a confirmation dialog.
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 // If the web contents is showing a blank page and not about to be closed, 1399 // If the web contents is showing a blank page and not about to be closed,
1397 // redirect to the NTP or apps page. 1400 // redirect to the NTP or apps page.
1398 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && 1401 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) &&
1399 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { 1402 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) {
1400 RedirectToNtpOrAppsPage( 1403 RedirectToNtpOrAppsPage(
1401 web_contents(), 1404 web_contents(),
1402 signin::GetSourceForPromoURL(original_continue_url_)); 1405 signin::GetSourceForPromoURL(original_continue_url_));
1403 } 1406 }
1404 } 1407 }
1405 } 1408 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/profile_oauth2_token_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698