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

Side by Side Diff: chrome/browser/ui/webui/sync_setup_handler.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 typos 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/sync/one_click_signin_helper.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 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 void SyncSetupHandler::DidStopLoading( 1200 void SyncSetupHandler::DidStopLoading(
1201 content::RenderViewHost* render_view_host) { 1201 content::RenderViewHost* render_view_host) {
1202 DCHECK(active_gaia_signin_tab_); 1202 DCHECK(active_gaia_signin_tab_);
1203 1203
1204 // If the user lands on a page outside of Gaia, assume they have navigated 1204 // If the user lands on a page outside of Gaia, assume they have navigated
1205 // away and are no longer thinking about signing in with this tab. Treat 1205 // away and are no longer thinking about signing in with this tab. Treat
1206 // this as if the user closed the tab. However, don't actually close the tab 1206 // this as if the user closed the tab. However, don't actually close the tab
1207 // since the user is doing something with it. Disconnect and forget about it 1207 // since the user is doing something with it. Disconnect and forget about it
1208 // before closing down the sync setup. 1208 // before closing down the sync setup.
1209 // The one exception is the expected continue URL. If the user lands there, 1209 // The one exception is the expected continue URL. If the user lands there,
1210 // this means sign in was successful. 1210 // this means sign in was successful. Ignore the source parameter in the
1211 // continue URL since this user may have changed the state of the
1212 // "Let me choose what to sync" checkbox.
1211 const GURL& url = active_gaia_signin_tab_->GetURL(); 1213 const GURL& url = active_gaia_signin_tab_->GetURL();
1212 const GURL continue_url = 1214 const GURL continue_url =
1213 SyncPromoUI::GetNextPageURLForSyncPromoURL( 1215 SyncPromoUI::GetNextPageURLForSyncPromoURL(
1214 SyncPromoUI::GetSyncPromoURL(GURL(), 1216 SyncPromoUI::GetSyncPromoURL(GURL(),
1215 SyncPromoUI::SOURCE_SETTINGS, 1217 SyncPromoUI::SOURCE_SETTINGS,
1216 false)); 1218 false));
1219 GURL::Replacements replacements;
1220 replacements.ClearQuery();
1217 1221
1218 if (url != continue_url && !gaia::IsGaiaSignonRealm(url.GetOrigin())) { 1222 if (!gaia::IsGaiaSignonRealm(url.GetOrigin()) &&
1223 url.ReplaceComponents(replacements) !=
1224 continue_url.ReplaceComponents(replacements)) {
1219 content::WebContentsObserver::Observe(NULL); 1225 content::WebContentsObserver::Observe(NULL);
1220 active_gaia_signin_tab_ = NULL; 1226 active_gaia_signin_tab_ = NULL;
1221 CloseSyncSetup(); 1227 CloseSyncSetup();
1222 } 1228 }
1223 } 1229 }
1224 1230
1225 void SyncSetupHandler::WebContentsDestroyed( 1231 void SyncSetupHandler::WebContentsDestroyed(
1226 content::WebContents* web_contents) { 1232 content::WebContents* web_contents) {
1227 DCHECK(active_gaia_signin_tab_); 1233 DCHECK(active_gaia_signin_tab_);
1228 CloseSyncSetup(); 1234 CloseSyncSetup();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 if (i != current_profile_index && AreUserNamesEqual( 1306 if (i != current_profile_index && AreUserNamesEqual(
1301 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { 1307 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) {
1302 *error_message = l10n_util::GetStringUTF16( 1308 *error_message = l10n_util::GetStringUTF16(
1303 IDS_SYNC_USER_NAME_IN_USE_ERROR); 1309 IDS_SYNC_USER_NAME_IN_USE_ERROR);
1304 return false; 1310 return false;
1305 } 1311 }
1306 } 1312 }
1307 1313
1308 return true; 1314 return true;
1309 } 1315 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698