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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "components/ntp_tiles/field_trial.h" 5 #include "components/ntp_tiles/field_trial.h"
6 6
7 #if defined(OS_ANDROID) 7 #if defined(OS_ANDROID)
8 #include <jni.h> 8 #include <jni.h>
9 #endif 9 #endif
10 #include <string> 10 #include <string>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/metrics/field_trial_params.h"
14 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
15 #include "components/ntp_tiles/constants.h" 16 #include "components/ntp_tiles/constants.h"
16 #include "components/ntp_tiles/switches.h" 17 #include "components/ntp_tiles/switches.h"
17 18
18 #if defined(OS_ANDROID) 19 #if defined(OS_ANDROID)
19 #include "base/android/jni_android.h" 20 #include "base/android/jni_android.h"
20 #include "jni/MostVisitedSites_jni.h" 21 #include "jni/MostVisitedSites_jni.h"
21 #endif 22 #endif
22 23
23 namespace ntp_tiles { 24 namespace ntp_tiles {
(...skipping 22 matching lines...) Expand all
46 // On iOS, if not enrolled in the experiment, the default is to enable the 47 // On iOS, if not enrolled in the experiment, the default is to enable the
47 // feature. 48 // feature.
48 if (group_name.empty()) 49 if (group_name.empty())
49 return true; 50 return true;
50 #endif 51 #endif
51 52
52 return base::StartsWith(group_name, "Enabled", 53 return base::StartsWith(group_name, "Enabled",
53 base::CompareCase::INSENSITIVE_ASCII); 54 base::CompareCase::INSENSITIVE_ASCII);
54 } 55 }
55 56
57 bool ShouldUseBakedInSites() {
58 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
59 if (cmd_line->HasSwitch(switches::kDisableNTPBakedInSites)) {
60 return false;
61 }
62
63 if (cmd_line->HasSwitch(switches::kEnableNTPBakedInSites)) {
64 return true;
65 }
66
67 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
68 kPopularSitesFieldTrialName, kEnableBakedInSitesParamName);
69 // This feature is opt-out. Otherwise, users who need it would not get the
70 // right configuration timely enough. The configuration affects only Android
71 // or iOS users.
72 return trial_value.empty() || trial_value == "true";
73 }
74
56 } // namespace ntp_tiles 75 } // namespace ntp_tiles
OLDNEW
« 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