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[] = "https://wallet.google.com/online/v2/"; | 15 const char kDefaultWalletServiceUrl[] = "https://wallet.google.com/"; |
| 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/"; |
|
Ilya Sherman
2013/01/09 23:30:48
This constant is now identical to the one above it
ahutter
2013/01/10 00:24:46
In development they can be different.
Ilya Sherman
2013/01/10 00:35:40
That sounds like reason to keep both the switches,
| |
| 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_host = |
|
Ilya Sherman
2013/01/09 23:30:48
nit: What is a "base host"? Probably just name th
ahutter
2013/01/10 00:24:46
Done.
| |
| 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_host.empty() ? GURL(base_wallet_service_host) : |
| 25 GURL(kDefaultWalletServiceUrl); | 25 GURL(kDefaultWalletServiceUrl); |
| 26 } | |
| 27 | |
| 28 GURL GetPrefixedWalletUrl() { | |
|
Ilya Sherman
2013/01/09 23:30:48
Optional nit: Perhaps name this function "GetBaseW
ahutter
2013/01/10 00:24:46
Done.
| |
| 29 return GetBaseWalletUrl().Resolve("online/v2/"); | |
| 26 } | 30 } |
| 27 | 31 |
| 28 GURL GetBaseAutocheckoutUrl() { | 32 GURL GetBaseAutocheckoutUrl() { |
| 29 return GetBaseWalletUrl().Resolve("wallet/autocheckout/"); | 33 return GetPrefixedWalletUrl().Resolve("wallet/autocheckout/"); |
| 34 } | |
| 35 | |
| 36 GURL GetBaseSecureUrl() { | |
| 37 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 38 std::string wallet_secure_url = | |
| 39 command_line.GetSwitchValueASCII(switches::kWalletSecureServiceUrl); | |
| 40 return !wallet_secure_url.empty() ? GURL(wallet_secure_url) : | |
| 41 GURL(kDefaultWalletSecureServiceUrl); | |
| 30 } | 42 } |
| 31 | 43 |
| 32 } // anonymous namespace | 44 } // anonymous namespace |
| 33 | 45 |
| 34 namespace wallet { | 46 namespace wallet { |
| 35 | 47 |
| 36 // TODO(ahutter): This shouldn't live in this class. See | 48 // TODO(ahutter): This shouldn't live in this class. See |
| 37 // http://crbug.com/164281. | 49 // http://crbug.com/164281. |
| 38 const char kApiKey[] = "abcdefg"; | 50 const char kApiKey[] = "abcdefg"; |
| 39 | 51 |
| 40 GURL GetGetWalletItemsUrl() { | 52 GURL GetGetWalletItemsUrl() { |
| 41 return GetBaseWalletUrl().Resolve( | 53 return GetBaseAutocheckoutUrl().Resolve("getWalletItemsJwtless"); |
|
Raman Kakilate
2013/01/09 22:54:21
Can you DCHECK if the resolved GURL is valid. Here
Ilya Sherman
2013/01/09 23:30:48
What would cause it to be invalid?
Albert Bodenhamer
2013/01/09 23:58:43
You could get a bad URL if you passed in a bad com
ahutter
2013/01/10 00:24:46
I don't think this is something we need to worry a
| |
| 42 "wallet/autocheckout/getWalletItemsJwtless"); | |
| 43 } | 54 } |
| 44 | 55 |
| 45 GURL GetGetFullWalletUrl() { | 56 GURL GetGetFullWalletUrl() { |
| 46 return GetBaseAutocheckoutUrl().Resolve("getFullWalletJwtless"); | 57 return GetBaseAutocheckoutUrl().Resolve("getFullWalletJwtless"); |
| 47 } | 58 } |
| 48 | 59 |
| 49 GURL GetAcceptLegalDocumentsUrl() { | 60 GURL GetAcceptLegalDocumentsUrl() { |
| 50 return GetBaseAutocheckoutUrl().Resolve("acceptLegalDocuments"); | 61 return GetBaseAutocheckoutUrl().Resolve("acceptLegalDocuments"); |
| 51 } | 62 } |
| 52 | 63 |
| 53 GURL GetSendStatusUrl() { | 64 GURL GetSendStatusUrl() { |
| 54 return GetBaseAutocheckoutUrl().Resolve("reportStatus"); | 65 return GetBaseAutocheckoutUrl().Resolve("reportStatus"); |
| 55 } | 66 } |
| 56 | 67 |
| 57 GURL GetSaveToWalletUrl() { | 68 GURL GetSaveToWalletUrl() { |
| 58 return GetBaseAutocheckoutUrl().Resolve("saveToWallet"); | 69 return GetBaseAutocheckoutUrl().Resolve("saveToWallet"); |
| 59 } | 70 } |
| 60 | 71 |
| 61 GURL GetPassiveAuthUrl() { | 72 GURL GetPassiveAuthUrl() { |
| 62 return GetBaseWalletUrl().Resolve("passiveauth"); | 73 return GetPrefixedWalletUrl().Resolve("passiveauth"); |
| 63 } | 74 } |
| 64 | 75 |
| 65 GURL GetSecureUrl() { | 76 GURL GetEncryptionUrl() { |
| 66 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 77 return GetBaseWalletUrl().Resolve("online-secure/temporarydata/cvv?s7e=cvv"); |
|
Ilya Sherman
2013/01/09 23:30:48
I'm confused. Should this not be GetBaseSecureUrl
ahutter
2013/01/10 00:24:46
OTP encryption actually does go through Sugar serv
| |
| 67 std::string wallet_secure_url = | 78 } |
| 68 command_line.GetSwitchValueASCII(switches::kWalletSecureServiceUrl); | 79 |
| 69 return !wallet_secure_url.empty() ? GURL(wallet_secure_url) : | 80 GURL GetEscrowUrl() { |
| 70 GURL(kDefaultWalletSecureServiceUrl); | 81 return GetBaseSecureUrl().Resolve("dehEfe?s7e=cardNumber%3Bcvv"); |
| 71 } | 82 } |
| 72 | 83 |
| 73 } // namespace wallet | 84 } // namespace wallet |
| OLD | NEW |