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/online/v2/"; |
16 | 16 |
17 const char kDefaultWalletSecureServiceUrl[] = | 17 const char kDefaultWalletSecureServiceUrl[] = |
18 "https://wallet.google.com/online-secure/temporarydata/cvv?s7e=cvv"; | 18 "https://wallet.google.com/online-secure/temporarydata/"; |
19 | 19 |
20 GURL GetBaseWalletUrl() { | 20 GURL GetBaseWalletUrl() { |
21 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 21 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
22 std::string base_wallet_service_url = | 22 std::string base_wallet_service_url = |
23 command_line.GetSwitchValueASCII(switches::kWalletServiceUrl); | 23 command_line.GetSwitchValueASCII(switches::kWalletServiceUrl); |
24 return !base_wallet_service_url.empty() ? GURL(base_wallet_service_url) : | 24 return !base_wallet_service_url.empty() ? GURL(base_wallet_service_url) : |
25 GURL(kDefaultWalletServiceUrl); | 25 GURL(kDefaultWalletServiceUrl); |
26 } | 26 } |
27 | 27 |
28 GURL GetBaseAutocheckoutUrl() { | 28 GURL GetBaseAutocheckoutUrl() { |
29 return GetBaseWalletUrl().Resolve("wallet/autocheckout/"); | 29 return GetBaseWalletUrl().Resolve("wallet/autocheckout/"); |
30 } | 30 } |
31 | 31 |
32 GURL GetBaseSecureUrl() { | |
33 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
34 std::string wallet_secure_url = | |
35 command_line.GetSwitchValueASCII(switches::kWalletSecureServiceUrl); | |
36 return !wallet_secure_url.empty() ? GURL(wallet_secure_url) : | |
37 GURL(kDefaultWalletSecureServiceUrl); | |
Raman Kakilate
2013/01/08 02:10:28
make const GURL ? instead of building one for ever
ahutter
2013/01/09 17:31:18
ack.
| |
38 } | |
39 | |
32 } // anonymous namespace | 40 } // anonymous namespace |
33 | 41 |
34 namespace wallet { | 42 namespace wallet { |
35 | 43 |
36 // TODO(ahutter): This shouldn't live in this class. See | 44 // TODO(ahutter): This shouldn't live in this class. See |
37 // http://crbug.com/164281. | 45 // http://crbug.com/164281. |
38 const char kApiKey[] = "abcdefg"; | 46 const char kApiKey[] = "abcdefg"; |
39 | 47 |
40 GURL GetGetWalletItemsUrl() { | 48 GURL GetGetWalletItemsUrl() { |
41 return GetBaseWalletUrl().Resolve( | 49 return GetBaseWalletUrl().Resolve( |
(...skipping 13 matching lines...) Expand all Loading... | |
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 GetBaseSecureUrl().Resolve("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 |