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

Side by Side Diff: components/ntp_tiles/field_trial.cc

Issue 2671793003: Turn Popular sites on by default. (Closed)
Patch Set: Rebase and feedback. Created 3 years, 10 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 | « no previous file | no next file » | 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 "base/metrics/field_trial.h" 5 #include "base/metrics/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 10
(...skipping 25 matching lines...) Expand all
36 // On iOS it is not technically possible to prep the field trials on first 36 // On iOS it is not technically possible to prep the field trials on first
37 // launch, the configuration file is downloaded too late. In order to run some 37 // launch, the configuration file is downloaded too late. In order to run some
38 // experiments that need to be active on first launch to be meaningful these 38 // experiments that need to be active on first launch to be meaningful these
39 // are hardcoded, but can be superceeded by a server side config on subsequent 39 // are hardcoded, but can be superceeded by a server side config on subsequent
40 // launches. 40 // launches.
41 void SetUpFirstLaunchFieldTrial(bool is_stable_channel) { 41 void SetUpFirstLaunchFieldTrial(bool is_stable_channel) {
42 // Check first if a server side config superceeded this experiment. 42 // Check first if a server side config superceeded this experiment.
43 if (base::FieldTrialList::TrialExists(kPopularSitesFieldTrialName)) 43 if (base::FieldTrialList::TrialExists(kPopularSitesFieldTrialName))
44 return; 44 return;
45 45
46 // The experiment is only for stable channel, the other channels will simply
47 // get the default behavior.
48 if (!is_stable_channel)
49 return;
50
46 // Stable channels will run with 10% probability. 51 // Stable channels will run with 10% probability.
47 // Non-stable channels will run with 50% probability.
48 const base::FieldTrial::Probability kTotalProbability = 100; 52 const base::FieldTrial::Probability kTotalProbability = 100;
49 const base::FieldTrial::Probability kEnabledAndControlProbability = 53 const base::FieldTrial::Probability kEnabledAndControlProbability = 10;
50 is_stable_channel ? 10 : 50;
51 54
52 // Experiment enabled until March 15, 2017. By default, disabled. 55 // Experiment enabled until April 26, 2017.
53 scoped_refptr<base::FieldTrial> trial( 56 scoped_refptr<base::FieldTrial> trial(
54 base::FieldTrialList::FactoryGetFieldTrial( 57 base::FieldTrialList::FactoryGetFieldTrial(
55 kPopularSitesFieldTrialName, kTotalProbability, 58 kPopularSitesFieldTrialName, kTotalProbability,
56 kPopularSiteDefaultGroup, 2017, 3, 15, // Mar 15, 2017 59 kPopularSiteDefaultGroup, 2017, 4, 26, // Apr 26, 2017
57 base::FieldTrial::ONE_TIME_RANDOMIZED, nullptr)); 60 base::FieldTrial::ONE_TIME_RANDOMIZED, nullptr));
58 61
59 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 62 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
60 if (command_line->HasSwitch(ntp_tiles::switches::kEnableNTPPopularSites)) { 63 if (command_line->HasSwitch(ntp_tiles::switches::kEnableNTPPopularSites)) {
61 trial->AppendGroup(kPopularSiteEnabledCommandLineSwitchGroup, 64 trial->AppendGroup(kPopularSiteEnabledCommandLineSwitchGroup,
62 kTotalProbability); 65 kTotalProbability);
63 } else if (command_line->HasSwitch( 66 } else if (command_line->HasSwitch(
64 ntp_tiles::switches::kDisableNTPPopularSites)) { 67 ntp_tiles::switches::kDisableNTPPopularSites)) {
65 trial->AppendGroup(kPopularSiteDisabledCommandLineSwitchGroup, 68 trial->AppendGroup(kPopularSiteDisabledCommandLineSwitchGroup,
66 kTotalProbability); 69 kTotalProbability);
(...skipping 22 matching lines...) Expand all
89 if (cmd_line->HasSwitch(switches::kEnableNTPPopularSites)) 92 if (cmd_line->HasSwitch(switches::kEnableNTPPopularSites))
90 return true; 93 return true;
91 94
92 #if defined(OS_ANDROID) 95 #if defined(OS_ANDROID)
93 if (Java_MostVisitedSites_isPopularSitesForceEnabled( 96 if (Java_MostVisitedSites_isPopularSitesForceEnabled(
94 base::android::AttachCurrentThread())) { 97 base::android::AttachCurrentThread())) {
95 return true; 98 return true;
96 } 99 }
97 #endif 100 #endif
98 101
102 #if defined(OS_IOS)
103 // On iOS, if not enrolled in the experiment, the default is to enable the
104 // feature.
105 if (group_name.empty() || (group_name == kPopularSiteDefaultGroup))
106 return true;
107 #endif
108
99 return base::StartsWith(group_name, "Enabled", 109 return base::StartsWith(group_name, "Enabled",
100 base::CompareCase::INSENSITIVE_ASCII); 110 base::CompareCase::INSENSITIVE_ASCII);
101 } 111 }
102 112
103 } // namespace ntp_tiles 113 } // namespace ntp_tiles
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698