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

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

Issue 2967273002: [Payments] Add an entry for Payment Request to chrome://flags on iOS (Closed)
Patch Set: deps fix 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
« no previous file with comments | « ios/chrome/browser/BUILD.gn ('k') | ios/chrome/browser/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 // Implementation of about_flags for iOS that sets flags based on experimental 5 // Implementation of about_flags for iOS that sets flags based on experimental
6 // settings. 6 // settings.
7 7
8 #include "ios/chrome/browser/about_flags.h" 8 #include "ios/chrome/browser/about_flags.h"
9 9
10 #include <stddef.h> 10 #include <stddef.h>
11 #include <stdint.h> 11 #include <stdint.h>
12 #import <UIKit/UIKit.h> 12 #import <UIKit/UIKit.h>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/singleton.h" 18 #include "base/memory/singleton.h"
19 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
20 #include "base/strings/sys_string_conversions.h" 20 #include "base/strings/sys_string_conversions.h"
21 #include "base/sys_info.h" 21 #include "base/sys_info.h"
22 #include "base/task_scheduler/switches.h" 22 #include "base/task_scheduler/switches.h"
23 #include "components/dom_distiller/core/dom_distiller_switches.h" 23 #include "components/dom_distiller/core/dom_distiller_switches.h"
24 #include "components/flags_ui/feature_entry.h" 24 #include "components/flags_ui/feature_entry.h"
25 #include "components/flags_ui/feature_entry_macros.h" 25 #include "components/flags_ui/feature_entry_macros.h"
26 #include "components/flags_ui/flags_storage.h" 26 #include "components/flags_ui/flags_storage.h"
27 #include "components/flags_ui/flags_ui_switches.h" 27 #include "components/flags_ui/flags_ui_switches.h"
28 #include "components/ntp_tiles/switches.h" 28 #include "components/ntp_tiles/switches.h"
29 #include "components/payments/core/features.h"
29 #include "components/security_state/core/switches.h" 30 #include "components/security_state/core/switches.h"
30 #include "components/signin/core/common/signin_switches.h" 31 #include "components/signin/core/common/signin_switches.h"
31 #include "components/strings/grit/components_strings.h" 32 #include "components/strings/grit/components_strings.h"
32 #include "ios/chrome/browser/chrome_switches.h" 33 #include "ios/chrome/browser/chrome_switches.h"
33 #include "ios/chrome/browser/ios_chrome_flag_descriptions.h" 34 #include "ios/chrome/browser/ios_chrome_flag_descriptions.h"
34 #include "ios/chrome/grit/ios_strings.h" 35 #include "ios/chrome/grit/ios_strings.h"
35 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" 36 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
36 #include "ios/web/public/user_agent.h" 37 #include "ios/web/public/user_agent.h"
37 #include "ios/web/public/web_view_creation_util.h" 38 #include "ios/web/public/web_view_creation_util.h"
38 39
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 flag_descriptions::kPhysicalWebDescription, flags_ui::kOsIos, 83 flag_descriptions::kPhysicalWebDescription, flags_ui::kOsIos,
83 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableIOSPhysicalWeb, 84 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableIOSPhysicalWeb,
84 switches::kDisableIOSPhysicalWeb)}, 85 switches::kDisableIOSPhysicalWeb)},
85 {"browser-task-scheduler", flag_descriptions::kBrowserTaskScheduler, 86 {"browser-task-scheduler", flag_descriptions::kBrowserTaskScheduler,
86 flag_descriptions::kBrowserTaskSchedulerDescription, flags_ui::kOsIos, 87 flag_descriptions::kBrowserTaskSchedulerDescription, flags_ui::kOsIos,
87 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableBrowserTaskScheduler, 88 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableBrowserTaskScheduler,
88 switches::kDisableBrowserTaskScheduler)}, 89 switches::kDisableBrowserTaskScheduler)},
89 {"mark-non-secure-as", flag_descriptions::kMarkHttpAsName, 90 {"mark-non-secure-as", flag_descriptions::kMarkHttpAsName,
90 flag_descriptions::kMarkHttpAsDescription, flags_ui::kOsIos, 91 flag_descriptions::kMarkHttpAsDescription, flags_ui::kOsIos,
91 MULTI_VALUE_TYPE(kMarkHttpAsChoices)}, 92 MULTI_VALUE_TYPE(kMarkHttpAsChoices)},
93 {"web-payments", flag_descriptions::kWebPaymentsName,
94 flag_descriptions::kWebPaymentsDescription, flags_ui::kOsIos,
95 FEATURE_VALUE_TYPE(payments::features::kWebPayments)},
92 }; 96 };
93 97
94 // Add all switches from experimental flags to |command_line|. 98 // Add all switches from experimental flags to |command_line|.
95 void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) { 99 void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) {
96 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; 100 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
97 101
98 // Populate command line flag for the tab strip auto scroll new tabs 102 // Populate command line flag for the tab strip auto scroll new tabs
99 // experiment from the configuration plist. 103 // experiment from the configuration plist.
100 if ([defaults boolForKey:@"TabStripAutoScrollNewTabsDisabled"]) 104 if ([defaults boolForKey:@"TabStripAutoScrollNewTabsDisabled"])
101 command_line->AppendSwitch(switches::kDisableTabStripAutoScrollNewTabs); 105 command_line->AppendSwitch(switches::kDisableTabStripAutoScrollNewTabs);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 int32_t major = 0; 200 int32_t major = 0;
197 int32_t minor = 0; 201 int32_t minor = 0;
198 int32_t bugfix = 0; 202 int32_t bugfix = 0;
199 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); 203 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
200 std::string product = base::StringPrintf("Version/%d.%d", major, minor); 204 std::string product = base::StringPrintf("Version/%d.%d", major, minor);
201 205
202 command_line->AppendSwitchASCII(switches::kUserAgent, 206 command_line->AppendSwitchASCII(switches::kUserAgent,
203 web::BuildUserAgentFromProduct(product)); 207 web::BuildUserAgentFromProduct(product));
204 } 208 }
205 209
206 // Populate command line flag for the Payment Request API.
207 NSString* enable_payment_request =
208 [defaults stringForKey:@"EnablePaymentRequest"];
209 if ([enable_payment_request isEqualToString:@"Enabled"]) {
210 command_line->AppendSwitch(switches::kEnablePaymentRequest);
211 } else if ([enable_payment_request isEqualToString:@"Disabled"]) {
212 command_line->AppendSwitch(switches::kDisablePaymentRequest);
213 }
214
215 // Populate command line flag for Suggestions UI display. 210 // Populate command line flag for Suggestions UI display.
216 NSString* enableSuggestions = [defaults stringForKey:@"EnableSuggestions"]; 211 NSString* enableSuggestions = [defaults stringForKey:@"EnableSuggestions"];
217 if ([enableSuggestions isEqualToString:@"Enabled"]) { 212 if ([enableSuggestions isEqualToString:@"Enabled"]) {
218 command_line->AppendSwitch(switches::kEnableSuggestionsUI); 213 command_line->AppendSwitch(switches::kEnableSuggestionsUI);
219 } else if ([enableSuggestions isEqualToString:@"Disabled"]) { 214 } else if ([enableSuggestions isEqualToString:@"Disabled"]) {
220 command_line->AppendSwitch(switches::kDisableSuggestionsUI); 215 command_line->AppendSwitch(switches::kDisableSuggestionsUI);
221 } 216 }
222 217
223 // Populate command line flag for fetching missing favicons for NTP tiles. 218 // Populate command line flag for fetching missing favicons for NTP tiles.
224 NSString* enableMostLikelyFaviconsFromServer = 219 NSString* enableMostLikelyFaviconsFromServer =
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 } 355 }
361 356
362 namespace testing { 357 namespace testing {
363 358
364 const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) { 359 const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) {
365 *count = arraysize(kFeatureEntries); 360 *count = arraysize(kFeatureEntries);
366 return kFeatureEntries; 361 return kFeatureEntries;
367 } 362 }
368 363
369 } // namespace testing 364 } // namespace testing
OLDNEW
« no previous file with comments | « ios/chrome/browser/BUILD.gn ('k') | ios/chrome/browser/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698