| 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> |
| 11 #include <stdint.h> |
| 10 #import <UIKit/UIKit.h> | 12 #import <UIKit/UIKit.h> |
| 11 | 13 |
| 12 #include "base/bind.h" | 14 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 14 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/macros.h" |
| 15 #include "base/memory/singleton.h" | 18 #include "base/memory/singleton.h" |
| 16 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 17 #include "base/strings/sys_string_conversions.h" | 20 #include "base/strings/sys_string_conversions.h" |
| 18 #include "base/sys_info.h" | 21 #include "base/sys_info.h" |
| 19 #include "components/autofill/core/common/autofill_switches.h" | 22 #include "components/autofill/core/common/autofill_switches.h" |
| 20 #include "components/dom_distiller/core/dom_distiller_switches.h" | 23 #include "components/dom_distiller/core/dom_distiller_switches.h" |
| 21 #include "components/enhanced_bookmarks/enhanced_bookmark_switches.h" | 24 #include "components/enhanced_bookmarks/enhanced_bookmark_switches.h" |
| 22 #include "components/flags_ui/feature_entry.h" | 25 #include "components/flags_ui/feature_entry.h" |
| 23 #include "components/flags_ui/feature_entry_macros.h" | 26 #include "components/flags_ui/feature_entry_macros.h" |
| 24 #include "components/flags_ui/flags_storage.h" | 27 #include "components/flags_ui/flags_storage.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 if ([tabEviction isEqualToString:@"Enabled"]) { | 219 if ([tabEviction isEqualToString:@"Enabled"]) { |
| 217 command_line->AppendSwitch(switches::kEnableTabEviction); | 220 command_line->AppendSwitch(switches::kEnableTabEviction); |
| 218 } else if ([tabEviction isEqualToString:@"Disabled"]) { | 221 } else if ([tabEviction isEqualToString:@"Disabled"]) { |
| 219 command_line->AppendSwitch(switches::kDisableTabEviction); | 222 command_line->AppendSwitch(switches::kDisableTabEviction); |
| 220 } | 223 } |
| 221 | 224 |
| 222 // Set the UA flag if UseMobileSafariUA is enabled. | 225 // Set the UA flag if UseMobileSafariUA is enabled. |
| 223 if ([defaults boolForKey:@"UseMobileSafariUA"]) { | 226 if ([defaults boolForKey:@"UseMobileSafariUA"]) { |
| 224 // Safari uses "Vesion/", followed by the OS version excluding bugfix, where | 227 // Safari uses "Vesion/", followed by the OS version excluding bugfix, where |
| 225 // Chrome puts its product token. | 228 // Chrome puts its product token. |
| 226 int32 major = 0; | 229 int32_t major = 0; |
| 227 int32 minor = 0; | 230 int32_t minor = 0; |
| 228 int32 bugfix = 0; | 231 int32_t bugfix = 0; |
| 229 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); | 232 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); |
| 230 std::string product = base::StringPrintf("Version/%d.%d", major, minor); | 233 std::string product = base::StringPrintf("Version/%d.%d", major, minor); |
| 231 | 234 |
| 232 command_line->AppendSwitchASCII(switches::kUserAgent, | 235 command_line->AppendSwitchASCII(switches::kUserAgent, |
| 233 web::BuildUserAgentFromProduct(product)); | 236 web::BuildUserAgentFromProduct(product)); |
| 234 } | 237 } |
| 235 | 238 |
| 236 // Freeform commandline flags. These are added last, so that any flags added | 239 // Freeform commandline flags. These are added last, so that any flags added |
| 237 // earlier in this function take precedence. | 240 // earlier in this function take precedence. |
| 238 if ([defaults boolForKey:@"EnableFreeformCommandLineFlags"]) { | 241 if ([defaults boolForKey:@"EnableFreeformCommandLineFlags"]) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 } | 314 } |
| 312 | 315 |
| 313 namespace testing { | 316 namespace testing { |
| 314 | 317 |
| 315 const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) { | 318 const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) { |
| 316 *count = arraysize(kFeatureEntries); | 319 *count = arraysize(kFeatureEntries); |
| 317 return kFeatureEntries; | 320 return kFeatureEntries; |
| 318 } | 321 } |
| 319 | 322 |
| 320 } // namespace testing | 323 } // namespace testing |
| OLD | NEW |