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

Side by Side Diff: ios/chrome/browser/experimental_flags.mm

Issue 2967273002: [Payments] Add an entry for Payment Request to chrome://flags on iOS (Closed)
Patch Set: forgot some files Created 3 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // This file can be empty. Its purpose is to contain the relatively short lived 5 // This file can be empty. Its purpose is to contain the relatively short lived
6 // definitions required for experimental flags. 6 // definitions required for experimental flags.
7 7
8 #include "ios/chrome/browser/experimental_flags.h" 8 #include "ios/chrome/browser/experimental_flags.h"
9 9
10 #include <dispatch/dispatch.h> 10 #include <dispatch/dispatch.h>
11 #import <Foundation/Foundation.h> 11 #import <Foundation/Foundation.h>
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/feature_list.h" 16 #include "base/feature_list.h"
17 #include "base/metrics/field_trial.h" 17 #include "base/metrics/field_trial.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/strings/sys_string_conversions.h" 19 #include "base/strings/sys_string_conversions.h"
20 #include "components/autofill/core/common/autofill_switches.h" 20 #include "components/autofill/core/common/autofill_switches.h"
21 #include "components/password_manager/core/common/password_manager_features.h" 21 #include "components/password_manager/core/common/password_manager_features.h"
22 #include "components/payments/core/features.h"
22 #include "components/signin/core/common/signin_switches.h" 23 #include "components/signin/core/common/signin_switches.h"
23 #include "components/variations/variations_associated_data.h" 24 #include "components/variations/variations_associated_data.h"
24 #include "ios/chrome/browser/chrome_switches.h" 25 #include "ios/chrome/browser/chrome_switches.h"
25 #include "ios/web/public/web_view_creation_util.h" 26 #include "ios/web/public/web_view_creation_util.h"
26 27
27 #if !defined(__has_feature) || !__has_feature(objc_arc) 28 #if !defined(__has_feature) || !__has_feature(objc_arc)
28 #error "This file requires ARC support." 29 #error "This file requires ARC support."
29 #endif 30 #endif
30 31
31 namespace { 32 namespace {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 std::string group_name = 166 std::string group_name =
166 base::FieldTrialList::FindFullName("PasswordGeneration"); 167 base::FieldTrialList::FindFullName("PasswordGeneration");
167 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 168 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
168 if (command_line->HasSwitch(switches::kEnableIOSPasswordGeneration)) 169 if (command_line->HasSwitch(switches::kEnableIOSPasswordGeneration))
169 return true; 170 return true;
170 if (command_line->HasSwitch(switches::kDisableIOSPasswordGeneration)) 171 if (command_line->HasSwitch(switches::kDisableIOSPasswordGeneration))
171 return false; 172 return false;
172 return group_name != "Disabled"; 173 return group_name != "Disabled";
173 } 174 }
174 175
175 bool IsPaymentRequestEnabled() { 176 bool IsPaymentRequestEnabled() {
noyau (Ping after 24h) 2017/07/06 15:33:28 Can you get rid of this function and use IsEnabled
Mathieu 2017/07/06 15:34:30 Done!
176 // This call activates the field trial, if needed, so it must come before any 177 return base::FeatureList::IsEnabled(payments::features::kWebPayments);
177 // early returns.
178 std::string group_name =
179 base::FieldTrialList::FindFullName("IOSPaymentRequest");
180
181 // Check if the experimental flag is forced on or off.
182 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
183 if (command_line->HasSwitch(switches::kEnablePaymentRequest)) {
184 return true;
185 } else if (command_line->HasSwitch(switches::kDisablePaymentRequest)) {
186 return false;
187 }
188
189 // Check if the Finch experiment is turned on.
190 return base::StartsWith(group_name, "Enabled",
191 base::CompareCase::INSENSITIVE_ASCII);
192 } 178 }
193 179
194 bool IsPhysicalWebEnabled() { 180 bool IsPhysicalWebEnabled() {
195 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 181 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
196 if (command_line->HasSwitch(switches::kEnableIOSPhysicalWeb)) { 182 if (command_line->HasSwitch(switches::kEnableIOSPhysicalWeb)) {
197 return true; 183 return true;
198 } else if (command_line->HasSwitch(switches::kDisableIOSPhysicalWeb)) { 184 } else if (command_line->HasSwitch(switches::kDisableIOSPhysicalWeb)) {
199 return false; 185 return false;
200 } 186 }
201 187
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } else if (command_line->HasSwitch( 303 } else if (command_line->HasSwitch(
318 switches::kDisableThirdPartyKeyboardWorkaround)) { 304 switches::kDisableThirdPartyKeyboardWorkaround)) {
319 return false; 305 return false;
320 } 306 }
321 307
322 // Check if the Finch experiment is turned on. 308 // Check if the Finch experiment is turned on.
323 return base::FeatureList::IsEnabled(kEnableThirdPartyKeyboardWorkaround); 309 return base::FeatureList::IsEnabled(kEnableThirdPartyKeyboardWorkaround);
324 } 310 }
325 311
326 } // namespace experimental_flags 312 } // namespace experimental_flags
OLDNEW
« no previous file with comments | « ios/chrome/browser/chrome_switches.cc ('k') | ios/chrome/browser/ios_chrome_flag_descriptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698