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

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

Issue 2771233002: Remove the wrapper functions content::RecordAction et al (Closed)
Patch Set: Rebased Created 3 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 "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
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/metrics/sparse_histogram.h" 14 #include "base/metrics/sparse_histogram.h"
15 #include "base/metrics/user_metrics.h"
15 #include "components/variations/variations_associated_data.h" 16 #include "components/variations/variations_associated_data.h"
16 #include "content/public/browser/user_metrics.h"
17 #include "extensions/browser/api/extensions_api_client.h" 17 #include "extensions/browser/api/extensions_api_client.h"
18 #include "extensions/browser/api/metrics_private/metrics_private_delegate.h" 18 #include "extensions/browser/api/metrics_private/metrics_private_delegate.h"
19 #include "extensions/common/api/metrics_private.h" 19 #include "extensions/common/api/metrics_private.h"
20 20
21 namespace extensions { 21 namespace extensions {
22 22
23 namespace GetVariationParams = api::metrics_private::GetVariationParams; 23 namespace GetVariationParams = api::metrics_private::GetVariationParams;
24 namespace RecordUserAction = api::metrics_private::RecordUserAction; 24 namespace RecordUserAction = api::metrics_private::RecordUserAction;
25 namespace RecordValue = api::metrics_private::RecordValue; 25 namespace RecordValue = api::metrics_private::RecordValue;
26 namespace RecordSparseValue = api::metrics_private::RecordSparseValue; 26 namespace RecordSparseValue = api::metrics_private::RecordSparseValue;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 return RespondNow(dict ? OneArgument(std::move(dict)) : NoArguments()); 71 return RespondNow(dict ? OneArgument(std::move(dict)) : NoArguments());
72 } 72 }
73 73
74 ExtensionFunction::ResponseAction 74 ExtensionFunction::ResponseAction
75 MetricsPrivateRecordUserActionFunction::Run() { 75 MetricsPrivateRecordUserActionFunction::Run() {
76 std::unique_ptr<RecordUserAction::Params> params( 76 std::unique_ptr<RecordUserAction::Params> params(
77 RecordUserAction::Params::Create(*args_)); 77 RecordUserAction::Params::Create(*args_));
78 EXTENSION_FUNCTION_VALIDATE(params.get()); 78 EXTENSION_FUNCTION_VALIDATE(params.get());
79 79
80 content::RecordComputedAction(params->name); 80 base::RecordComputedAction(params->name);
81 return RespondNow(NoArguments()); 81 return RespondNow(NoArguments());
82 } 82 }
83 83
84 void MetricsHistogramHelperFunction::RecordValue(const std::string& name, 84 void MetricsHistogramHelperFunction::RecordValue(const std::string& name,
85 base::HistogramType type, 85 base::HistogramType type,
86 int min, 86 int min,
87 int max, 87 int max,
88 size_t buckets, 88 size_t buckets,
89 int sample) { 89 int sample) {
90 // Make sure toxic values don't get to internal code. 90 // Make sure toxic values don't get to internal code.
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « content/public/browser/user_metrics.h ('k') | extensions/browser/api/web_request/web_request_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698