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

Side by Side Diff: components/autofill/core/browser/payments/payments_service_url.cc

Issue 2675883005: [autofill] Update URL to edit synced Google Payments cards. (Closed)
Patch Set: rebase Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/core/browser/payments/payments_service_url.h" 5 #include "components/autofill/core/browser/payments/payments_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 "base/format_macros.h" 10 #include "base/format_macros.h"
11 #include "base/metrics/field_trial.h" 11 #include "base/metrics/field_trial.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "components/autofill/core/common/autofill_switches.h" 16 #include "components/autofill/core/common/autofill_switches.h"
17 #include "google_apis/gaia/gaia_urls.h" 17 #include "google_apis/gaia/gaia_urls.h"
18 #include "net/base/url_util.h" 18 #include "net/base/url_util.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 namespace autofill { 21 namespace autofill {
22 namespace { 22 namespace {
23 23
24 const char kProdPaymentsServiceUrl[] = "https://wallet.google.com/"; 24 const char kProdPaymentsServiceUrl[] = "https://payments.google.com/";
25 25
26 const char kSandboxPaymentsSecureServiceUrl[] = 26 const char kSandboxPaymentsSecureServiceUrl[] =
27 "https://wallet-web.sandbox.google.com/"; 27 "https://payments.sandbox.google.com/";
28 28
29 } // namespace 29 } // namespace
30 30
31 namespace payments { 31 namespace payments {
32 32
33 bool IsPaymentsProductionEnabled() { 33 bool IsPaymentsProductionEnabled() {
34 // If the command line flag exists, it takes precedence. 34 // If the command line flag exists, it takes precedence.
35 const base::CommandLine* command_line = 35 const base::CommandLine* command_line =
36 base::CommandLine::ForCurrentProcess(); 36 base::CommandLine::ForCurrentProcess();
37 std::string sandbox_enabled( 37 std::string sandbox_enabled(
38 command_line->GetSwitchValueASCII(switches::kWalletServiceUseSandbox)); 38 command_line->GetSwitchValueASCII(switches::kWalletServiceUseSandbox));
39 return sandbox_enabled.empty() || sandbox_enabled != "1"; 39 return sandbox_enabled.empty() || sandbox_enabled != "1";
40 } 40 }
41 41
42 GURL GetBaseSecureUrl() { 42 GURL GetBaseSecureUrl() {
43 return GURL(IsPaymentsProductionEnabled() ? kProdPaymentsServiceUrl 43 return GURL(IsPaymentsProductionEnabled() ? kProdPaymentsServiceUrl
44 : kSandboxPaymentsSecureServiceUrl); 44 : kSandboxPaymentsSecureServiceUrl);
45 } 45 }
46 46
47 GURL GetManageInstrumentsUrl(size_t user_index) { 47 GURL GetManageInstrumentsUrl(size_t user_index) {
48 std::string path = 48 std::string path =
49 base::StringPrintf("manage/w/%" PRIuS "/paymentMethods", user_index); 49 base::StringPrintf("u/%" PRIuS "#paymentMethods", user_index);
50 return GetBaseSecureUrl().Resolve(path); 50 return GetBaseSecureUrl().Resolve(path);
51 } 51 }
52 52
53 GURL GetManageAddressesUrl(size_t user_index) { 53 GURL GetManageAddressesUrl(size_t user_index) {
54 std::string path = 54 // Billing addresses are now managed as a part of the payment instrument.
55 base::StringPrintf("manage/w/%" PRIuS "/settings/addresses", user_index); 55 return GetManageInstrumentsUrl(user_index);
56 return GetBaseSecureUrl().Resolve(path);
57 } 56 }
58 57
59 } // namespace payments 58 } // namespace payments
60 } // namespace autofill 59 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698