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 baseWalletServiceUrl = command_line.GetSwitchValueASCII( |
| 24 switches::kWalletServiceUrl); |
| 25 return !baseWalletServiceUrl.empty() ? GURL(baseWalletServiceUrl) : |
| 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 GURL wallet::GetAcceptLegalDocumentsUrl() { |
| 43 return GetBaseWalletUrl().Resolve("acceptLegalDocuments"); |
| 44 } |
| 45 |
| 46 GURL wallet::GetSendStatusUrl() { |
| 47 return GetBaseWalletUrl().Resolve("reportStatus"); |
| 48 } |
| 49 |
| 50 GURL wallet::GetSaveToWalletUrl() { |
| 51 return GetBaseWalletUrl().Resolve("saveToWallet"); |
| 52 } |
| 53 |
| 54 GURL wallet::GetSecureUrl() { |
| 55 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 56 std::string walletSecureUrl = command_line.GetSwitchValueASCII( |
| 57 switches::kWalletSecureServiceUrl); |
| 58 return !walletSecureUrl.empty() ? GURL(walletSecureUrl) : |
| 59 GURL(kDefaultWalletSecureServiceUrl); |
| 60 } |
OLD | NEW |