OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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/extensions/extension_metrics_module.h" | 5 #include "chrome/browser/extensions/extension_metrics_module.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
10 #include "chrome/browser/metrics/user_metrics.h" | 10 #include "chrome/browser/metrics/user_metrics.h" |
11 #include "chrome/browser/ui/options/options_util.h" | 11 #include "chrome/browser/ui/options/options_util.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return true; | 68 return true; |
69 } | 69 } |
70 | 70 |
71 bool MetricsHistogramHelperFunction::RecordValue(const std::string& name, | 71 bool MetricsHistogramHelperFunction::RecordValue(const std::string& name, |
72 Histogram::ClassType type, | 72 Histogram::ClassType type, |
73 int min, | 73 int min, |
74 int max, | 74 int max, |
75 size_t buckets, | 75 size_t buckets, |
76 int sample) { | 76 int sample) { |
77 std::string full_name = BuildMetricName(name, GetExtension()); | 77 std::string full_name = BuildMetricName(name, GetExtension()); |
78 scoped_refptr<Histogram> counter; | 78 Histogram* counter; |
79 if (type == Histogram::LINEAR_HISTOGRAM) { | 79 if (type == Histogram::LINEAR_HISTOGRAM) { |
80 counter = LinearHistogram::FactoryGet(full_name, | 80 counter = LinearHistogram::FactoryGet(full_name, |
81 min, | 81 min, |
82 max, | 82 max, |
83 buckets, | 83 buckets, |
84 Histogram::kUmaTargetedHistogramFlag); | 84 Histogram::kUmaTargetedHistogramFlag); |
85 } else { | 85 } else { |
86 counter = Histogram::FactoryGet(full_name, | 86 counter = Histogram::FactoryGet(full_name, |
87 min, | 87 min, |
88 max, | 88 max, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 return RecordValue(name, Histogram::HISTOGRAM, 1, kThreeMinMs, 50, sample); | 162 return RecordValue(name, Histogram::HISTOGRAM, 1, kThreeMinMs, 50, sample); |
163 } | 163 } |
164 | 164 |
165 bool MetricsRecordLongTimeFunction::RunImpl() { | 165 bool MetricsRecordLongTimeFunction::RunImpl() { |
166 std::string name; | 166 std::string name; |
167 int sample; | 167 int sample; |
168 EXTENSION_FUNCTION_VALIDATE(GetNameAndSample(&name, &sample)); | 168 EXTENSION_FUNCTION_VALIDATE(GetNameAndSample(&name, &sample)); |
169 static const int kOneHourMs = 60 * 60 * 1000; | 169 static const int kOneHourMs = 60 * 60 * 1000; |
170 return RecordValue(name, Histogram::HISTOGRAM, 1, kOneHourMs, 50, sample); | 170 return RecordValue(name, Histogram::HISTOGRAM, 1, kOneHourMs, 50, sample); |
171 } | 171 } |
OLD | NEW |