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

Unified Diff: chrome/browser/extensions/extension_metrics_module.cc

Issue 8548013: Moving experimental.metrics API to metricsPrivate (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebase Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_metrics_module.cc
diff --git a/chrome/browser/extensions/extension_metrics_module.cc b/chrome/browser/extensions/extension_metrics_module.cc
index 4bba31beeea8d67ae24eba44d5668f6a9d5e081b..cd80ef977d1e7993e4da56c569696ea338989186 100644
--- a/chrome/browser/extensions/extension_metrics_module.cc
+++ b/chrome/browser/extensions/extension_metrics_module.cc
@@ -5,58 +5,16 @@
#include "chrome/browser/extensions/extension_metrics_module.h"
#include "base/metrics/histogram.h"
-#include "base/values.h"
#include "chrome/common/extensions/extension.h"
-#include "chrome/browser/ui/options/options_util.h"
-#include "chrome/installer/util/google_update_settings.h"
#include "content/browser/user_metrics.h"
using base::Histogram;
using base::LinearHistogram;
-namespace {
-
-// Build the full name of a metrics for the given extension.
-// For a non-component extension the metric name is made up of the unique name
-// within the extension followed by the extension's id. This keeps the metrics
-// from one extension unique from other extensions, as well as those metrics
-// from chrome itself.
-// For a component extension the metric name is used as is. There are not so
-// many of them and it is easy enough to prevent name clashes.
-std::string BuildMetricName(const std::string& name,
- const Extension* extension) {
- std::string full_name(name);
- if (extension->location() != Extension::COMPONENT)
- full_name += extension->id();
- return full_name;
-}
-
-} // anonymous namespace
-
-bool MetricsSetEnabledFunction::RunImpl() {
- bool enabled = false;
- EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(0, &enabled));
-
- // Using OptionsUtil is better because it actually ensures we reset all the
- // necessary threads. This is the main way for starting / stopping UMA and
- // crash reporting.
- // This method will return the resulting enabled, which we send to JS.
- bool result = OptionsUtil::ResolveMetricsReportingEnabled(enabled);
- result_.reset(Value::CreateBooleanValue(result));
- return true;
-}
-
-bool MetricsGetEnabledFunction::RunImpl() {
- bool enabled = GoogleUpdateSettings::GetCollectStatsConsent();
- result_.reset(Value::CreateBooleanValue(enabled));
- return true;
-}
-
bool MetricsRecordUserActionFunction::RunImpl() {
std::string name;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &name));
- name = BuildMetricName(name, GetExtension());
UserMetrics::RecordComputedAction(name);
return true;
}
@@ -74,16 +32,15 @@ bool MetricsHistogramHelperFunction::RecordValue(const std::string& name,
int max,
size_t buckets,
int sample) {
- std::string full_name = BuildMetricName(name, GetExtension());
Histogram* counter;
if (type == Histogram::LINEAR_HISTOGRAM) {
- counter = LinearHistogram::FactoryGet(full_name,
+ counter = LinearHistogram::FactoryGet(name,
min,
max,
buckets,
Histogram::kUmaTargetedHistogramFlag);
} else {
- counter = Histogram::FactoryGet(full_name,
+ counter = Histogram::FactoryGet(name,
min,
max,
buckets,
« no previous file with comments | « chrome/browser/extensions/extension_metrics_module.h ('k') | chrome/browser/resources/file_manager/js/metrics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698