| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chrome_browser_field_trials_mobile.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 //#include "apps/field_trial_names.h" |
| 10 //#include "apps/pref_names.h" |
| 11 #include "base/command_line.h" |
| 12 #include "base/metrics/field_trial.h" |
| 13 #include "base/prefs/pref_service.h" |
| 14 //#include "base/string_util.h" |
| 15 //#include "base/stringprintf.h" |
| 16 //#include "base/strings/string_number_conversions.h" |
| 17 //#include "base/strings/sys_string_conversions.h" |
| 18 //#include "base/utf_string_conversions.h" |
| 19 //#include "chrome/browser/auto_launch_trial.h" |
| 20 //#include "chrome/browser/google/google_util.h" |
| 21 //#include "chrome/browser/gpu/chrome_gpu_util.h" |
| 22 //#include "chrome/browser/omnibox/omnibox_field_trial.h" |
| 23 //#include "chrome/browser/prerender/prerender_field_trial.h" |
| 24 //#include "chrome/browser/profiles/profile_manager.h" |
| 25 //#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
| 26 //#include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 27 //#include "chrome/common/chrome_switches.h" |
| 28 #include "chrome/common/chrome_version_info.h" |
| 29 //#include "chrome/common/metrics/variations/uniformity_field_trials.h" |
| 30 //#include "chrome/common/metrics/variations/variations_util.h" |
| 31 //#include "chrome/common/pref_names.h" |
| 32 //#include "net/spdy/spdy_session.h" |
| 33 //#include "ui/base/layout.h" |
| 34 |
| 35 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 36 // Just testing to make sure this file isn't inadvertently included. Ignore |
| 37 // when reviewing, I will remove after one try run. |
| 38 #error |
| 39 #endif |
| 40 |
| 41 namespace chrome { |
| 42 |
| 43 namespace { |
| 44 |
| 45 // Governs the rollout of the compression proxy for Chrome on mobile platforms. |
| 46 // Always enabled in DEV and BETA versions. |
| 47 // Stable percentage will be controlled from server. |
| 48 void DataCompressionProxyFieldTrial() { |
| 49 const char kDataCompressionProxyFieldTrialName[] = |
| 50 "DataCompressionProxyRollout"; |
| 51 const base::FieldTrial::Probability kDataCompressionProxyDivisor = 1000; |
| 52 |
| 53 // 10/1000 = 1% for starters. |
| 54 const base::FieldTrial::Probability kDataCompressionProxyStable = 10; |
| 55 const char kEnabled[] = "Enabled"; |
| 56 const char kDisabled[] = "Disabled"; |
| 57 |
| 58 // Find out if this is a stable channel. |
| 59 const bool kIsStableChannel = |
| 60 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; |
| 61 |
| 62 // Experiment enabled until Jan 1, 2015. By default, disabled. |
| 63 scoped_refptr<base::FieldTrial> trial( |
| 64 base::FieldTrialList::FactoryGetFieldTrial( |
| 65 kDataCompressionProxyFieldTrialName, kDataCompressionProxyDivisor, |
| 66 kDisabled, 2015, 1, 1, NULL)); |
| 67 |
| 68 // We want our trial results to be persistent. |
| 69 trial->UseOneTimeRandomization(); |
| 70 // Non-stable channels will run with probability 1. |
| 71 const int kEnabledGroup = trial->AppendGroup( |
| 72 kEnabled, |
| 73 kIsStableChannel ? |
| 74 kDataCompressionProxyStable : kDataCompressionProxyDivisor); |
| 75 |
| 76 const int v = trial->group(); |
| 77 VLOG(1) << "DataCompression proxy enabled group id: " << kEnabledGroup |
| 78 << ". Selected group id: " << v; |
| 79 } |
| 80 |
| 81 } // end namespace |
| 82 |
| 83 |
| 84 void SetupMobileFieldTrials(const CommandLine& parsed_command_line, |
| 85 const base::Time& install_time, |
| 86 PrefService* local_state) { |
| 87 DataCompressionProxyFieldTrial(); |
| 88 } |
| 89 |
| 90 } // end namespace chrome |
| OLD | NEW |