OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/autofill/wallet/wallet_service_url.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "base/command_line.h" |
| 10 #include "chrome/common/chrome_switches.h" |
| 11 #include "googleurl/src/gurl.h" |
| 12 |
| 13 namespace { |
| 14 |
| 15 const char kDefaultWalletServiceUrl[] = |
| 16 "https://wallet.google.com/online/v2/wallet/autocheckout/"; |
| 17 |
| 18 const char kDefaultWalletSecureServiceUrl[] = |
| 19 "https://wallet.google.com/online-secure/temporarydata/cvv?s7e=cvv"; |
| 20 |
| 21 GURL GetBaseWalletUrl() { |
| 22 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 23 std::string base_wallet_service_url = |
| 24 command_line.GetSwitchValueASCII(switches::kWalletServiceUrl); |
| 25 return !base_wallet_service_url.empty() ? GURL(base_wallet_service_url) : |
| 26 GURL(kDefaultWalletServiceUrl); |
| 27 } |
| 28 |
| 29 } // anonymous namespace |
| 30 |
| 31 // TODO(ahutter): This shouldn't live in this class. See |
| 32 // http://crbug.com/164281. |
| 33 const char wallet::kApiKey[] = "abcdefg"; |
| 34 |
| 35 GURL wallet::GetGetWalletItemsUrl() { |
| 36 return GetBaseWalletUrl().Resolve("getWalletItemsJwtless"); |
| 37 } |
| 38 |
| 39 GURL wallet::GetGetFullWalletUrl() { |
| 40 return GetBaseWalletUrl().Resolve("getFullWalletJwtless"); |
| 41 } |
| 42 |
| 43 GURL wallet::GetAcceptLegalDocumentsUrl() { |
| 44 return GetBaseWalletUrl().Resolve("acceptLegalDocuments"); |
| 45 } |
| 46 |
| 47 GURL wallet::GetSendStatusUrl() { |
| 48 return GetBaseWalletUrl().Resolve("reportStatus"); |
| 49 } |
| 50 |
| 51 GURL wallet::GetSaveToWalletUrl() { |
| 52 return GetBaseWalletUrl().Resolve("saveToWallet"); |
| 53 } |
| 54 |
| 55 GURL wallet::GetSecureUrl() { |
| 56 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 57 std::string wallet_secure_url = |
| 58 command_line.GetSwitchValueASCII(switches::kWalletSecureServiceUrl); |
| 59 return !wallet_secure_url.empty() ? GURL(wallet_secure_url) : |
| 60 GURL(kDefaultWalletSecureServiceUrl); |
| 61 } |
| 62 |
OLD | NEW |