Commit 1c9e055f authored by Ramya Nagarajan's avatar Ramya Nagarajan Committed by Commit Bot

Remove hard coded HideShortcutsOnNtp field trial for new users.

Clean up the pref associated with this field trial, with deletion
slated after several milestones.
More details at http://doc/1rYBoi6Hm270SB1njw3BhM3Qo9puZn3iiINQy-gMaz4I

Bug: 988028
Change-Id: I5846351c4d66b0cf04b4f5c92b7de88db5d4e18d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1689496
Commit-Queue: Ramya Nagarajan <ramyan@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681374}
parent be98b1c3
...@@ -3304,10 +3304,6 @@ jumbo_split_static_library("browser") { ...@@ -3304,10 +3304,6 @@ jumbo_split_static_library("browser") {
"search/instant_service_factory.h", "search/instant_service_factory.h",
"search/instant_service_observer.cc", "search/instant_service_observer.cc",
"search/instant_service_observer.h", "search/instant_service_observer.h",
"search/local_ntp_first_run_field_trial_handler.cc",
"search/local_ntp_first_run_field_trial_handler.h",
"search/local_ntp_first_run_field_trials.cc",
"search/local_ntp_first_run_field_trials.h",
"search/local_ntp_source.cc", "search/local_ntp_source.cc",
"search/local_ntp_source.h", "search/local_ntp_source.h",
"search/most_visited_iframe_source.cc", "search/most_visited_iframe_source.cc",
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h" #include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "chrome/browser/metrics/chrome_metrics_service_client.h" #include "chrome/browser/metrics/chrome_metrics_service_client.h"
#include "chrome/browser/metrics/chrome_metrics_services_manager_client.h" #include "chrome/browser/metrics/chrome_metrics_services_manager_client.h"
#include "chrome/browser/search/local_ntp_first_run_field_trial_handler.h"
#include "chrome/common/channel_info.h" #include "chrome/common/channel_info.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
...@@ -91,11 +90,6 @@ void ChromeBrowserFieldTrials::SetupFeatureControllingFieldTrials( ...@@ -91,11 +90,6 @@ void ChromeBrowserFieldTrials::SetupFeatureControllingFieldTrials(
chromeos::multidevice_setup::CreateFirstRunFieldTrial(feature_list); chromeos::multidevice_setup::CreateFirstRunFieldTrial(feature_list);
#endif #endif
} }
#if !defined(OS_ANDROID)
// TODO(crbug.com/944624) Remove hide shortcuts field trial
ntp_first_run::ActivateHideShortcutsOnNtpFieldTrial(feature_list,
local_state_);
#endif // !defined(OS_ANDROID)
} }
void ChromeBrowserFieldTrials::RegisterSyntheticTrials() { void ChromeBrowserFieldTrials::RegisterSyntheticTrials() {
......
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
#include "chrome/browser/push_messaging/push_messaging_app_identifier.h" #include "chrome/browser/push_messaging/push_messaging_app_identifier.h"
#include "chrome/browser/renderer_host/pepper/device_id_fetcher.h" #include "chrome/browser/renderer_host/pepper/device_id_fetcher.h"
#include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h" #include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h"
#include "chrome/browser/search/local_ntp_first_run_field_trial_handler.h"
#include "chrome/browser/search/search.h" #include "chrome/browser/search/search.h"
#include "chrome/browser/sharing/sharing_sync_preference.h" #include "chrome/browser/sharing/sharing_sync_preference.h"
#include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
...@@ -463,6 +462,12 @@ const char kHasSeenWin10PromoPage[] = "browser.has_seen_win10_promo_page"; ...@@ -463,6 +462,12 @@ const char kHasSeenWin10PromoPage[] = "browser.has_seen_win10_promo_page";
// Deprecated 7/2019 // Deprecated 7/2019
const char kSignedInTime[] = "signin.signedin_time"; const char kSignedInTime[] = "signin.signedin_time";
#if !defined(OS_ANDROID)
// Deprecated 7/2019
const char kNtpActivateHideShortcutsFieldTrial[] =
"ntp.activate_hide_shortcuts_field_trial";
#endif // !defined(OS_ANDROID)
// Register prefs used only for migration (clearing or moving to a new key). // Register prefs used only for migration (clearing or moving to a new key).
void RegisterProfilePrefsForMigration( void RegisterProfilePrefsForMigration(
user_prefs::PrefRegistrySyncable* registry) { user_prefs::PrefRegistrySyncable* registry) {
...@@ -585,7 +590,6 @@ void RegisterLocalState(PrefRegistrySimple* registry) { ...@@ -585,7 +590,6 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
gcm::GCMChannelStatusSyncer::RegisterPrefs(registry); gcm::GCMChannelStatusSyncer::RegisterPrefs(registry);
gcm::RegisterPrefs(registry); gcm::RegisterPrefs(registry);
metrics::TabStatsTracker::RegisterPrefs(registry); metrics::TabStatsTracker::RegisterPrefs(registry);
ntp_first_run::RegisterLocalStatePrefs(registry);
RegisterBrowserPrefs(registry); RegisterBrowserPrefs(registry);
StartupBrowserCreator::RegisterLocalStatePrefs(registry); StartupBrowserCreator::RegisterLocalStatePrefs(registry);
task_manager::TaskManagerInterface::RegisterPrefs(registry); task_manager::TaskManagerInterface::RegisterPrefs(registry);
...@@ -677,6 +681,9 @@ void RegisterLocalState(PrefRegistrySimple* registry) { ...@@ -677,6 +681,9 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
// Obsolete. See MigrateObsoleteBrowserPrefs(). // Obsolete. See MigrateObsoleteBrowserPrefs().
registry->RegisterIntegerPref(metrics::prefs::kStabilityExecutionPhase, 0); registry->RegisterIntegerPref(metrics::prefs::kStabilityExecutionPhase, 0);
#if !defined(OS_ANDROID)
registry->RegisterBooleanPref(kNtpActivateHideShortcutsFieldTrial, false);
#endif // !defined(OS_ANDROID)
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
RegisterBrowserViewLocalPrefs(registry); RegisterBrowserViewLocalPrefs(registry);
...@@ -992,6 +999,11 @@ void MigrateObsoleteBrowserPrefs(Profile* profile, PrefService* local_state) { ...@@ -992,6 +999,11 @@ void MigrateObsoleteBrowserPrefs(Profile* profile, PrefService* local_state) {
// Added 6/2019. // Added 6/2019.
local_state->ClearPref(kHasSeenWin10PromoPage); local_state->ClearPref(kHasSeenWin10PromoPage);
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
#if !defined(OS_ANDROID)
// Added 7/2019.
local_state->ClearPref(kNtpActivateHideShortcutsFieldTrial);
#endif // !defined(OS_ANDROID)
} }
// This method should be periodically pruned of year+ old migrations. // This method should be periodically pruned of year+ old migrations.
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/search/local_ntp_first_run_field_trial_handler.h"
#include "base/feature_list.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "chrome/browser/search/local_ntp_first_run_field_trials.h"
#include "chrome/browser/search/ntp_features.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/version_info/version_info.h"
namespace {
// Probabilities for all field trial groups add up to kTotalProbability.
const base::FieldTrial::Probability kTotalProbability = 100;
const char kTrialName[] = "HideShortcutsOnNtp";
// Each field trial has 3 groups.
// HideShortcutsExperiment - see the NTP with shortcuts hidden.
// HideShortcutsControl - see shortcuts on the NTP; same size as the
// HideShortcutsExperiment group.
// Default - see shortcuts on the NTP; are not part of the experiment.
const char kExperimentGroup[] = "HideShortcutsExperiment";
const char kControlGroup[] = "HideShortcutsControl";
const char kDefaultGroup[] = "Default";
void LoadConfigByChannel(const version_info::Channel& channel,
variations::VariationID* experiment_id,
variations::VariationID* control_id,
base::FieldTrial::Probability* experiment_size) {
switch (channel) {
// Shortcuts are hidden for 100% of new users on the Canary / Dev Channels.
case version_info::Channel::CANARY:
case version_info::Channel::DEV:
case version_info::Channel::UNKNOWN:
*experiment_id = 3315271;
*control_id = 3315272;
*experiment_size = 50;
break;
// Shortcuts are hidden for 50% of new users on the Beta Channel.
case version_info::Channel::BETA:
*experiment_id = 3315273;
*control_id = 3315274;
*experiment_size = 50;
break;
// Shortcuts are hidden for 1% of new users on the Stable Channel.
case version_info::Channel::STABLE:
*experiment_id = 3315275;
*control_id = 3315276;
*experiment_size = 1;
break;
}
}
} // namespace
namespace ntp_first_run {
void RegisterLocalStatePrefs(PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(prefs::kNtpActivateHideShortcutsFieldTrial,
false);
}
void ActivateHideShortcutsOnNtpFieldTrial(base::FeatureList* feature_list,
PrefService* local_state) {
// The field trial is activated for fresh installs, or for clients that were
// previously activated (during a fresh install). For all other existing
// clients, the trial is not activated, and the experiment is unavailable.
if (!first_run::IsChromeFirstRun() &&
!local_state->GetBoolean(prefs::kNtpActivateHideShortcutsFieldTrial)) {
return;
}
// Field trials do not take effect until configurations have been downloaded.
// In order for field trials involving substantial UI changes to take effect
// at first run, the configuration must be pre-defined in client code.
variations::VariationID experiment_id;
variations::VariationID control_id;
base::FieldTrial::Probability experiment_size;
LoadConfigByChannel(chrome::GetChannel(), &experiment_id, &control_id,
&experiment_size);
LocalNtpFirstRunFieldTrialConfig config(kTrialName);
config.AddGroup(kExperimentGroup, experiment_id, experiment_size);
config.AddGroup(kControlGroup, control_id, experiment_size);
// The field trial can only be loaded once per browser session
scoped_refptr<base::FieldTrial> trial(
base::FieldTrialList::FactoryGetFieldTrial(
config.trial_name(), kTotalProbability, kDefaultGroup,
base::FieldTrial::ONE_TIME_RANDOMIZED,
/*default_group_number=*/nullptr));
for (const auto& group : config.groups()) {
variations::AssociateGoogleVariationID(variations::GOOGLE_WEB_PROPERTIES,
config.trial_name(), group.name(),
group.variation());
trial->AppendGroup(group.name(), group.percentage());
}
const std::string& chosen_group_name = trial->GetGroupNameWithoutActivation();
base::FeatureList::OverrideState feature_state =
(chosen_group_name == kExperimentGroup)
? base::FeatureList::OVERRIDE_ENABLE_FEATURE
: base::FeatureList::OVERRIDE_DISABLE_FEATURE;
feature_list->RegisterFieldTrialOverride(features::kHideShortcutsOnNtp.name,
feature_state, trial.get());
// This pref ensures the field trial can be loaded again for clients that
// were activated in a previous browser session.
local_state->SetBoolean(prefs::kNtpActivateHideShortcutsFieldTrial, true);
}
} // namespace ntp_first_run
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SEARCH_LOCAL_NTP_FIRST_RUN_FIELD_TRIAL_HANDLER_H_
#define CHROME_BROWSER_SEARCH_LOCAL_NTP_FIRST_RUN_FIELD_TRIAL_HANDLER_H_
class PrefRegistrySimple;
class PrefService;
namespace base {
class FeatureList;
}
namespace ntp_first_run {
// Registers hide shortcuts field trial activation in Local State.
void RegisterLocalStatePrefs(PrefRegistrySimple* registry);
// Loads the HideShortcutsOnNtp field trial config, and establishes the chosen
// group for this client as being part of the experiment, control or default.
void ActivateHideShortcutsOnNtpFieldTrial(base::FeatureList* feature_list,
PrefService* local_state);
} // namespace ntp_first_run
#endif // CHROME_BROWSER_SEARCH_LOCAL_NTP_FIRST_RUN_FIELD_TRIAL_HANDLER_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/search/local_ntp_first_run_field_trials.h"
LocalNtpFirstRunFieldTrialGroup::LocalNtpFirstRunFieldTrialGroup(
const std::string& name,
variations::VariationID variation,
base::FieldTrial::Probability percentage)
: name_(name), variation_(variation), percentage_(percentage) {}
LocalNtpFirstRunFieldTrialGroup::~LocalNtpFirstRunFieldTrialGroup() = default;
LocalNtpFirstRunFieldTrialConfig::LocalNtpFirstRunFieldTrialConfig(
const std::string& trial_name)
: trial_name_(trial_name) {}
LocalNtpFirstRunFieldTrialConfig::~LocalNtpFirstRunFieldTrialConfig() = default;
void LocalNtpFirstRunFieldTrialConfig::AddGroup(
const std::string& name,
variations::VariationID variation,
base::FieldTrial::Probability percentage) {
groups_.emplace_back(name, variation, percentage);
}
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SEARCH_LOCAL_NTP_FIRST_RUN_FIELD_TRIALS_H_
#define CHROME_BROWSER_SEARCH_LOCAL_NTP_FIRST_RUN_FIELD_TRIALS_H_
#include "base/macros.h"
#include "components/variations/variations_associated_data.h"
// Defines a FieldTrial group.
class LocalNtpFirstRunFieldTrialGroup {
public:
LocalNtpFirstRunFieldTrialGroup(const std::string& name,
variations::VariationID variation,
base::FieldTrial::Probability percentage);
~LocalNtpFirstRunFieldTrialGroup();
// Accessors for this FieldTrial group.
const std::string& name() const { return name_; }
variations::VariationID variation() const { return variation_; }
base::FieldTrial::Probability percentage() const { return percentage_; }
private:
std::string name_;
variations::VariationID variation_;
base::FieldTrial::Probability percentage_;
};
// Defines a FieldTrial configuration that will be valid at the time of Chrome
// First Run. Since server-provided FieldTrial configurations need to be
// downloaded, they do not take effect until at least the second run.
// FieldTrials involving substantial UI changes that need to take effect at
// first run must be pre-defined in client code.
class LocalNtpFirstRunFieldTrialConfig {
public:
// Initializes with |trial_name| as the name of the FieldTrial with default
// duration.
explicit LocalNtpFirstRunFieldTrialConfig(const std::string& trial_name);
~LocalNtpFirstRunFieldTrialConfig();
// Adds a new FieldTrial group of |name| with a probability of |percentage|.
// |variation| defines a server-side variation configuration.
void AddGroup(const std::string& name,
variations::VariationID variation,
base::FieldTrial::Probability percentage);
// Returns a vector of FieldTrial groups for this FieldTrial configuration.
const std::vector<LocalNtpFirstRunFieldTrialGroup>& groups() const {
return groups_;
}
// Accessors for this FieldTrial.
const std::string& trial_name() { return trial_name_; }
private:
std::string trial_name_;
std::vector<LocalNtpFirstRunFieldTrialGroup> groups_;
DISALLOW_COPY_AND_ASSIGN(LocalNtpFirstRunFieldTrialConfig);
};
#endif // CHROME_BROWSER_SEARCH_LOCAL_NTP_FIRST_RUN_FIELD_TRIALS_H_
...@@ -1626,11 +1626,6 @@ const char kNtpCollapsedSnapshotDocument[] = "ntp.collapsed_snapshot_document"; ...@@ -1626,11 +1626,6 @@ const char kNtpCollapsedSnapshotDocument[] = "ntp.collapsed_snapshot_document";
// Keeps track of sync promo collapsed state in the Other Devices menu. // Keeps track of sync promo collapsed state in the Other Devices menu.
const char kNtpCollapsedSyncPromo[] = "ntp.collapsed_sync_promo"; const char kNtpCollapsedSyncPromo[] = "ntp.collapsed_sync_promo";
#else #else
// Tracks whether a field trial to hide shortcuts on the NTP has been activated.
// It is only activated for fresh installs, and remains active for those clients
// after a browser restart.
const char kNtpActivateHideShortcutsFieldTrial[] =
"ntp.activate_hide_shortcuts_field_trial";
// Holds info for New Tab Page custom background // Holds info for New Tab Page custom background
const char kNtpCustomBackgroundDict[] = "ntp.custom_background_dict"; const char kNtpCustomBackgroundDict[] = "ntp.custom_background_dict";
const char kNtpCustomBackgroundLocalToDevice[] = const char kNtpCustomBackgroundLocalToDevice[] =
......
...@@ -550,7 +550,6 @@ extern const char kNtpCollapsedRecentlyClosedTabs[]; ...@@ -550,7 +550,6 @@ extern const char kNtpCollapsedRecentlyClosedTabs[];
extern const char kNtpCollapsedSnapshotDocument[]; extern const char kNtpCollapsedSnapshotDocument[];
extern const char kNtpCollapsedSyncPromo[]; extern const char kNtpCollapsedSyncPromo[];
#else #else
extern const char kNtpActivateHideShortcutsFieldTrial[];
extern const char kNtpCustomBackgroundDict[]; extern const char kNtpCustomBackgroundDict[];
extern const char kNtpCustomBackgroundLocalToDevice[]; extern const char kNtpCustomBackgroundLocalToDevice[];
extern const char kNtpSearchSuggestionsBlocklist[]; extern const char kNtpSearchSuggestionsBlocklist[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment