OLD | NEW |
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/content/browser/wallet/wallet_service_url.h" | 5 #include "components/autofill/content/browser/wallet/wallet_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/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
11 #include "components/autofill/core/common/autofill_switches.h" | 11 #include "components/autofill/core/common/autofill_switches.h" |
12 #include "google_apis/gaia/gaia_urls.h" | 12 #include "google_apis/gaia/gaia_urls.h" |
13 #include "net/base/url_util.h" | 13 #include "net/base/url_util.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace autofill { | 16 namespace autofill { |
17 namespace { | 17 namespace { |
18 | 18 |
19 const char kProdWalletServiceUrl[] = "https://wallet.google.com/"; | 19 const char kProdWalletServiceUrl[] = "https://wallet.google.com/"; |
20 | 20 |
21 // TODO(ahutter): Remove this once production is ready. | 21 // TODO(ahutter): Remove this once production is ready. |
22 const char kSandboxWalletServiceUrl[] = | 22 const char kSandboxWalletServiceUrl[] = |
23 "https://payments-form-dogfood.sandbox.google.com/"; | 23 "https://payments-form-dogfood.sandbox.google.com/"; |
24 | 24 |
25 // TODO(ahutter): Remove this once production is ready. | 25 // TODO(ahutter): Remove this once production is ready. |
26 const char kSandboxWalletSecureServiceUrl[] = | 26 const char kSandboxWalletSecureServiceUrl[] = |
27 "https://wallet-web.sandbox.google.com/"; | 27 "https://wallet-web.sandbox.google.com/"; |
28 | 28 |
29 bool IsWalletProductionEnabled() { | 29 bool IsWalletProductionEnabled() { |
30 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 30 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
31 return command_line.HasSwitch(switches::kWalletServiceUseProd) || | 31 std::string sandbox_enabled( |
32 base::FieldTrialList::FindFullName("WalletProductionService") == "Yes"; | 32 command_line->GetSwitchValueASCII(switches::kWalletServiceUseSandbox)); |
| 33 if (!sandbox_enabled.empty()) |
| 34 return sandbox_enabled != "1"; |
| 35 #if defined(OS_MACOSX) |
| 36 return false; |
| 37 #else |
| 38 return true; |
| 39 #endif |
33 } | 40 } |
34 | 41 |
35 GURL GetWalletHostUrl() { | 42 GURL GetWalletHostUrl() { |
36 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 43 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
37 std::string wallet_service_hostname = | 44 std::string wallet_service_hostname = |
38 command_line.GetSwitchValueASCII(switches::kWalletServiceUrl); | 45 command_line.GetSwitchValueASCII(switches::kWalletServiceUrl); |
39 if (!wallet_service_hostname.empty()) | 46 if (!wallet_service_hostname.empty()) |
40 return GURL(wallet_service_hostname); | 47 return GURL(wallet_service_hostname); |
41 if (IsWalletProductionEnabled()) | 48 if (IsWalletProductionEnabled()) |
42 return GURL(kProdWalletServiceUrl); | 49 return GURL(kProdWalletServiceUrl); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 url.host() == final_url.host() && | 147 url.host() == final_url.host() && |
141 url.path() == final_url.path(); | 148 url.path() == final_url.path(); |
142 } | 149 } |
143 | 150 |
144 bool IsUsingProd() { | 151 bool IsUsingProd() { |
145 return GetWalletHostUrl() == GURL(kProdWalletServiceUrl); | 152 return GetWalletHostUrl() == GURL(kProdWalletServiceUrl); |
146 } | 153 } |
147 | 154 |
148 } // namespace wallet | 155 } // namespace wallet |
149 } // namespace autofill | 156 } // namespace autofill |
OLD | NEW |