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/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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 SetResult(new base::StringValue(base::FieldTrialList::FindFullName(name))); | 52 SetResult(new base::StringValue(base::FieldTrialList::FindFullName(name))); |
53 return true; | 53 return true; |
54 } | 54 } |
55 | 55 |
56 bool MetricsPrivateGetVariationParamsFunction::RunSync() { | 56 bool MetricsPrivateGetVariationParamsFunction::RunSync() { |
57 scoped_ptr<GetVariationParams::Params> params( | 57 scoped_ptr<GetVariationParams::Params> params( |
58 GetVariationParams::Params::Create(*args_)); | 58 GetVariationParams::Params::Create(*args_)); |
59 EXTENSION_FUNCTION_VALIDATE(params.get()); | 59 EXTENSION_FUNCTION_VALIDATE(params.get()); |
60 | 60 |
61 GetVariationParams::Results::Params result; | 61 GetVariationParams::Results::Params result; |
62 if (chrome_variations::GetVariationParams( | 62 if (variations::GetVariationParams(params->name, |
63 params->name, &result.additional_properties)) { | 63 &result.additional_properties)) { |
64 SetResult(result.ToValue().release()); | 64 SetResult(result.ToValue().release()); |
65 } | 65 } |
66 return true; | 66 return true; |
67 } | 67 } |
68 | 68 |
69 bool MetricsPrivateRecordUserActionFunction::RunSync() { | 69 bool MetricsPrivateRecordUserActionFunction::RunSync() { |
70 scoped_ptr<RecordUserAction::Params> params( | 70 scoped_ptr<RecordUserAction::Params> params( |
71 RecordUserAction::Params::Create(*args_)); | 71 RecordUserAction::Params::Create(*args_)); |
72 EXTENSION_FUNCTION_VALIDATE(params.get()); | 72 EXTENSION_FUNCTION_VALIDATE(params.get()); |
73 | 73 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 bool MetricsPrivateRecordLongTimeFunction::RunSync() { | 187 bool MetricsPrivateRecordLongTimeFunction::RunSync() { |
188 scoped_ptr<RecordLongTime::Params> params( | 188 scoped_ptr<RecordLongTime::Params> params( |
189 RecordLongTime::Params::Create(*args_)); | 189 RecordLongTime::Params::Create(*args_)); |
190 EXTENSION_FUNCTION_VALIDATE(params.get()); | 190 EXTENSION_FUNCTION_VALIDATE(params.get()); |
191 static const int kOneHourMs = 60 * 60 * 1000; | 191 static const int kOneHourMs = 60 * 60 * 1000; |
192 return RecordValue(params->metric_name, base::HISTOGRAM, | 192 return RecordValue(params->metric_name, base::HISTOGRAM, |
193 1, kOneHourMs, 50, params->value); | 193 1, kOneHourMs, 50, params->value); |
194 } | 194 } |
195 | 195 |
196 } // namespace extensions | 196 } // namespace extensions |
OLD | NEW |