OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chrome_browser_field_trials.h" | 5 #include "chrome/browser/chrome_browser_field_trials.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "apps/field_trial_names.h" | |
10 #include "apps/pref_names.h" | |
9 #include "base/command_line.h" | 11 #include "base/command_line.h" |
10 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
13 #include "base/prefs/pref_service.h" | |
11 #include "base/string_util.h" | 14 #include "base/string_util.h" |
12 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
13 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
14 #include "base/sys_string_conversions.h" | 17 #include "base/sys_string_conversions.h" |
15 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/auto_launch_trial.h" | 19 #include "chrome/browser/auto_launch_trial.h" |
17 #include "chrome/browser/google/google_util.h" | 20 #include "chrome/browser/google/google_util.h" |
18 #include "chrome/browser/gpu/chrome_gpu_util.h" | 21 #include "chrome/browser/gpu/chrome_gpu_util.h" |
19 #include "chrome/browser/metrics/variations/variations_service.h" | 22 #include "chrome/browser/metrics/variations/variations_service.h" |
20 #include "chrome/browser/omnibox/omnibox_field_trial.h" | 23 #include "chrome/browser/omnibox/omnibox_field_trial.h" |
21 #include "chrome/browser/prerender/prerender_field_trial.h" | 24 #include "chrome/browser/prerender/prerender_field_trial.h" |
22 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
23 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 26 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
24 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 27 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
25 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/chrome_version_info.h" | 29 #include "chrome/common/chrome_version_info.h" |
27 #include "chrome/common/metrics/variations/uniformity_field_trials.h" | 30 #include "chrome/common/metrics/variations/uniformity_field_trials.h" |
28 #include "chrome/common/metrics/variations/variations_util.h" | 31 #include "chrome/common/metrics/variations/variations_util.h" |
32 #include "chrome/common/pref_names.h" | |
29 #include "net/socket/client_socket_pool_base.h" | 33 #include "net/socket/client_socket_pool_base.h" |
30 #include "net/spdy/spdy_session.h" | 34 #include "net/spdy/spdy_session.h" |
31 #include "ui/base/layout.h" | 35 #include "ui/base/layout.h" |
32 | 36 |
33 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
34 #include "net/socket/tcp_client_socket_win.h" | 38 #include "net/socket/tcp_client_socket_win.h" |
35 #endif // defined(OS_WIN) | 39 #endif // defined(OS_WIN) |
36 | 40 |
37 namespace { | 41 namespace { |
38 | 42 |
(...skipping 10 matching lines...) Expand all Loading... | |
49 } // namespace | 53 } // namespace |
50 | 54 |
51 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials( | 55 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials( |
52 const CommandLine& parsed_command_line) : | 56 const CommandLine& parsed_command_line) : |
53 parsed_command_line_(parsed_command_line) { | 57 parsed_command_line_(parsed_command_line) { |
54 } | 58 } |
55 | 59 |
56 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() { | 60 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() { |
57 } | 61 } |
58 | 62 |
59 void ChromeBrowserFieldTrials::SetupFieldTrials( | 63 void ChromeBrowserFieldTrials::SetupFieldTrials(PrefService* local_state) { |
60 const base::Time& install_time) { | 64 const base::Time install_time = base::Time::FromTimeT( |
65 local_state->GetInt64(prefs::kInstallDate)); | |
66 DCHECK(!install_time.is_null()); | |
61 chrome_variations::SetupUniformityFieldTrials(install_time); | 67 chrome_variations::SetupUniformityFieldTrials(install_time); |
62 SetUpSimpleCacheFieldTrial(); | 68 SetUpSimpleCacheFieldTrial(); |
63 #if !defined(OS_ANDROID) | 69 #if !defined(OS_ANDROID) |
64 SetupDesktopFieldTrials(); | 70 SetupDesktopFieldTrials(); |
65 #endif // defined(OS_ANDROID) | 71 #endif // defined(OS_ANDROID) |
72 // This is not quite a field trial initialization, but it's an initialization | |
73 // that depends on a field trial, so why not? :-) | |
74 if (base::FieldTrialList::FindFullName(apps::kLauncherPromoTrialName) == | |
Alexei Svitkine (slow)
2013/03/22 16:57:35
Please encapsulate this in a separate function and
MAD
2013/03/22 17:11:35
Done.
| |
75 apps::kResetShowLauncherPromoPrefGroup) { | |
76 local_state->SetBoolean(apps::prefs::kShowAppLauncherPromo, true); | |
77 } | |
66 } | 78 } |
67 | 79 |
68 void ChromeBrowserFieldTrials::SetupDesktopFieldTrials() { | 80 void ChromeBrowserFieldTrials::SetupDesktopFieldTrials() { |
69 prerender::ConfigurePrefetchAndPrerender(parsed_command_line_); | 81 prerender::ConfigurePrefetchAndPrerender(parsed_command_line_); |
70 SpdyFieldTrial(); | 82 SpdyFieldTrial(); |
71 WarmConnectionFieldTrial(); | 83 WarmConnectionFieldTrial(); |
72 AutoLaunchChromeFieldTrial(); | 84 AutoLaunchChromeFieldTrial(); |
73 gpu_util::InitializeCompositingFieldTrial(); | 85 gpu_util::InitializeCompositingFieldTrial(); |
74 OmniboxFieldTrial::ActivateStaticTrials(); | 86 OmniboxFieldTrial::ActivateStaticTrials(); |
75 SetUpInfiniteCacheFieldTrial(); | 87 SetUpInfiniteCacheFieldTrial(); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 // Call |FindValue()| on the trials below, which may come from the server, to | 282 // Call |FindValue()| on the trials below, which may come from the server, to |
271 // ensure they get marked as "used" for the purposes of data reporting. | 283 // ensure they get marked as "used" for the purposes of data reporting. |
272 base::FieldTrialList::FindValue("UMA-Dynamic-Binary-Uniformity-Trial"); | 284 base::FieldTrialList::FindValue("UMA-Dynamic-Binary-Uniformity-Trial"); |
273 base::FieldTrialList::FindValue("UMA-Dynamic-Uniformity-Trial"); | 285 base::FieldTrialList::FindValue("UMA-Dynamic-Uniformity-Trial"); |
274 base::FieldTrialList::FindValue("InstantDummy"); | 286 base::FieldTrialList::FindValue("InstantDummy"); |
275 base::FieldTrialList::FindValue("InstantChannel"); | 287 base::FieldTrialList::FindValue("InstantChannel"); |
276 base::FieldTrialList::FindValue("Test0PercentDefault"); | 288 base::FieldTrialList::FindValue("Test0PercentDefault"); |
277 // Activate the autocomplete dynamic field trials. | 289 // Activate the autocomplete dynamic field trials. |
278 OmniboxFieldTrial::ActivateDynamicTrials(); | 290 OmniboxFieldTrial::ActivateDynamicTrials(); |
279 } | 291 } |
OLD | NEW |