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 "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 const char kDefaultWalletServiceUrl[] = "https://wallet.google.com/online/v2/"; | 15 const char kDefaultWalletServiceUrl[] = "https://wallet.google.com/"; |
16 | 16 |
17 const char kDefaultWalletSecureServiceUrl[] = | 17 GURL GetWalletHostUrl() { |
18 "https://wallet.google.com/online-secure/temporarydata/cvv?s7e=cvv"; | 18 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 19 std::string wallet_service_hostname = |
| 20 command_line.GetSwitchValueASCII(switches::kWalletServiceUrl); |
| 21 return !wallet_service_hostname.empty() ? GURL(wallet_service_hostname) : |
| 22 GURL(kDefaultWalletServiceUrl); |
| 23 } |
19 | 24 |
20 GURL GetBaseWalletUrl() { | 25 GURL GetBaseWalletUrl() { |
21 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 26 return GetWalletHostUrl().Resolve("online/v2/"); |
22 std::string base_wallet_service_url = | |
23 command_line.GetSwitchValueASCII(switches::kWalletServiceUrl); | |
24 return !base_wallet_service_url.empty() ? GURL(base_wallet_service_url) : | |
25 GURL(kDefaultWalletServiceUrl); | |
26 } | 27 } |
27 | 28 |
28 GURL GetBaseAutocheckoutUrl() { | 29 GURL GetBaseAutocheckoutUrl() { |
29 return GetBaseWalletUrl().Resolve("wallet/autocheckout/"); | 30 return GetBaseWalletUrl().Resolve("wallet/autocheckout/"); |
30 } | 31 } |
31 | 32 |
| 33 GURL GetBaseSecureUrl() { |
| 34 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 35 std::string wallet_secure_url = |
| 36 command_line.GetSwitchValueASCII(switches::kWalletSecureServiceUrl); |
| 37 return !wallet_secure_url.empty() ? GURL(wallet_secure_url) : |
| 38 GURL(kDefaultWalletServiceUrl); |
| 39 } |
| 40 |
32 } // anonymous namespace | 41 } // anonymous namespace |
33 | 42 |
34 namespace wallet { | 43 namespace wallet { |
35 | 44 |
36 // TODO(ahutter): This shouldn't live in this class. See | 45 // TODO(ahutter): This shouldn't live in this class. See |
37 // http://crbug.com/164281. | 46 // http://crbug.com/164281. |
38 const char kApiKey[] = "abcdefg"; | 47 const char kApiKey[] = "abcdefg"; |
39 | 48 |
40 GURL GetGetWalletItemsUrl() { | 49 GURL GetGetWalletItemsUrl() { |
41 return GetBaseWalletUrl().Resolve( | 50 return GetBaseAutocheckoutUrl().Resolve("getWalletItemsJwtless"); |
42 "wallet/autocheckout/getWalletItemsJwtless"); | |
43 } | 51 } |
44 | 52 |
45 GURL GetGetFullWalletUrl() { | 53 GURL GetGetFullWalletUrl() { |
46 return GetBaseAutocheckoutUrl().Resolve("getFullWalletJwtless"); | 54 return GetBaseAutocheckoutUrl().Resolve("getFullWalletJwtless"); |
47 } | 55 } |
48 | 56 |
49 GURL GetAcceptLegalDocumentsUrl() { | 57 GURL GetAcceptLegalDocumentsUrl() { |
50 return GetBaseAutocheckoutUrl().Resolve("acceptLegalDocuments"); | 58 return GetBaseAutocheckoutUrl().Resolve("acceptLegalDocuments"); |
51 } | 59 } |
52 | 60 |
53 GURL GetSendStatusUrl() { | 61 GURL GetSendStatusUrl() { |
54 return GetBaseAutocheckoutUrl().Resolve("reportStatus"); | 62 return GetBaseAutocheckoutUrl().Resolve("reportStatus"); |
55 } | 63 } |
56 | 64 |
57 GURL GetSaveToWalletUrl() { | 65 GURL GetSaveToWalletUrl() { |
58 return GetBaseAutocheckoutUrl().Resolve("saveToWallet"); | 66 return GetBaseAutocheckoutUrl().Resolve("saveToWallet"); |
59 } | 67 } |
60 | 68 |
61 GURL GetPassiveAuthUrl() { | 69 GURL GetPassiveAuthUrl() { |
62 return GetBaseWalletUrl().Resolve("passiveauth"); | 70 return GetBaseWalletUrl().Resolve("passiveauth"); |
63 } | 71 } |
64 | 72 |
65 GURL GetSecureUrl() { | 73 GURL GetEncryptionUrl() { |
66 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 74 return GetWalletHostUrl().Resolve("online-secure/temporarydata/cvv?s7e=cvv"); |
67 std::string wallet_secure_url = | 75 } |
68 command_line.GetSwitchValueASCII(switches::kWalletSecureServiceUrl); | 76 |
69 return !wallet_secure_url.empty() ? GURL(wallet_secure_url) : | 77 GURL GetEscrowUrl() { |
70 GURL(kDefaultWalletSecureServiceUrl); | 78 return GetBaseSecureUrl().Resolve("dehEfe?s7e=cardNumber%3Bcvv"); |
71 } | 79 } |
72 | 80 |
73 } // namespace wallet | 81 } // namespace wallet |
OLD | NEW |