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

Side by Side Diff: chrome/browser/ui/webui/ntp/android/navigation_handler.cc

Issue 256763004: Remove WebUI NTP on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: newt's nits Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/ntp/android/navigation_handler.h"
6
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "base/metrics/histogram.h"
10 #include "base/values.h"
11 #include "chrome/browser/google/google_util.h"
12 #include "chrome/common/url_constants.h"
13 #include "content/public/browser/navigation_entry.h"
14 #include "content/public/browser/user_metrics.h"
15 #include "content/public/browser/web_contents.h"
16 #include "content/public/browser/web_ui.h"
17 #include "content/public/common/page_transition_types.h"
18
19 using base::UserMetricsAction;
20
21 NavigationHandler::NavigationHandler() {}
22
23 NavigationHandler::~NavigationHandler() {}
24
25 void NavigationHandler::RegisterMessages() {
26 web_ui()->RegisterMessageCallback(
27 "openedMostVisited",
28 base::Bind(&NavigationHandler::HandleOpenedMostVisited,
29 base::Unretained(this)));
30 web_ui()->RegisterMessageCallback(
31 "openedRecentlyClosed",
32 base::Bind(&NavigationHandler::HandleOpenedRecentlyClosed,
33 base::Unretained(this)));
34 web_ui()->RegisterMessageCallback(
35 "openedBookmark",
36 base::Bind(&NavigationHandler::HandleOpenedBookmark,
37 base::Unretained(this)));
38 web_ui()->RegisterMessageCallback(
39 "openedForeignSession",
40 base::Bind(&NavigationHandler::HandleOpenedForeignSession,
41 base::Unretained(this)));
42 }
43
44 void NavigationHandler::HandleOpenedMostVisited(const base::ListValue* args) {
45 content::RecordAction(UserMetricsAction("MobileNTPMostVisited"));
46 RecordAction(ACTION_OPENED_MOST_VISITED_ENTRY);
47 }
48
49 void NavigationHandler::HandleOpenedRecentlyClosed(
50 const base::ListValue* args) {
51 content::RecordAction(UserMetricsAction("MobileNTPRecentlyClosed"));
52 RecordAction(ACTION_OPENED_RECENTLY_CLOSED_ENTRY);
53 }
54
55 void NavigationHandler::HandleOpenedBookmark(const base::ListValue* args) {
56 content::RecordAction(UserMetricsAction("MobileNTPBookmark"));
57 RecordAction(ACTION_OPENED_BOOKMARK);
58 }
59
60 void NavigationHandler::HandleOpenedForeignSession(
61 const base::ListValue* args) {
62 content::RecordAction(UserMetricsAction("MobileNTPForeignSession"));
63 RecordAction(ACTION_OPENED_FOREIGN_SESSION);
64 }
65
66 // static
67 void NavigationHandler::RecordAction(Action action) {
68 UMA_HISTOGRAM_ENUMERATION("NewTabPage.ActionAndroid", action, NUM_ACTIONS);
69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698