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

Side by Side Diff: chrome/browser/extensions/extension_metrics_module.cc

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Version for commit (merged again). Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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 "chrome/common/extensions/extension.h" 8 #include "chrome/common/extensions/extension.h"
9 #include "content/browser/user_metrics.h" 9 #include "content/public/browser/user_metrics.h"
10 10
11 using base::Histogram; 11 using base::Histogram;
12 using base::LinearHistogram; 12 using base::LinearHistogram;
13 using content::UserMetricsAction;
13 14
14 bool MetricsRecordUserActionFunction::RunImpl() { 15 bool MetricsRecordUserActionFunction::RunImpl() {
15 std::string name; 16 std::string name;
16 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &name)); 17 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &name));
17 18
18 UserMetrics::RecordComputedAction(name); 19 content::RecordComputedAction(name);
19 return true; 20 return true;
20 } 21 }
21 22
22 bool MetricsHistogramHelperFunction::GetNameAndSample(std::string* name, 23 bool MetricsHistogramHelperFunction::GetNameAndSample(std::string* name,
23 int* sample) { 24 int* sample) {
24 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, name)); 25 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, name));
25 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, sample)); 26 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, sample));
26 return true; 27 return true;
27 } 28 }
28 29
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return RecordValue(name, Histogram::HISTOGRAM, 1, kThreeMinMs, 50, sample); 120 return RecordValue(name, Histogram::HISTOGRAM, 1, kThreeMinMs, 50, sample);
120 } 121 }
121 122
122 bool MetricsRecordLongTimeFunction::RunImpl() { 123 bool MetricsRecordLongTimeFunction::RunImpl() {
123 std::string name; 124 std::string name;
124 int sample; 125 int sample;
125 EXTENSION_FUNCTION_VALIDATE(GetNameAndSample(&name, &sample)); 126 EXTENSION_FUNCTION_VALIDATE(GetNameAndSample(&name, &sample));
126 static const int kOneHourMs = 60 * 60 * 1000; 127 static const int kOneHourMs = 60 * 60 * 1000;
127 return RecordValue(name, Histogram::HISTOGRAM, 1, kOneHourMs, 50, sample); 128 return RecordValue(name, Histogram::HISTOGRAM, 1, kOneHourMs, 50, sample);
128 } 129 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_function.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698