| 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/autofill/wallet/wallet_service_url.h" | 5 #include "chrome/browser/autofill/wallet/wallet_service_url.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| 11 #include "chrome/common/net/url_util.h" | |
| 12 #include "google_apis/gaia/gaia_urls.h" | 11 #include "google_apis/gaia/gaia_urls.h" |
| 13 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 13 #include "net/base/url_util.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 const char kDefaultWalletServiceUrl[] = "https://wallet.google.com/"; | 17 const char kDefaultWalletServiceUrl[] = "https://wallet.google.com/"; |
| 18 | 18 |
| 19 GURL GetWalletHostUrl() { | 19 GURL GetWalletHostUrl() { |
| 20 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 20 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 21 std::string wallet_service_hostname = | 21 std::string wallet_service_hostname = |
| 22 command_line.GetSwitchValueASCII(switches::kWalletServiceUrl); | 22 command_line.GetSwitchValueASCII(switches::kWalletServiceUrl); |
| 23 return !wallet_service_hostname.empty() ? GURL(wallet_service_hostname) : | 23 return !wallet_service_hostname.empty() ? GURL(wallet_service_hostname) : |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 GURL GetEncryptionUrl() { | 75 GURL GetEncryptionUrl() { |
| 76 return GetWalletHostUrl().Resolve("online-secure/temporarydata/cvv?s7e=cvv"); | 76 return GetWalletHostUrl().Resolve("online-secure/temporarydata/cvv?s7e=cvv"); |
| 77 } | 77 } |
| 78 | 78 |
| 79 GURL GetEscrowUrl() { | 79 GURL GetEscrowUrl() { |
| 80 return GetBaseSecureUrl().Resolve("dehEfe?s7e=cardNumber%3Bcvv"); | 80 return GetBaseSecureUrl().Resolve("dehEfe?s7e=cardNumber%3Bcvv"); |
| 81 } | 81 } |
| 82 | 82 |
| 83 GURL GetSignInUrl() { | 83 GURL GetSignInUrl() { |
| 84 GURL url(GaiaUrls::GetInstance()->service_login_url()); | 84 GURL url(GaiaUrls::GetInstance()->service_login_url()); |
| 85 url = chrome_common_net::AppendQueryParameter(url, "service", "sierra"); | 85 url = net::AppendQueryParameter(url, "service", "sierra"); |
| 86 url = chrome_common_net::AppendQueryParameter(url, "btmpl", "popup"); | 86 url = net::AppendQueryParameter(url, "btmpl", "popup"); |
| 87 url = chrome_common_net::AppendQueryParameter( | 87 url = net::AppendQueryParameter(url, |
| 88 url, | 88 "continue", |
| 89 "continue", | 89 GetSignInContinueUrl().spec()); |
| 90 GetSignInContinueUrl().spec()); | |
| 91 return url; | 90 return url; |
| 92 } | 91 } |
| 93 | 92 |
| 94 // The continue url portion of the sign-in URL. | 93 // The continue url portion of the sign-in URL. |
| 95 GURL GetSignInContinueUrl() { | 94 GURL GetSignInContinueUrl() { |
| 96 return GetPassiveAuthUrl(); | 95 return GetPassiveAuthUrl(); |
| 97 } | 96 } |
| 98 | 97 |
| 99 bool IsSignInContinueUrl(const GURL& url) { | 98 bool IsSignInContinueUrl(const GURL& url) { |
| 100 GURL final_url = wallet::GetSignInContinueUrl(); | 99 GURL final_url = wallet::GetSignInContinueUrl(); |
| 101 return url.SchemeIsSecure() && | 100 return url.SchemeIsSecure() && |
| 102 url.host() == final_url.host() && | 101 url.host() == final_url.host() && |
| 103 url.path() == final_url.path(); | 102 url.path() == final_url.path(); |
| 104 } | 103 } |
| 105 | 104 |
| 106 } // namespace wallet | 105 } // namespace wallet |
| OLD | NEW |