Chromium Code Reviews| Index: chrome/browser/autofill/wallet/wallet_service_url.cc |
| diff --git a/chrome/browser/autofill/wallet/wallet_service_url.cc b/chrome/browser/autofill/wallet/wallet_service_url.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..18f0666dcfdb8189f229f340455f6ec7494d89ee |
| --- /dev/null |
| +++ b/chrome/browser/autofill/wallet/wallet_service_url.cc |
| @@ -0,0 +1,68 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/autofill/wallet/wallet_service_url.h" |
| + |
| +#include <string> |
| + |
| +#include "base/command_line.h" |
| +#include "chrome/common/chrome_switches.h" |
| +#include "googleurl/src/gurl.h" |
| + |
| +namespace { |
| + |
| +const char kDefaultWalletServiceUrl[] = |
| + "https://wallet.google.com/online/v2/wallet/autocheckout/"; |
| + |
| +const char kDefaultWalletSecureServiceUrl[] = |
| + "https://wallet.google.com/online-secure/temporarydata/cvv?s7e=cvv"; |
| + |
| +std::string GetBaseWalletUrl() { |
|
Dan Beam
2012/12/01 01:19:49
nit: return a GURL
ahutter
2012/12/01 04:06:51
Done.
|
| + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| + std::string baseWalletServiceUrl = command_line.GetSwitchValueASCII( |
| + switches::kWalletServiceUrl); |
| + if (baseWalletServiceUrl.empty()) |
|
Dan Beam
2012/12/01 01:19:49
nit: ternary, IMO, i.e.
return !baseWalletServi
ahutter
2012/12/01 04:06:51
Done.
|
| + return kDefaultWalletServiceUrl; |
| + |
| + return baseWalletServiceUrl; |
| +} |
| + |
| +} // anonymous namespace |
| + |
| +// TODO(ahutter): Should this live here? |
|
Dan Beam
2012/12/01 01:19:49
no, this will probably need to go into a different
ahutter
2012/12/01 04:06:51
Who should I ask about that?
|
| +const char wallet::kApiKey[] = "abcdefg"; |
| + |
| +GURL wallet::GetGetWalletItemsUrl() { |
| + std::string baseWalletServiceUrl = GetBaseWalletUrl(); |
| + return GURL(baseWalletServiceUrl + "getWalletItemsJwtless"); |
|
Dan Beam
2012/12/01 01:19:49
once GetBaseWalletUrl() returns a GURL
return G
ahutter
2012/12/01 04:06:51
Done.
|
| +} |
| + |
| +GURL wallet::GetGetFullWalletUrl() { |
| + std::string baseWalletServiceUrl = GetBaseWalletUrl(); |
| + return GURL(baseWalletServiceUrl + "getFullWalletJwtless"); |
| +} |
| +GURL wallet::GetAcceptLegalDocumentsUrl() { |
| + std::string baseWalletServiceUrl = GetBaseWalletUrl(); |
| + return GURL(baseWalletServiceUrl + "acceptLegalDocuments"); |
| +} |
| + |
| +GURL wallet::GetSendStatusUrl() { |
| + std::string baseWalletServiceUrl = GetBaseWalletUrl(); |
| + return GURL(baseWalletServiceUrl + "reportStatus"); |
| +} |
| + |
| +GURL wallet::GetSaveToWalletUrl() { |
| + std::string baseWalletServiceUrl = GetBaseWalletUrl(); |
| + return GURL(baseWalletServiceUrl + "saveToWallet" ); |
| +} |
| + |
| +GURL wallet::GetSecureUrl() { |
| + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| + std::string walletSecureUrl = command_line.GetSwitchValueASCII( |
| + switches::kWalletSecureServiceUrl); |
| + if (walletSecureUrl.empty()) |
|
Dan Beam
2012/12/01 01:19:49
same nit re: ternary or order
ahutter
2012/12/01 04:06:51
Done.
|
| + return GURL(kDefaultWalletSecureServiceUrl); |
| + |
| + return GURL(walletSecureUrl); |
| +} |