Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Side by Side Diff: chrome/browser/extensions/api/metrics_private/metrics_private_api.cc

Issue 1055673002: [Extensions API] Remove inline enums (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/extensions/api/metrics_private/metrics_private_api.h" 5 #include "chrome/browser/extensions/api/metrics_private/metrics_private_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 if (counter) 109 if (counter)
110 counter->Add(sample); 110 counter->Add(sample);
111 return true; 111 return true;
112 } 112 }
113 113
114 bool MetricsPrivateRecordValueFunction::RunSync() { 114 bool MetricsPrivateRecordValueFunction::RunSync() {
115 scoped_ptr<RecordValue::Params> params(RecordValue::Params::Create(*args_)); 115 scoped_ptr<RecordValue::Params> params(RecordValue::Params::Create(*args_));
116 EXTENSION_FUNCTION_VALIDATE(params.get()); 116 EXTENSION_FUNCTION_VALIDATE(params.get());
117 117
118 // Get the histogram parameters from the metric type object. 118 // Get the histogram parameters from the metric type object.
119 std::string type = api::metrics_private::MetricType::ToString( 119 std::string type = api::metrics_private::ToString(params->metric.type);
120 params->metric.type);
121 120
122 base::HistogramType histogram_type(type == "histogram-linear" ? 121 base::HistogramType histogram_type(type == "histogram-linear" ?
123 base::LINEAR_HISTOGRAM : base::HISTOGRAM); 122 base::LINEAR_HISTOGRAM : base::HISTOGRAM);
124 return RecordValue(params->metric.metric_name, histogram_type, 123 return RecordValue(params->metric.metric_name, histogram_type,
125 params->metric.min, params->metric.max, 124 params->metric.min, params->metric.max,
126 params->metric.buckets, params->value); 125 params->metric.buckets, params->value);
127 } 126 }
128 127
129 bool MetricsPrivateRecordSparseValueFunction::RunSync() { 128 bool MetricsPrivateRecordSparseValueFunction::RunSync() {
130 scoped_ptr<RecordSparseValue::Params> params( 129 scoped_ptr<RecordSparseValue::Params> params(
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 bool MetricsPrivateRecordLongTimeFunction::RunSync() { 186 bool MetricsPrivateRecordLongTimeFunction::RunSync() {
188 scoped_ptr<RecordLongTime::Params> params( 187 scoped_ptr<RecordLongTime::Params> params(
189 RecordLongTime::Params::Create(*args_)); 188 RecordLongTime::Params::Create(*args_));
190 EXTENSION_FUNCTION_VALIDATE(params.get()); 189 EXTENSION_FUNCTION_VALIDATE(params.get());
191 static const int kOneHourMs = 60 * 60 * 1000; 190 static const int kOneHourMs = 60 * 60 * 1000;
192 return RecordValue(params->metric_name, base::HISTOGRAM, 191 return RecordValue(params->metric_name, base::HISTOGRAM,
193 1, kOneHourMs, 50, params->value); 192 1, kOneHourMs, 50, params->value);
194 } 193 }
195 194
196 } // namespace extensions 195 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/input_ime/input_ime_api.cc ('k') | chrome/browser/extensions/api/omnibox/omnibox_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698