Chromium Code Reviews| Index: components/ntp_tiles/field_trial.cc |
| diff --git a/components/ntp_tiles/field_trial.cc b/components/ntp_tiles/field_trial.cc |
| index 6bcbf98207f003465040b545481ce9d7d3506a40..75e2d405248407fbeb5248ffa1866f677e232aaf 100644 |
| --- a/components/ntp_tiles/field_trial.cc |
| +++ b/components/ntp_tiles/field_trial.cc |
| @@ -11,6 +11,7 @@ |
| #include "base/command_line.h" |
| #include "base/metrics/field_trial.h" |
| +#include "base/metrics/field_trial_params.h" |
| #include "base/strings/string_util.h" |
| #include "components/ntp_tiles/constants.h" |
| #include "components/ntp_tiles/switches.h" |
| @@ -53,4 +54,22 @@ bool ShouldShowPopularSites() { |
| base::CompareCase::INSENSITIVE_ASCII); |
| } |
| +bool ShouldUseBakedInSites() { |
| + base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| + if (cmd_line->HasSwitch(switches::kDisableNTPBakedInSites)) { |
| + return false; |
| + } |
| + |
| + if (cmd_line->HasSwitch(switches::kEnableNTPBakedInSites)) { |
| + return true; |
| + } |
| + |
| + const std::string& trial_value = base::GetFieldTrialParamValue( |
|
sfiera
2017/03/16 10:15:40
Three things:
* I think the "modern" thing to do i
fhorschig
2017/03/16 10:57:50
Looks like an alternative approach. I don't need a
|
| + kPopularSitesFieldTrialName, kEnableBakedInSitesParamName); |
| + // This feature is opt-out. Otherwise, users who need it would not get the |
| + // right configuration timely enough. The configuration affects only Android |
| + // or iOS users. |
| + return trial_value.empty() || trial_value == "true"; |
| +} |
| + |
| } // namespace ntp_tiles |