OLD | NEW |
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> |
(...skipping 10 matching lines...) Expand all Loading... |
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/strings/grit/components_strings.h" | 29 #include "components/strings/grit/components_strings.h" |
30 #include "ios/chrome/browser/chrome_switches.h" | 30 #include "ios/chrome/browser/chrome_switches.h" |
| 31 #include "ios/chrome/browser/ios_chrome_flag_descriptions.h" |
31 #include "ios/chrome/grit/ios_strings.h" | 32 #include "ios/chrome/grit/ios_strings.h" |
32 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 33 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
33 #include "ios/web/public/user_agent.h" | 34 #include "ios/web/public/user_agent.h" |
34 #include "ios/web/public/web_view_creation_util.h" | 35 #include "ios/web/public/web_view_creation_util.h" |
35 | 36 |
36 #if !defined(OFFICIAL_BUILD) | 37 #if !defined(OFFICIAL_BUILD) |
37 #include "components/variations/variations_switches.h" | 38 #include "components/variations/variations_switches.h" |
38 #endif | 39 #endif |
39 | 40 |
40 #if !defined(__has_feature) || !__has_feature(objc_arc) | 41 #if !defined(__has_feature) || !__has_feature(objc_arc) |
41 #error "This file requires ARC support." | 42 #error "This file requires ARC support." |
42 #endif | 43 #endif |
43 | 44 |
44 namespace { | 45 namespace { |
45 // To add a new entry, add to the end of kFeatureEntries. There are two | 46 // To add a new entry, add to the end of kFeatureEntries. There are two |
46 // distinct types of entries: | 47 // distinct types of entries: |
47 // . SINGLE_VALUE: entry is either on or off. Use the SINGLE_VALUE_TYPE | 48 // . SINGLE_VALUE: entry is either on or off. Use the SINGLE_VALUE_TYPE |
48 // macro for this type supplying the command line to the macro. | 49 // macro for this type supplying the command line to the macro. |
49 // . MULTI_VALUE: a list of choices, the first of which should correspond to a | 50 // . MULTI_VALUE: a list of choices, the first of which should correspond to a |
50 // deactivated state for this lab (i.e. no command line option). To specify | 51 // deactivated state for this lab (i.e. no command line option). To specify |
51 // this type of entry use the macro MULTI_VALUE_TYPE supplying it the | 52 // this type of entry use the macro MULTI_VALUE_TYPE supplying it the |
52 // array of choices. | 53 // array of choices. |
53 // See the documentation of FeatureEntry for details on the fields. | 54 // See the documentation of FeatureEntry for details on the fields. |
54 // | 55 // |
55 // When adding a new choice, add it to the end of the list. | 56 // When adding a new choice, add it to the end of the list. |
56 const flags_ui::FeatureEntry kFeatureEntries[] = { | 57 const flags_ui::FeatureEntry kFeatureEntries[] = { |
57 {"contextual-search", IDS_IOS_FLAGS_CONTEXTUAL_SEARCH, | 58 {"contextual-search", flag_descriptions::kContextualSearch, |
58 IDS_IOS_FLAGS_CONTEXTUAL_SEARCH_DESCRIPTION, flags_ui::kOsIos, | 59 flag_descriptions::kContextualSearchDescription, flags_ui::kOsIos, |
59 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableContextualSearch, | 60 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableContextualSearch, |
60 switches::kDisableContextualSearch)}, | 61 switches::kDisableContextualSearch)}, |
61 {"ios-physical-web", IDS_IOS_FLAGS_PHYSICAL_WEB, | 62 {"ios-physical-web", flag_descriptions::kPhysicalWeb, |
62 IDS_IOS_FLAGS_PHYSICAL_WEB_DESCRIPTION, flags_ui::kOsIos, | 63 flag_descriptions::kPhysicalWebDescription, flags_ui::kOsIos, |
63 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableIOSPhysicalWeb, | 64 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableIOSPhysicalWeb, |
64 switches::kDisableIOSPhysicalWeb)}, | 65 switches::kDisableIOSPhysicalWeb)}, |
65 {"browser-task-scheduler", IDS_IOS_FLAGS_BROWSER_TASK_SCHEDULER_NAME, | 66 {"browser-task-scheduler", flag_descriptions::kBrowserTaskScheduler, |
66 IDS_IOS_FLAGS_BROWSER_TASK_SCHEDULER_DESCRIPTION, flags_ui::kOsIos, | 67 flag_descriptions::kBrowserTaskSchedulerDescription, flags_ui::kOsIos, |
67 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableBrowserTaskScheduler, | 68 ENABLE_DISABLE_VALUE_TYPE(switches::kEnableBrowserTaskScheduler, |
68 switches::kDisableBrowserTaskScheduler)}, | 69 switches::kDisableBrowserTaskScheduler)}, |
69 }; | 70 }; |
70 | 71 |
71 // Add all switches from experimental flags to |command_line|. | 72 // Add all switches from experimental flags to |command_line|. |
72 void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) { | 73 void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) { |
73 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | 74 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
74 | 75 |
75 // Populate command line flag for the tab strip auto scroll new tabs | 76 // Populate command line flag for the tab strip auto scroll new tabs |
76 // experiment from the configuration plist. | 77 // experiment from the configuration plist. |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 296 } |
296 | 297 |
297 namespace testing { | 298 namespace testing { |
298 | 299 |
299 const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) { | 300 const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) { |
300 *count = arraysize(kFeatureEntries); | 301 *count = arraysize(kFeatureEntries); |
301 return kFeatureEntries; | 302 return kFeatureEntries; |
302 } | 303 } |
303 | 304 |
304 } // namespace testing | 305 } // namespace testing |
OLD | NEW |