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

Unified Diff: chrome/browser/ui/webui/ntp/new_tab_page_handler.cc

Issue 1151563005: Revert of NTP Zombie Code Slayer Part IV: Most Visited (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/ui/webui/ntp/new_tab_page_handler.h ('k') | chrome/browser/ui/webui/ntp/new_tab_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc b/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
index a07e34075898c0fbd1c7cdc8adca66d561239a1f..d908496a065f3ef0aa00ff5d2b9cbd801896eb3f 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
@@ -67,6 +67,9 @@
base::Unretained(this)));
web_ui()->RegisterMessageCallback("pageSelected",
base::Bind(&NewTabPageHandler::HandlePageSelected,
+ base::Unretained(this)));
+ web_ui()->RegisterMessageCallback("logTimeToClick",
+ base::Bind(&NewTabPageHandler::HandleLogTimeToClick,
base::Unretained(this)));
}
@@ -140,6 +143,26 @@
shown_page_type, kHistogramEnumerationMax);
}
+void NewTabPageHandler::HandleLogTimeToClick(const base::ListValue* args) {
+ std::string histogram_name;
+ double duration;
+ if (!args->GetString(0, &histogram_name) || !args->GetDouble(1, &duration)) {
+ NOTREACHED();
+ return;
+ }
+
+ base::TimeDelta delta = base::TimeDelta::FromMilliseconds(duration);
+
+ if (histogram_name == "NewTabPage.TimeToClickMostVisited") {
+ UMA_HISTOGRAM_LONG_TIMES("NewTabPage.TimeToClickMostVisited", delta);
+ } else if (histogram_name == "ExtendedNewTabPage.TimeToClickMostVisited") {
+ UMA_HISTOGRAM_LONG_TIMES(
+ "ExtendedNewTabPage.TimeToClickMostVisited", delta);
+ } else {
+ NOTREACHED();
+ }
+}
+
// static
void NewTabPageHandler::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
@@ -150,6 +173,7 @@
// static
void NewTabPageHandler::GetLocalizedValues(Profile* profile,
base::DictionaryValue* values) {
+ values->SetInteger("most_visited_page_id", MOST_VISITED_PAGE_ID);
values->SetInteger("apps_page_id", APPS_PAGE_ID);
PrefService* prefs = profile->GetPrefs();
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_page_handler.h ('k') | chrome/browser/ui/webui/ntp/new_tab_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698