Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(707)

Unified Diff: components/ntp_tiles/field_trial.cc

Issue 2741413008: Introduce flag to disable static popular sites. (Closed)
Patch Set: Use param instead of new trial Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/ntp_tiles/field_trial.h ('k') | components/ntp_tiles/popular_sites_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « components/ntp_tiles/field_trial.h ('k') | components/ntp_tiles/popular_sites_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698