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

Side by Side Diff: chrome/browser/ui/webui/sync_setup_handler.cc

Issue 12310009: Merge 182705 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1410/src/
Patch Set: 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 | « chrome/browser/ui/webui/options/browser_options_handler.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/webui/sync_setup_handler.h" 5 #include "chrome/browser/ui/webui/sync_setup_handler.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 if (!PrepareSyncSetup()) 1130 if (!PrepareSyncSetup())
1131 return; 1131 return;
1132 1132
1133 // There are several different UI flows that can bring the user here: 1133 // There are several different UI flows that can bring the user here:
1134 // 1) Signin promo (passes force_login=true) 1134 // 1) Signin promo (passes force_login=true)
1135 // 2) Normal signin through options page (GetAuthenticatedUsername() is 1135 // 2) Normal signin through options page (GetAuthenticatedUsername() is
1136 // empty). 1136 // empty).
1137 // 3) Previously working credentials have expired. 1137 // 3) Previously working credentials have expired.
1138 // 4) User is already signed in, but App Notifications needs to force another 1138 // 4) User is already signed in, but App Notifications needs to force another
1139 // login so it can fetch an oauth token (passes force_login=true) 1139 // login so it can fetch an oauth token (passes force_login=true)
1140 // 5) User clicks [Advanced Settings] button on options page while already 1140 // 5) User is signed in, but has stopped sync via the google dashboard, and
1141 // signout is prohibited by policy so we need to force a re-auth.
1142 // 6) User clicks [Advanced Settings] button on options page while already
1141 // logged in. 1143 // logged in.
1142 // 6) One-click signin (credentials are already available, so should display 1144 // 7) One-click signin (credentials are already available, so should display
1143 // sync configure UI, not login UI). 1145 // sync configure UI, not login UI).
1144 // 7) ChromeOS re-enable after disabling sync. 1146 // 8) ChromeOS re-enable after disabling sync.
1145 SigninManager* signin = GetSignin(); 1147 SigninManager* signin = GetSignin();
1146 if (force_login || 1148 if (force_login ||
1147 signin->GetAuthenticatedUsername().empty() || 1149 signin->GetAuthenticatedUsername().empty() ||
1150 #if !defined(OS_CHROMEOS)
1151 (GetSyncService() && GetSyncService()->IsStartSuppressed()) ||
1152 #endif
1148 signin->signin_global_error()->HasBadge()) { 1153 signin->signin_global_error()->HasBadge()) {
1149 // User is not logged in, or login has been specially requested - need to 1154 // User is not logged in, or login has been specially requested - need to
1150 // display login UI (cases 1-4). 1155 // display login UI (cases 1-4).
1151 DisplayGaiaLogin(false); 1156 DisplayGaiaLogin(false);
1152 } else { 1157 } else {
1153 if (!GetSyncService()) { 1158 if (!GetSyncService()) {
1154 // This can happen if the user directly navigates to /settings/syncSetup. 1159 // This can happen if the user directly navigates to /settings/syncSetup.
1155 DLOG(WARNING) << "Cannot display sync UI when sync is disabled"; 1160 DLOG(WARNING) << "Cannot display sync UI when sync is disabled";
1156 CloseOverlay(); 1161 CloseOverlay();
1157 return; 1162 return;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 if (i != current_profile_index && AreUserNamesEqual( 1306 if (i != current_profile_index && AreUserNamesEqual(
1302 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { 1307 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) {
1303 *error_message = l10n_util::GetStringUTF16( 1308 *error_message = l10n_util::GetStringUTF16(
1304 IDS_SYNC_USER_NAME_IN_USE_ERROR); 1309 IDS_SYNC_USER_NAME_IN_USE_ERROR);
1305 return false; 1310 return false;
1306 } 1311 }
1307 } 1312 }
1308 1313
1309 return true; 1314 return true;
1310 } 1315 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698