Chromium Code Reviews| 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/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 Loading... | |
| 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 return StartsWithASCII(url.spec(), | |
| 267 GaiaUrls::GetInstance()->service_login_url(), | |
| 268 false); | |
|
Roger Tawa OOO till Jul 10th
2013/02/28 21:13:06
Nit: I think it might be better to compare using G
tim (not reviewing)
2013/03/01 01:53:57
Yeah I didn't intend on committing as is, but I ch
| |
| 269 } | |
| 270 | |
| 271 // static | |
| 262 GURL SyncPromoUI::GetNextPageURLForSyncPromoURL(const GURL& url) { | 272 GURL SyncPromoUI::GetNextPageURLForSyncPromoURL(const GURL& url) { |
| 263 const char* key_name = UseWebBasedSigninFlow() ? kSyncPromoQueryKeyContinue : | 273 const char* key_name = UseWebBasedSigninFlow() ? kSyncPromoQueryKeyContinue : |
| 264 kSyncPromoQueryKeyNextPage; | 274 kSyncPromoQueryKeyNextPage; |
| 265 std::string value; | 275 std::string value; |
| 266 if (net::GetValueForKeyInQuery(url, key_name, &value)) { | 276 if (net::GetValueForKeyInQuery(url, key_name, &value)) { |
| 267 return GURL(value); | 277 return GURL(value); |
| 268 } | 278 } |
| 269 return GURL(); | 279 return GURL(); |
| 270 } | 280 } |
| 271 | 281 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 301 g_force_web_based_signin_flow; | 311 g_force_web_based_signin_flow; |
| 302 #else | 312 #else |
| 303 return false; | 313 return false; |
| 304 #endif | 314 #endif |
| 305 } | 315 } |
| 306 | 316 |
| 307 // static | 317 // static |
| 308 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) { | 318 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) { |
| 309 g_force_web_based_signin_flow = force; | 319 g_force_web_based_signin_flow = force; |
| 310 } | 320 } |
| OLD | NEW |