| 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 "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials( | 26 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials( |
| 27 const CommandLine& parsed_command_line) | 27 const CommandLine& parsed_command_line) |
| 28 : parsed_command_line_(parsed_command_line) { | 28 : parsed_command_line_(parsed_command_line) { |
| 29 } | 29 } |
| 30 | 30 |
| 31 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() { | 31 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() { |
| 32 } | 32 } |
| 33 | 33 |
| 34 void ChromeBrowserFieldTrials::SetupFieldTrials(PrefService* local_state) { | 34 void ChromeBrowserFieldTrials::SetupFieldTrials(const base::Time& install_time, |
| 35 const base::Time install_time = base::Time::FromTimeT( | 35 PrefService* local_state) { |
| 36 local_state->GetInt64(metrics::prefs::kInstallDate)); | |
| 37 DCHECK(!install_time.is_null()); | 36 DCHECK(!install_time.is_null()); |
| 38 | 37 |
| 39 // Field trials that are shared by all platforms. | 38 // Field trials that are shared by all platforms. |
| 40 chrome_variations::SetupUniformityFieldTrials(install_time); | 39 chrome_variations::SetupUniformityFieldTrials(install_time); |
| 41 InstantiateDynamicTrials(); | 40 InstantiateDynamicTrials(); |
| 42 | 41 |
| 43 #if defined(OS_ANDROID) || defined(OS_IOS) | 42 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 44 chrome::SetupMobileFieldTrials( | 43 chrome::SetupMobileFieldTrials(parsed_command_line_); |
| 45 parsed_command_line_, install_time, local_state); | |
| 46 #else | 44 #else |
| 47 chrome::SetupDesktopFieldTrials( | 45 chrome::SetupDesktopFieldTrials( |
| 48 parsed_command_line_, install_time, local_state); | 46 parsed_command_line_, local_state); |
| 49 #endif | 47 #endif |
| 50 } | 48 } |
| 51 | 49 |
| 52 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() { | 50 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() { |
| 53 // Call |FindValue()| on the trials below, which may come from the server, to | 51 // Call |FindValue()| on the trials below, which may come from the server, to |
| 54 // ensure they get marked as "used" for the purposes of data reporting. | 52 // ensure they get marked as "used" for the purposes of data reporting. |
| 55 base::FieldTrialList::FindValue("UMA-Dynamic-Binary-Uniformity-Trial"); | 53 base::FieldTrialList::FindValue("UMA-Dynamic-Binary-Uniformity-Trial"); |
| 56 base::FieldTrialList::FindValue("UMA-Dynamic-Uniformity-Trial"); | 54 base::FieldTrialList::FindValue("UMA-Dynamic-Uniformity-Trial"); |
| 57 base::FieldTrialList::FindValue("InstantDummy"); | 55 base::FieldTrialList::FindValue("InstantDummy"); |
| 58 base::FieldTrialList::FindValue("InstantChannel"); | 56 base::FieldTrialList::FindValue("InstantChannel"); |
| 59 base::FieldTrialList::FindValue("Test0PercentDefault"); | 57 base::FieldTrialList::FindValue("Test0PercentDefault"); |
| 60 // The following trials are used from renderer process. | 58 // The following trials are used from renderer process. |
| 61 // Mark here so they will be sync-ed. | 59 // Mark here so they will be sync-ed. |
| 62 base::FieldTrialList::FindValue("CLD1VsCLD2"); | 60 base::FieldTrialList::FindValue("CLD1VsCLD2"); |
| 63 base::FieldTrialList::FindValue("MouseEventPreconnect"); | 61 base::FieldTrialList::FindValue("MouseEventPreconnect"); |
| 64 base::FieldTrialList::FindValue("UnauthorizedPluginInfoBar"); | 62 base::FieldTrialList::FindValue("UnauthorizedPluginInfoBar"); |
| 65 // Activate the autocomplete dynamic field trials. | 63 // Activate the autocomplete dynamic field trials. |
| 66 OmniboxFieldTrial::ActivateDynamicTrials(); | 64 OmniboxFieldTrial::ActivateDynamicTrials(); |
| 67 } | 65 } |
| OLD | NEW |