| OLD | NEW |
| 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/ui/webui/metrics_handler.h" | 5 #include "chrome/browser/ui/webui/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/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/metrics/metric_event_duration_details.h" | 13 #include "chrome/browser/metrics/metric_event_duration_details.h" |
| 14 #include "chrome/browser/ui/webui/chrome_web_ui.h" | 14 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
| 15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 16 #include "content/browser/tab_contents/tab_contents.h" | 16 #include "content/browser/tab_contents/tab_contents.h" |
| 17 #include "content/browser/user_metrics.h" | 17 #include "content/browser/user_metrics.h" |
| 18 #include "content/common/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 19 | 19 |
| 20 using base::ListValue; | 20 using base::ListValue; |
| 21 | 21 |
| 22 MetricsHandler::MetricsHandler() {} | 22 MetricsHandler::MetricsHandler() {} |
| 23 MetricsHandler::~MetricsHandler() {} | 23 MetricsHandler::~MetricsHandler() {} |
| 24 | 24 |
| 25 void MetricsHandler::RegisterMessages() { | 25 void MetricsHandler::RegisterMessages() { |
| 26 web_ui_->RegisterMessageCallback( | 26 web_ui_->RegisterMessageCallback( |
| 27 "metricsHandler:recordAction", | 27 "metricsHandler:recordAction", |
| 28 base::Bind(&MetricsHandler::HandleRecordAction, base::Unretained(this))); | 28 base::Bind(&MetricsHandler::HandleRecordAction, base::Unretained(this))); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 UMA_HISTOGRAM_TIMES("Tab.NewTabScriptStart", duration); | 91 UMA_HISTOGRAM_TIMES("Tab.NewTabScriptStart", duration); |
| 92 } else if (event_name == "Tab.NewTabDOMContentLoaded") { | 92 } else if (event_name == "Tab.NewTabDOMContentLoaded") { |
| 93 UMA_HISTOGRAM_TIMES("Tab.NewTabDOMContentLoaded", duration); | 93 UMA_HISTOGRAM_TIMES("Tab.NewTabDOMContentLoaded", duration); |
| 94 } else if (event_name == "Tab.NewTabOnload") { | 94 } else if (event_name == "Tab.NewTabOnload") { |
| 95 UMA_HISTOGRAM_TIMES("Tab.NewTabOnload", duration); | 95 UMA_HISTOGRAM_TIMES("Tab.NewTabOnload", duration); |
| 96 // The new tab page has finished loading; reset it. | 96 // The new tab page has finished loading; reset it. |
| 97 tab->set_new_tab_start_time(base::TimeTicks()); | 97 tab->set_new_tab_start_time(base::TimeTicks()); |
| 98 } else { | 98 } else { |
| 99 NOTREACHED(); | 99 NOTREACHED(); |
| 100 } | 100 } |
| 101 NotificationService::current()->Notify( | 101 content::NotificationService::current()->Notify( |
| 102 chrome::NOTIFICATION_METRIC_EVENT_DURATION, | 102 chrome::NOTIFICATION_METRIC_EVENT_DURATION, |
| 103 content::Source<TabContents>(tab), | 103 content::Source<TabContents>(tab), |
| 104 content::Details<MetricEventDurationDetails>(&details)); | 104 content::Details<MetricEventDurationDetails>(&details)); |
| 105 } | 105 } |
| OLD | NEW |