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

Unified Diff: chrome/browser/dom_ui/new_tab_ui.cc

Issue 242107: Add histograms that track how long it takes to open the new tab page. (Closed)
Patch Set: comments Created 11 years, 3 months 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 | « chrome/browser/browser.cc ('k') | chrome/browser/resources/new_new_tab.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/new_tab_ui.cc
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index 2e44322a1952eabdd125ed12dbf4705e9f274eb7..688377ff0baea851e51f479e937d3eac125a6157 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -1546,6 +1546,9 @@ class MetricsHandler : public DOMMessageHandler {
// Callback which records a user action.
void HandleMetrics(const Value* content);
+ // Callback for the "logEventTime" message.
+ void HandleLogEventTime(const Value* content);
+
private:
DISALLOW_COPY_AND_ASSIGN(MetricsHandler);
@@ -1554,6 +1557,9 @@ class MetricsHandler : public DOMMessageHandler {
void MetricsHandler::RegisterMessages() {
dom_ui_->RegisterMessageCallback("metrics",
NewCallback(this, &MetricsHandler::HandleMetrics));
+
+ dom_ui_->RegisterMessageCallback("logEventTime",
+ NewCallback(this, &MetricsHandler::HandleLogEventTime));
}
void MetricsHandler::HandleMetrics(const Value* content) {
@@ -1572,6 +1578,20 @@ void MetricsHandler::HandleMetrics(const Value* content) {
}
}
+void MetricsHandler::HandleLogEventTime(const Value* content) {
+ if (content && content->GetType() == Value::TYPE_LIST) {
+ const ListValue* list_value = static_cast<const ListValue*>(content);
+ Value* list_member;
+ if (list_value->Get(0, &list_member) &&
+ list_member->GetType() == Value::TYPE_STRING) {
+ std::string event_name;
+ if (list_member->GetAsString(&event_name)) {
+ dom_ui_->tab_contents()->LogNewTabTime(event_name);
+ }
+ }
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// NewTabPageSetHomepageHandler
« no previous file with comments | « chrome/browser/browser.cc ('k') | chrome/browser/resources/new_new_tab.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698