Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This file can be empty. Its purpose is to contain the relatively short lived | 5 // This file can be empty. Its purpose is to contain the relatively short lived |
| 6 // definitions required for experimental flags. | 6 // definitions required for experimental flags. |
| 7 | 7 |
| 8 #include "ios/chrome/browser/experimental_flags.h" | 8 #include "ios/chrome/browser/experimental_flags.h" |
| 9 | 9 |
| 10 #include <dispatch/dispatch.h> | 10 #include <dispatch/dispatch.h> |
| 11 #import <Foundation/Foundation.h> | 11 #import <Foundation/Foundation.h> |
| 12 | 12 |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/strings/sys_string_conversions.h" | 18 #include "base/strings/sys_string_conversions.h" |
| 19 #include "components/autofill/core/common/autofill_switches.h" | 19 #include "components/autofill/core/common/autofill_switches.h" |
| 20 #include "components/reading_list/core/reading_list_switches.h" | 20 #include "components/reading_list/core/reading_list_switches.h" |
| 21 #include "components/signin/core/common/signin_switches.h" | |
| 21 #include "components/variations/variations_associated_data.h" | 22 #include "components/variations/variations_associated_data.h" |
| 22 #include "ios/chrome/browser/chrome_switches.h" | 23 #include "ios/chrome/browser/chrome_switches.h" |
| 23 #include "ios/web/public/web_view_creation_util.h" | 24 #include "ios/web/public/web_view_creation_util.h" |
| 24 | 25 |
| 25 #if !defined(__has_feature) || !__has_feature(objc_arc) | 26 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 26 #error "This file requires ARC support." | 27 #error "This file requires ARC support." |
| 27 #endif | 28 #endif |
| 28 | 29 |
| 29 namespace { | 30 namespace { |
| 30 | 31 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 if (command_line->HasSwitch(switches::kEnableSuggestionsUI)) | 269 if (command_line->HasSwitch(switches::kEnableSuggestionsUI)) |
| 269 return true; | 270 return true; |
| 270 | 271 |
| 271 if (command_line->HasSwitch(switches::kDisableSuggestionsUI)) | 272 if (command_line->HasSwitch(switches::kDisableSuggestionsUI)) |
| 272 return false; | 273 return false; |
| 273 | 274 |
| 274 // By default, disable it. | 275 // By default, disable it. |
| 275 return false; | 276 return false; |
| 276 } | 277 } |
| 277 | 278 |
| 279 bool IsSigninPromoEnabled() { | |
| 280 // Check if the experimental flag is forced on or off. | |
| 281 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 282 if (command_line->HasSwitch(switches::kEnableSigninPromo)) | |
| 283 return true; | |
| 284 | |
| 285 if (command_line->HasSwitch(switches::kDisableSigninPromo)) | |
| 286 return false; | |
| 287 | |
| 288 // This call activates the field trial, if needed, so it must come before any | |
|
sdefresne
2017/03/29 10:37:07
This comment contradict the code. Code should eith
jlebel
2017/03/29 10:58:35
Done.
| |
| 289 // early returns. | |
| 290 std::string group_name = base::FieldTrialList::FindFullName("IOSSigninPromo"); | |
| 291 return base::StartsWith(group_name, "Enabled", | |
| 292 base::CompareCase::INSENSITIVE_ASCII); | |
| 293 } | |
| 294 | |
| 278 } // namespace experimental_flags | 295 } // namespace experimental_flags |
| OLD | NEW |