| Index: chrome/browser/chrome_browser_field_trials_mobile.cc
|
| diff --git a/chrome/browser/chrome_browser_field_trials_mobile.cc b/chrome/browser/chrome_browser_field_trials_mobile.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2a070739aac9a989fefd14a3f3671c34aad240aa
|
| --- /dev/null
|
| +++ b/chrome/browser/chrome_browser_field_trials_mobile.cc
|
| @@ -0,0 +1,90 @@
|
| +// Copyright 2013 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/chrome_browser_field_trials_mobile.h"
|
| +
|
| +#include <string>
|
| +
|
| +//#include "apps/field_trial_names.h"
|
| +//#include "apps/pref_names.h"
|
| +#include "base/command_line.h"
|
| +#include "base/metrics/field_trial.h"
|
| +#include "base/prefs/pref_service.h"
|
| +//#include "base/string_util.h"
|
| +//#include "base/stringprintf.h"
|
| +//#include "base/strings/string_number_conversions.h"
|
| +//#include "base/strings/sys_string_conversions.h"
|
| +//#include "base/utf_string_conversions.h"
|
| +//#include "chrome/browser/auto_launch_trial.h"
|
| +//#include "chrome/browser/google/google_util.h"
|
| +//#include "chrome/browser/gpu/chrome_gpu_util.h"
|
| +//#include "chrome/browser/omnibox/omnibox_field_trial.h"
|
| +//#include "chrome/browser/prerender/prerender_field_trial.h"
|
| +//#include "chrome/browser/profiles/profile_manager.h"
|
| +//#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
|
| +//#include "chrome/browser/ui/sync/one_click_signin_helper.h"
|
| +//#include "chrome/common/chrome_switches.h"
|
| +#include "chrome/common/chrome_version_info.h"
|
| +//#include "chrome/common/metrics/variations/uniformity_field_trials.h"
|
| +//#include "chrome/common/metrics/variations/variations_util.h"
|
| +//#include "chrome/common/pref_names.h"
|
| +//#include "net/spdy/spdy_session.h"
|
| +//#include "ui/base/layout.h"
|
| +
|
| +#if !defined(OS_ANDROID) && !defined(OS_IOS)
|
| +// Just testing to make sure this file isn't inadvertently included. Ignore
|
| +// when reviewing, I will remove after one try run.
|
| +#error
|
| +#endif
|
| +
|
| +namespace chrome {
|
| +
|
| +namespace {
|
| +
|
| +// Governs the rollout of the compression proxy for Chrome on mobile platforms.
|
| +// Always enabled in DEV and BETA versions.
|
| +// Stable percentage will be controlled from server.
|
| +void DataCompressionProxyFieldTrial() {
|
| + const char kDataCompressionProxyFieldTrialName[] =
|
| + "DataCompressionProxyRollout";
|
| + const base::FieldTrial::Probability kDataCompressionProxyDivisor = 1000;
|
| +
|
| + // 10/1000 = 1% for starters.
|
| + const base::FieldTrial::Probability kDataCompressionProxyStable = 10;
|
| + const char kEnabled[] = "Enabled";
|
| + const char kDisabled[] = "Disabled";
|
| +
|
| + // Find out if this is a stable channel.
|
| + const bool kIsStableChannel =
|
| + chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE;
|
| +
|
| + // Experiment enabled until Jan 1, 2015. By default, disabled.
|
| + scoped_refptr<base::FieldTrial> trial(
|
| + base::FieldTrialList::FactoryGetFieldTrial(
|
| + kDataCompressionProxyFieldTrialName, kDataCompressionProxyDivisor,
|
| + kDisabled, 2015, 1, 1, NULL));
|
| +
|
| + // We want our trial results to be persistent.
|
| + trial->UseOneTimeRandomization();
|
| + // Non-stable channels will run with probability 1.
|
| + const int kEnabledGroup = trial->AppendGroup(
|
| + kEnabled,
|
| + kIsStableChannel ?
|
| + kDataCompressionProxyStable : kDataCompressionProxyDivisor);
|
| +
|
| + const int v = trial->group();
|
| + VLOG(1) << "DataCompression proxy enabled group id: " << kEnabledGroup
|
| + << ". Selected group id: " << v;
|
| +}
|
| +
|
| +} // end namespace
|
| +
|
| +
|
| +void SetupMobileFieldTrials(const CommandLine& parsed_command_line,
|
| + const base::Time& install_time,
|
| + PrefService* local_state) {
|
| + DataCompressionProxyFieldTrial();
|
| +}
|
| +
|
| +} // end namespace chrome
|
|
|