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