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> |
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 "components/autofill/core/common/autofill_switches.h" | |
23 #include "components/dom_distiller/core/dom_distiller_switches.h" | 22 #include "components/dom_distiller/core/dom_distiller_switches.h" |
24 #include "components/flags_ui/feature_entry.h" | 23 #include "components/flags_ui/feature_entry.h" |
25 #include "components/flags_ui/feature_entry_macros.h" | 24 #include "components/flags_ui/feature_entry_macros.h" |
26 #include "components/flags_ui/flags_storage.h" | 25 #include "components/flags_ui/flags_storage.h" |
27 #include "components/flags_ui/flags_ui_switches.h" | 26 #include "components/flags_ui/flags_ui_switches.h" |
28 #include "components/strings/grit/components_strings.h" | 27 #include "components/strings/grit/components_strings.h" |
29 #include "components/sync_driver/sync_driver_switches.h" | 28 #include "components/sync_driver/sync_driver_switches.h" |
30 #include "google_apis/gaia/gaia_switches.h" | 29 #include "google_apis/gaia/gaia_switches.h" |
31 #include "ios/chrome/browser/chrome_switches.h" | 30 #include "ios/chrome/browser/chrome_switches.h" |
32 #include "ios/chrome/grit/ios_strings.h" | 31 #include "ios/chrome/grit/ios_strings.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 command_line->AppendSwitchASCII(switches::kIOSTestingFixedHttpPort, "80"); | 136 command_line->AppendSwitchASCII(switches::kIOSTestingFixedHttpPort, "80"); |
138 command_line->AppendSwitchASCII(switches::kIOSTestingFixedHttpsPort, "443"); | 137 command_line->AppendSwitchASCII(switches::kIOSTestingFixedHttpsPort, "443"); |
139 command_line->AppendSwitchASCII( | 138 command_line->AppendSwitchASCII( |
140 switches::kIOSHostResolverRules, | 139 switches::kIOSHostResolverRules, |
141 "MAP * " + base::SysNSStringToUTF8(webPageReplayProxy)); | 140 "MAP * " + base::SysNSStringToUTF8(webPageReplayProxy)); |
142 } | 141 } |
143 | 142 |
144 if ([defaults boolForKey:@"EnableCredentialManagement"]) | 143 if ([defaults boolForKey:@"EnableCredentialManagement"]) |
145 command_line->AppendSwitch(switches::kEnableCredentialManagerAPI); | 144 command_line->AppendSwitch(switches::kEnableCredentialManagerAPI); |
146 | 145 |
147 // Populate command line flags from FullFormAutofill. | |
148 NSString* fullFormAutofillValue = [defaults stringForKey:@"FullFormAutofill"]; | |
149 if ([fullFormAutofillValue isEqualToString:@"Enabled"]) { | |
150 command_line->AppendSwitch(autofill::switches::kEnableFullFormAutofillIOS); | |
151 } else if ([fullFormAutofillValue isEqualToString:@"Disabled"]) { | |
152 command_line->AppendSwitch(autofill::switches::kDisableFullFormAutofillIOS); | |
153 } | |
154 | |
155 NSString* autoReloadEnabledValue = | 146 NSString* autoReloadEnabledValue = |
156 [defaults stringForKey:@"AutoReloadEnabled"]; | 147 [defaults stringForKey:@"AutoReloadEnabled"]; |
157 if ([autoReloadEnabledValue isEqualToString:@"Enabled"]) { | 148 if ([autoReloadEnabledValue isEqualToString:@"Enabled"]) { |
158 command_line->AppendSwitch(switches::kEnableOfflineAutoReload); | 149 command_line->AppendSwitch(switches::kEnableOfflineAutoReload); |
159 } else if ([autoReloadEnabledValue isEqualToString:@"Disabled"]) { | 150 } else if ([autoReloadEnabledValue isEqualToString:@"Disabled"]) { |
160 command_line->AppendSwitch(switches::kDisableOfflineAutoReload); | 151 command_line->AppendSwitch(switches::kDisableOfflineAutoReload); |
161 } | 152 } |
162 | 153 |
163 // Populate command line flags from EnableFastWebScrollViewInsets. | 154 // Populate command line flags from EnableFastWebScrollViewInsets. |
164 NSString* enableFastWebScrollViewInsets = | 155 NSString* enableFastWebScrollViewInsets = |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 284 } |
294 | 285 |
295 namespace testing { | 286 namespace testing { |
296 | 287 |
297 const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) { | 288 const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) { |
298 *count = arraysize(kFeatureEntries); | 289 *count = arraysize(kFeatureEntries); |
299 return kFeatureEntries; | 290 return kFeatureEntries; |
300 } | 291 } |
301 | 292 |
302 } // namespace testing | 293 } // namespace testing |
OLD | NEW |