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

Unified Diff: chrome/browser/extensions/api/metrics_private/metrics_private_api.cc

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 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/api/metrics_private/metrics_private_api.cc
diff --git a/extensions/browser/api/metrics_private/metrics_private_api.cc b/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc
similarity index 89%
copy from extensions/browser/api/metrics_private/metrics_private_api.cc
copy to chrome/browser/extensions/api/metrics_private/metrics_private_api.cc
index 8f62bc9664f03c9bba453091e3bc673340386889..b47d6879f3426e4775ff60422f21b4d2f7b27885 100644
--- a/extensions/browser/api/metrics_private/metrics_private_api.cc
+++ b/chrome/browser/extensions/api/metrics_private/metrics_private_api.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/browser/api/metrics_private/metrics_private_api.h"
+#include "chrome/browser/extensions/api/metrics_private/metrics_private_api.h"
#include <limits.h>
@@ -12,15 +12,18 @@
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
+#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
+#include "chrome/common/extensions/api/metrics_private.h"
#include "components/variations/variations_associated_data.h"
#include "content/public/browser/user_metrics.h"
-#include "extensions/browser/api/extensions_api_client.h"
-#include "extensions/browser/api/metrics_private/metrics_private_delegate.h"
-#include "extensions/common/api/metrics_private.h"
+#include "extensions/common/extension.h"
namespace extensions {
+namespace GetIsCrashReportingEnabled =
+ api::metrics_private::GetIsCrashReportingEnabled;
namespace GetVariationParams = api::metrics_private::GetVariationParams;
+namespace GetFieldTrial = api::metrics_private::GetFieldTrial;
namespace RecordUserAction = api::metrics_private::RecordUserAction;
namespace RecordValue = api::metrics_private::RecordValue;
namespace RecordSparseValue = api::metrics_private::RecordSparseValue;
@@ -34,18 +37,15 @@ namespace RecordLongTime = api::metrics_private::RecordLongTime;
namespace {
-const size_t kMaxBuckets = 10000; // We don't ever want more than these many
- // buckets; there is no real need for them
- // and would cause crazy memory usage
-} // namespace
+const size_t kMaxBuckets = 10000; // We don't ever want more than these many
+ // buckets; there is no real need for them
+ // and would cause crazy memory usage
+} // namespace
ExtensionFunction::ResponseAction
MetricsPrivateGetIsCrashReportingEnabledFunction::Run() {
- MetricsPrivateDelegate* delegate =
- ExtensionsAPIClient::Get()->GetMetricsPrivateDelegate();
-
- return RespondNow(OneArgument(base::MakeUnique<base::FundamentalValue>(
- delegate && delegate->IsCrashReportingEnabled())));
+ return RespondNow(OneArgument(base::MakeUnique<base::Value>(
+ ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled())));
}
ExtensionFunction::ResponseAction MetricsPrivateGetFieldTrialFunction::Run() {
@@ -125,8 +125,8 @@ ExtensionFunction::ResponseAction MetricsPrivateRecordValueFunction::Run() {
// Get the histogram parameters from the metric type object.
std::string type = api::metrics_private::ToString(params->metric.type);
- base::HistogramType histogram_type(
- type == "histogram-linear" ? base::LINEAR_HISTOGRAM : base::HISTOGRAM);
+ base::HistogramType histogram_type(type == "histogram-linear" ?
+ base::LINEAR_HISTOGRAM : base::HISTOGRAM);
RecordValue(params->metric.metric_name, histogram_type, params->metric.min,
params->metric.max, params->metric.buckets, params->value);
return RespondNow(NoArguments());
@@ -212,4 +212,4 @@ ExtensionFunction::ResponseAction MetricsPrivateRecordLongTimeFunction::Run() {
return RespondNow(NoArguments());
}
-} // namespace extensions
+} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/api/media_galleries/media_galleries_api.cc ('k') | chrome/browser/extensions/api/module/module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698