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

Side by Side Diff: chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc

Issue 12374007: signin: force web signin flow initiated visits to accounts.google.com to their own process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review nit Created 7 years, 9 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
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_promo/sync_promo_ui.h" 5 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 base::StringAppendF(&url_string, "&%s=%s", kSyncPromoQueryKeyNextPage, 252 base::StringAppendF(&url_string, "&%s=%s", kSyncPromoQueryKeyNextPage,
253 net::EscapeQueryParamValue(next_page.spec(), 253 net::EscapeQueryParamValue(next_page.spec(),
254 false).c_str()); 254 false).c_str());
255 } 255 }
256 } 256 }
257 257
258 return GURL(url_string); 258 return GURL(url_string);
259 } 259 }
260 260
261 // static 261 // static
262 bool SyncPromoUI::IsWebBasedSigninFlowURL(const GURL& url) {
263 if (url.SchemeIs(chrome::kChromeSigninScheme))
264 return true;
265
266 GURL service_login(GaiaUrls::GetInstance()->service_login_url());
267 if (url.GetOrigin() != service_login.GetOrigin())
268 return false;
269
270 return url.path() == service_login.path();
271 }
272
273 // static
262 GURL SyncPromoUI::GetNextPageURLForSyncPromoURL(const GURL& url) { 274 GURL SyncPromoUI::GetNextPageURLForSyncPromoURL(const GURL& url) {
263 const char* key_name = UseWebBasedSigninFlow() ? kSyncPromoQueryKeyContinue : 275 const char* key_name = UseWebBasedSigninFlow() ? kSyncPromoQueryKeyContinue :
264 kSyncPromoQueryKeyNextPage; 276 kSyncPromoQueryKeyNextPage;
265 std::string value; 277 std::string value;
266 if (net::GetValueForKeyInQuery(url, key_name, &value)) { 278 if (net::GetValueForKeyInQuery(url, key_name, &value)) {
267 return GURL(value); 279 return GURL(value);
268 } 280 }
269 return GURL(); 281 return GURL();
270 } 282 }
271 283
(...skipping 29 matching lines...) Expand all
301 g_force_web_based_signin_flow; 313 g_force_web_based_signin_flow;
302 #else 314 #else
303 return false; 315 return false;
304 #endif 316 #endif
305 } 317 }
306 318
307 // static 319 // static
308 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) { 320 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) {
309 g_force_web_based_signin_flow = force; 321 g_force_web_based_signin_flow = force;
310 } 322 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698