Chromium Code Reviews| Index: components/autofill/content/browser/wallet/wallet_service_url.cc |
| diff --git a/components/autofill/content/browser/wallet/wallet_service_url.cc b/components/autofill/content/browser/wallet/wallet_service_url.cc |
| index c5397635cdb1328564dc7b4029ab3e14278c88ee..88ac169239c639a878aeaa9293cb2a053c8f24f2 100644 |
| --- a/components/autofill/content/browser/wallet/wallet_service_url.cc |
| +++ b/components/autofill/content/browser/wallet/wallet_service_url.cc |
| @@ -12,6 +12,7 @@ |
| #include "base/strings/string_number_conversions.h" |
| #include "base/strings/stringprintf.h" |
| #include "components/autofill/core/common/autofill_switches.h" |
| +#include "content/public/common/url_constants.h" |
| #include "google_apis/gaia/gaia_urls.h" |
| #include "net/base/url_util.h" |
| #include "url/gurl.h" |
| @@ -29,6 +30,9 @@ const char kSandboxWalletServiceUrl[] = |
| const char kSandboxWalletSecureServiceUrl[] = |
| "https://wallet-web.sandbox.google.com/"; |
| +// Set to true during some tests. |
| +bool g_use_testing_sign_in_continue_url = false; |
|
Dan Beam
2014/01/02 21:43:37
^ this isn't really global if it's only available
|
| + |
| bool IsWalletProductionEnabled() { |
| const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| std::string sandbox_enabled( |
| @@ -150,12 +154,19 @@ GURL GetSignInUrl() { |
| // important what the URL actually is: it's not important that this URL has the |
| // ability to generate a gdToken. |
| GURL GetSignInContinueUrl() { |
| + if (g_use_testing_sign_in_continue_url) |
| + return GURL(content::kAboutBlankURL); |
| + |
| return GetPassiveAuthUrl(0); |
| } |
| +void SetUseTestingSignInContinueUrl() { |
| + g_use_testing_sign_in_continue_url = true; |
| +} |
| + |
| bool IsSignInContinueUrl(const GURL& url, size_t* user_index) { |
| - GURL final_url = wallet::GetSignInContinueUrl(); |
| - if (!url.SchemeIsSecure() || |
| + GURL final_url = GetSignInContinueUrl(); |
| + if (url.scheme() != final_url.scheme() || |
| url.host() != final_url.host() || |
| url.path() != final_url.path()) { |
| return false; |
| @@ -179,7 +190,9 @@ bool IsSignInContinueUrl(const GURL& url, size_t* user_index) { |
| } |
| bool IsSignInRelatedUrl(const GURL& url) { |
| - return url.GetOrigin() == GetSignInUrl().GetOrigin(); |
| + size_t unused; |
| + return url.GetOrigin() == GetSignInUrl().GetOrigin() || |
| + IsSignInContinueUrl(url, &unused); |
| } |
| bool IsUsingProd() { |