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 "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/reading_list/core/reading_list_switches.h" | 29 #include "components/reading_list/core/reading_list_switches.h" |
30 #include "components/signin/core/common/signin_switches.h" | |
30 #include "components/strings/grit/components_strings.h" | 31 #include "components/strings/grit/components_strings.h" |
31 #include "ios/chrome/browser/chrome_switches.h" | 32 #include "ios/chrome/browser/chrome_switches.h" |
32 #include "ios/chrome/grit/ios_strings.h" | 33 #include "ios/chrome/grit/ios_strings.h" |
33 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 34 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
34 #include "ios/web/public/user_agent.h" | 35 #include "ios/web/public/user_agent.h" |
35 #include "ios/web/public/web_view_creation_util.h" | 36 #include "ios/web/public/web_view_creation_util.h" |
36 | 37 |
37 #if !defined(OFFICIAL_BUILD) | 38 #if !defined(OFFICIAL_BUILD) |
38 #include "components/variations/variations_switches.h" | 39 #include "components/variations/variations_switches.h" |
39 #endif | 40 #endif |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 NSString* flag = [defaults stringForKey:key]; | 225 NSString* flag = [defaults stringForKey:key]; |
225 if ([flag length]) { | 226 if ([flag length]) { |
226 flags.push_back(base::SysNSStringToUTF8(flag)); | 227 flags.push_back(base::SysNSStringToUTF8(flag)); |
227 } | 228 } |
228 } | 229 } |
229 | 230 |
230 base::CommandLine temp_command_line(flags); | 231 base::CommandLine temp_command_line(flags); |
231 command_line->AppendArguments(temp_command_line, false); | 232 command_line->AppendArguments(temp_command_line, false); |
232 } | 233 } |
233 | 234 |
235 // Populate command line flag for Suggestions UI display. | |
msarda
2017/03/29 11:41:35
s/Suggestions UI/Sign-in promo
jlebel
2017/03/29 11:47:08
Done.
| |
236 NSString* enableSigninPromo = [defaults stringForKey:@"EnableSigninPromo"]; | |
237 if ([enableSigninPromo isEqualToString:@"Enabled"]) { | |
238 command_line->AppendSwitch(switches::kEnableSigninPromo); | |
239 } else if ([enableSigninPromo isEqualToString:@"Disabled"]) { | |
240 command_line->AppendSwitch(switches::kDisableSigninPromo); | |
241 } | |
242 | |
234 ios::GetChromeBrowserProvider()->AppendSwitchesFromExperimentalSettings( | 243 ios::GetChromeBrowserProvider()->AppendSwitchesFromExperimentalSettings( |
235 defaults, command_line); | 244 defaults, command_line); |
236 } | 245 } |
237 | 246 |
238 bool SkipConditionalFeatureEntry(const flags_ui::FeatureEntry& entry) { | 247 bool SkipConditionalFeatureEntry(const flags_ui::FeatureEntry& entry) { |
239 return false; | 248 return false; |
240 } | 249 } |
241 | 250 |
242 class FlagsStateSingleton { | 251 class FlagsStateSingleton { |
243 public: | 252 public: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 } | 305 } |
297 | 306 |
298 namespace testing { | 307 namespace testing { |
299 | 308 |
300 const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) { | 309 const flags_ui::FeatureEntry* GetFeatureEntries(size_t* count) { |
301 *count = arraysize(kFeatureEntries); | 310 *count = arraysize(kFeatureEntries); |
302 return kFeatureEntries; | 311 return kFeatureEntries; |
303 } | 312 } |
304 | 313 |
305 } // namespace testing | 314 } // namespace testing |
OLD | NEW |