| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/ui/webui/history/metrics_handler.h" | 5 #include "ios/chrome/browser/ui/webui/history/metrics_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/metrics/user_metrics.h" | 11 #include "base/metrics/user_metrics.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "ios/public/provider/web/web_ui_ios.h" | 14 #include "ios/web/public/webui/web_ui_ios.h" |
| 15 | 15 |
| 16 using base::ListValue; | 16 using base::ListValue; |
| 17 using base::UserMetricsAction; | 17 using base::UserMetricsAction; |
| 18 | 18 |
| 19 MetricsHandler::MetricsHandler() {} | 19 MetricsHandler::MetricsHandler() {} |
| 20 MetricsHandler::~MetricsHandler() {} | 20 MetricsHandler::~MetricsHandler() {} |
| 21 | 21 |
| 22 void MetricsHandler::RegisterMessages() { | 22 void MetricsHandler::RegisterMessages() { |
| 23 web_ui()->RegisterMessageCallback( | 23 web_ui()->RegisterMessageCallback( |
| 24 "metricsHandler:recordAction", | 24 "metricsHandler:recordAction", |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 bucket_count /= 10; | 57 bucket_count /= 10; |
| 58 } | 58 } |
| 59 | 59 |
| 60 // As |histogram_name| may change between calls, the UMA_HISTOGRAM_ENUMERATION | 60 // As |histogram_name| may change between calls, the UMA_HISTOGRAM_ENUMERATION |
| 61 // macro cannot be used here. | 61 // macro cannot be used here. |
| 62 base::HistogramBase* counter = base::LinearHistogram::FactoryGet( | 62 base::HistogramBase* counter = base::LinearHistogram::FactoryGet( |
| 63 histogram_name, 1, int_boundary_value, bucket_count + 1, | 63 histogram_name, 1, int_boundary_value, bucket_count + 1, |
| 64 base::HistogramBase::kUmaTargetedHistogramFlag); | 64 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 65 counter->Add(int_value); | 65 counter->Add(int_value); |
| 66 } | 66 } |
| OLD | NEW |