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

Unified Diff: ios/chrome/browser/ui/webui/history/metrics_handler.cc

Issue 2494853003: Remove some unused history resources on iOS (Closed)
Patch Set: add back URL constants 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
« no previous file with comments | « ios/chrome/browser/ui/webui/history/metrics_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/webui/history/metrics_handler.cc
diff --git a/ios/chrome/browser/ui/webui/history/metrics_handler.cc b/ios/chrome/browser/ui/webui/history/metrics_handler.cc
deleted file mode 100644
index bc54d7eaa4995f741f2dcc85d641a98f388a1d6c..0000000000000000000000000000000000000000
--- a/ios/chrome/browser/ui/webui/history/metrics_handler.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ios/chrome/browser/ui/webui/history/metrics_handler.h"
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/logging.h"
-#include "base/metrics/histogram.h"
-#include "base/metrics/user_metrics.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/values.h"
-#include "ios/web/public/webui/web_ui_ios.h"
-
-using base::ListValue;
-using base::UserMetricsAction;
-
-MetricsHandler::MetricsHandler() {}
-MetricsHandler::~MetricsHandler() {}
-
-void MetricsHandler::RegisterMessages() {
- web_ui()->RegisterMessageCallback(
- "metricsHandler:recordAction",
- base::Bind(&MetricsHandler::HandleRecordAction, base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "metricsHandler:recordInHistogram",
- base::Bind(&MetricsHandler::HandleRecordInHistogram,
- base::Unretained(this)));
-}
-
-void MetricsHandler::HandleRecordAction(const base::ListValue* args) {
- std::string string_action = base::UTF16ToUTF8(ExtractStringValue(args));
- base::RecordComputedAction(string_action);
-}
-
-void MetricsHandler::HandleRecordInHistogram(const base::ListValue* args) {
- std::string histogram_name;
- double value;
- double boundary_value;
- if (!args->GetString(0, &histogram_name) || !args->GetDouble(1, &value) ||
- !args->GetDouble(2, &boundary_value)) {
- NOTREACHED();
- return;
- }
-
- int int_value = static_cast<int>(value);
- int int_boundary_value = static_cast<int>(boundary_value);
- if (int_boundary_value >= 4000 || int_value > int_boundary_value ||
- int_value < 0) {
- NOTREACHED();
- return;
- }
-
- int bucket_count = int_boundary_value;
- while (bucket_count >= 100) {
- bucket_count /= 10;
- }
-
- // As |histogram_name| may change between calls, the UMA_HISTOGRAM_ENUMERATION
- // macro cannot be used here.
- base::HistogramBase* counter = base::LinearHistogram::FactoryGet(
- histogram_name, 1, int_boundary_value, bucket_count + 1,
- base::HistogramBase::kUmaTargetedHistogramFlag);
- counter->Add(int_value);
-}
« no previous file with comments | « ios/chrome/browser/ui/webui/history/metrics_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698