Chromium Code Reviews| 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[] = |
| 16 "https://wallet.google.com/online/v2/wallet/autocheckout/"; | 16 "https://wallet.google.com/online/v2/"; |
|
Ilya Sherman
2013/01/04 22:11:46
nit: Looks like this will now (juuust barely) fit
Albert Bodenhamer
2013/01/04 22:54:38
Done.
| |
| 17 | 17 |
| 18 const char kDefaultWalletSecureServiceUrl[] = | 18 const char kDefaultWalletSecureServiceUrl[] = |
| 19 "https://wallet.google.com/online-secure/temporarydata/cvv?s7e=cvv"; | 19 "https://wallet.google.com/online-secure/temporarydata/cvv?s7e=cvv"; |
| 20 | 20 |
| 21 GURL GetBaseWalletUrl() { | 21 GURL GetBaseWalletUrl() { |
| 22 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 22 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 23 std::string base_wallet_service_url = | 23 std::string base_wallet_service_url = |
| 24 command_line.GetSwitchValueASCII(switches::kWalletServiceUrl); | 24 command_line.GetSwitchValueASCII(switches::kWalletServiceUrl); |
| 25 return !base_wallet_service_url.empty() ? GURL(base_wallet_service_url) : | 25 return !base_wallet_service_url.empty() ? GURL(base_wallet_service_url) : |
| 26 GURL(kDefaultWalletServiceUrl); | 26 GURL(kDefaultWalletServiceUrl); |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // anonymous namespace | 29 } // anonymous namespace |
| 30 | 30 |
| 31 namespace wallet { | |
| 32 | |
| 31 // TODO(ahutter): This shouldn't live in this class. See | 33 // TODO(ahutter): This shouldn't live in this class. See |
| 32 // http://crbug.com/164281. | 34 // http://crbug.com/164281. |
| 33 const char wallet::kApiKey[] = "abcdefg"; | 35 const char wallet::kApiKey[] = "abcdefg"; |
|
Ilya Sherman
2013/01/04 22:11:46
nit: Remove the "wallet::" prefix?
Albert Bodenhamer
2013/01/04 22:54:38
Done.
| |
| 34 | 36 |
| 35 GURL wallet::GetGetWalletItemsUrl() { | 37 GURL GetGetWalletItemsUrl() { |
| 36 return GetBaseWalletUrl().Resolve("getWalletItemsJwtless"); | 38 return GetBaseWalletUrl().Resolve( |
| 39 "wallet/autocheckout/getWalletItemsJwtless"); | |
|
Ilya Sherman
2013/01/04 22:11:46
Optional nit: It seems a little repetitive to need
Albert Bodenhamer
2013/01/04 22:54:38
Done.
| |
| 37 } | 40 } |
| 38 | 41 |
| 39 GURL wallet::GetGetFullWalletUrl() { | 42 GURL GetGetFullWalletUrl() { |
| 40 return GetBaseWalletUrl().Resolve("getFullWalletJwtless"); | 43 return GetBaseWalletUrl().Resolve("wallet/autocheckout/getFullWalletJwtless"); |
| 41 } | 44 } |
| 42 | 45 |
| 43 GURL wallet::GetAcceptLegalDocumentsUrl() { | 46 GURL GetAcceptLegalDocumentsUrl() { |
| 44 return GetBaseWalletUrl().Resolve("acceptLegalDocuments"); | 47 return GetBaseWalletUrl().Resolve("wallet/autocheckout/acceptLegalDocuments"); |
| 45 } | 48 } |
| 46 | 49 |
| 47 GURL wallet::GetSendStatusUrl() { | 50 GURL GetSendStatusUrl() { |
| 48 return GetBaseWalletUrl().Resolve("reportStatus"); | 51 return GetBaseWalletUrl().Resolve("wallet/autocheckout/reportStatus"); |
| 49 } | 52 } |
| 50 | 53 |
| 51 GURL wallet::GetSaveToWalletUrl() { | 54 GURL GetSaveToWalletUrl() { |
| 52 return GetBaseWalletUrl().Resolve("saveToWallet"); | 55 return GetBaseWalletUrl().Resolve("wallet/autocheckout/saveToWallet"); |
| 53 } | 56 } |
| 54 | 57 |
| 55 GURL wallet::GetSecureUrl() { | 58 GURL GetPassiveAuthUrl() { |
| 59 return GetBaseWalletUrl().Resolve("passiveauth"); | |
| 60 } | |
| 61 | |
| 62 GURL GetSecureUrl() { | |
| 56 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 63 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 57 std::string wallet_secure_url = | 64 std::string wallet_secure_url = |
| 58 command_line.GetSwitchValueASCII(switches::kWalletSecureServiceUrl); | 65 command_line.GetSwitchValueASCII(switches::kWalletSecureServiceUrl); |
| 59 return !wallet_secure_url.empty() ? GURL(wallet_secure_url) : | 66 return !wallet_secure_url.empty() ? GURL(wallet_secure_url) : |
| 60 GURL(kDefaultWalletSecureServiceUrl); | 67 GURL(kDefaultWalletSecureServiceUrl); |
| 61 } | 68 } |
| 62 | 69 |
| 70 } // namespace wallet | |
| OLD | NEW |