Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: components/autofill/core/browser/payments/payments_service_url.cc

Issue 1999923002: Move the Google Payments URL functions out of content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/payments/payments_service_url.cc
diff --git a/components/autofill/content/browser/wallet/wallet_service_url.cc b/components/autofill/core/browser/payments/payments_service_url.cc
similarity index 62%
rename from components/autofill/content/browser/wallet/wallet_service_url.cc
rename to components/autofill/core/browser/payments/payments_service_url.cc
index 78aad22c34b71e9bea9c1620e7f05d746344da6d..97cd4d2119f093e893528a75f61b1d4847c4af29 100644
--- a/components/autofill/content/browser/wallet/wallet_service_url.cc
+++ b/components/autofill/core/browser/payments/payments_service_url.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/autofill/content/browser/wallet/wallet_service_url.h"
+#include "components/autofill/core/browser/payments/payments_service_url.h"
#include <string>
@@ -14,8 +14,6 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/common/autofill_switches.h"
-#include "content/public/common/content_switches.h"
-#include "content/public/common/url_constants.h"
#include "google_apis/gaia/gaia_urls.h"
#include "net/base/url_util.h"
#include "url/gurl.h"
@@ -23,12 +21,16 @@
namespace autofill {
namespace {
-const char kProdWalletServiceUrl[] = "https://wallet.google.com/";
+const char kProdPaymentsServiceUrl[] = "https://wallet.google.com/";
-const char kSandboxWalletSecureServiceUrl[] =
+const char kSandboxPaymentsSecureServiceUrl[] =
"https://wallet-web.sandbox.google.com/";
-bool IsWalletProductionEnabled() {
+} // namespace
+
+namespace payments {
+
+bool IsPaymentsProductionEnabled() {
// If the command line flag exists, it takes precedence.
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
@@ -37,11 +39,6 @@ bool IsWalletProductionEnabled() {
if (!sandbox_enabled.empty())
return sandbox_enabled != "1";
- // Default to sandbox when --reduce-security-for-testing is passed to allow
- // rAc on http:// pages.
- if (command_line->HasSwitch(::switches::kReduceSecurityForTesting))
- return false;
-
#if defined(ENABLE_PROD_WALLET_SERVICE)
return true;
#else
@@ -50,21 +47,10 @@ bool IsWalletProductionEnabled() {
}
GURL GetBaseSecureUrl() {
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
- std::string wallet_secure_url =
- command_line.GetSwitchValueASCII(switches::kWalletSecureServiceUrl);
- if (!wallet_secure_url.empty())
- return GURL(wallet_secure_url);
- if (IsWalletProductionEnabled())
- return GURL(kProdWalletServiceUrl);
- return GURL(kSandboxWalletSecureServiceUrl);
+ return GURL(IsPaymentsProductionEnabled() ? kProdPaymentsServiceUrl
+ : kSandboxPaymentsSecureServiceUrl);
}
-} // namespace
-
-namespace wallet {
-
GURL GetManageInstrumentsUrl(size_t user_index) {
std::string path =
base::StringPrintf("manage/w/%" PRIuS "/paymentMethods", user_index);
@@ -77,5 +63,5 @@ GURL GetManageAddressesUrl(size_t user_index) {
return GetBaseSecureUrl().Resolve(path);
}
-} // namespace wallet
+} // namespace payments
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698