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 "extensions/browser/api/metrics_private/metrics_private_api.h" | 5 #include "extensions/browser/api/metrics_private/metrics_private_api.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 const size_t kMaxBuckets = 10000; // We don't ever want more than these many | 37 const size_t kMaxBuckets = 10000; // We don't ever want more than these many |
38 // buckets; there is no real need for them | 38 // buckets; there is no real need for them |
39 // and would cause crazy memory usage | 39 // and would cause crazy memory usage |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 ExtensionFunction::ResponseAction | 42 ExtensionFunction::ResponseAction |
43 MetricsPrivateGetIsCrashReportingEnabledFunction::Run() { | 43 MetricsPrivateGetIsCrashReportingEnabledFunction::Run() { |
44 MetricsPrivateDelegate* delegate = | 44 MetricsPrivateDelegate* delegate = |
45 ExtensionsAPIClient::Get()->GetMetricsPrivateDelegate(); | 45 ExtensionsAPIClient::Get()->GetMetricsPrivateDelegate(); |
46 | 46 |
47 return RespondNow(OneArgument(base::MakeUnique<base::FundamentalValue>( | 47 return RespondNow(OneArgument(base::MakeUnique<base::Value>( |
48 delegate && delegate->IsCrashReportingEnabled()))); | 48 delegate && delegate->IsCrashReportingEnabled()))); |
49 } | 49 } |
50 | 50 |
51 ExtensionFunction::ResponseAction MetricsPrivateGetFieldTrialFunction::Run() { | 51 ExtensionFunction::ResponseAction MetricsPrivateGetFieldTrialFunction::Run() { |
52 std::string name; | 52 std::string name; |
53 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &name)); | 53 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &name)); |
54 | 54 |
55 return RespondNow(OneArgument(base::MakeUnique<base::StringValue>( | 55 return RespondNow(OneArgument(base::MakeUnique<base::StringValue>( |
56 base::FieldTrialList::FindFullName(name)))); | 56 base::FieldTrialList::FindFullName(name)))); |
57 } | 57 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 std::unique_ptr<RecordLongTime::Params> params( | 206 std::unique_ptr<RecordLongTime::Params> params( |
207 RecordLongTime::Params::Create(*args_)); | 207 RecordLongTime::Params::Create(*args_)); |
208 EXTENSION_FUNCTION_VALIDATE(params.get()); | 208 EXTENSION_FUNCTION_VALIDATE(params.get()); |
209 static const int kOneHourMs = 60 * 60 * 1000; | 209 static const int kOneHourMs = 60 * 60 * 1000; |
210 RecordValue(params->metric_name, base::HISTOGRAM, 1, kOneHourMs, 50, | 210 RecordValue(params->metric_name, base::HISTOGRAM, 1, kOneHourMs, 50, |
211 params->value); | 211 params->value); |
212 return RespondNow(NoArguments()); | 212 return RespondNow(NoArguments()); |
213 } | 213 } |
214 | 214 |
215 } // namespace extensions | 215 } // namespace extensions |
OLD | NEW |