[email protected] | 0cba296 | 2011-12-15 10:45:32 | [diff] [blame] | 1 | // Copyright (c) 2011 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/auto_launch_trial.h" |
| 6 | |
| 7 | #include "base/file_path.h" |
| 8 | #include "base/metrics/field_trial.h" |
| 9 | #include "base/metrics/histogram.h" |
[email protected] | 06049cd7 | 2011-12-19 11:40:42 | [diff] [blame] | 10 | #include "base/string_util.h" |
[email protected] | 0cba296 | 2011-12-15 10:45:32 | [diff] [blame] | 11 | #include "chrome/browser/first_run/first_run.h" |
| 12 | #include "chrome/installer/util/master_preferences_constants.h" |
| 13 | #include "chrome/installer/util/master_preferences.h" |
| 14 | |
| 15 | const char kAutoLaunchTrialName[] = "AutoLaunchExperiment"; |
| 16 | const char kAutoLaunchTrialAutoLaunchGroup[] = "AutoLaunching"; |
| 17 | const char kAutoLaunchTrialControlGroup[] = "NotAutoLaunching"; |
| 18 | |
| 19 | namespace auto_launch_trial { |
| 20 | |
| 21 | bool IsInAutoLaunchGroup() { |
| 22 | return base::FieldTrialList::TrialExists(kAutoLaunchTrialName) && |
| 23 | base::FieldTrialList::Find(kAutoLaunchTrialName)->group_name() |
| 24 | == kAutoLaunchTrialAutoLaunchGroup; |
| 25 | } |
| 26 | |
[email protected] | 06049cd7 | 2011-12-19 11:40:42 | [diff] [blame] | 27 | bool IsInExperimentGroup(const std::string& brand_code) { |
| 28 | return LowerCaseEqualsASCII(brand_code, "rngp"); |
| 29 | } |
| 30 | |
| 31 | bool IsInControlGroup(const std::string& brand_code) { |
| 32 | return LowerCaseEqualsASCII(brand_code, "rngq"); |
| 33 | } |
| 34 | |
[email protected] | 0cba296 | 2011-12-15 10:45:32 | [diff] [blame] | 35 | void UpdateToggleAutoLaunchMetric(bool auto_launch) { |
| 36 | UMA_HISTOGRAM_ENUMERATION( |
| 37 | base::FieldTrial::MakeName("ToggleAutoLaunch", kAutoLaunchTrialName), |
| 38 | auto_launch ? 1 : 0, 2); |
| 39 | } |
| 40 | |
| 41 | void UpdateInfobarResponseMetric(InfobarMetricResponse response) { |
| 42 | UMA_HISTOGRAM_ENUMERATION( |
| 43 | base::FieldTrial::MakeName("InfobarRepsonse", kAutoLaunchTrialName), |
| 44 | response, 3); |
| 45 | } |
| 46 | |
| 47 | void UpdateInfobarShownMetric() { |
| 48 | UMA_HISTOGRAM_COUNTS( |
| 49 | base::FieldTrial::MakeName("InfobarShown", kAutoLaunchTrialName), 1); |
| 50 | } |
| 51 | |
| 52 | } // namespace auto_launch_trial |