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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_NAVIGATION_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_NAVIGATION_HANDLER_H_
8 #include "base/compiler_specific.h"
9 #include "content/public/browser/navigation_entry.h"
10 #include "content/public/browser/web_ui_message_handler.h"
16 // Records a UMA stat ("NewTabPage.ActionAndroid") for the action the user takes
17 // to navigate away from the NTP.
18 class NavigationHandler
: public content::WebUIMessageHandler
{
21 virtual ~NavigationHandler();
23 // WebUIMessageHandler implementation.
24 virtual void RegisterMessages() OVERRIDE
;
26 // Callback for "openedMostVisited".
27 void HandleOpenedMostVisited(const base::ListValue
* args
);
29 // Callback for "openedRecentlyClosed".
30 void HandleOpenedRecentlyClosed(const base::ListValue
* args
);
32 // Callback for "openedBookmark".
33 void HandleOpenedBookmark(const base::ListValue
* args
);
35 // Callback for "openedForeignSession".
36 void HandleOpenedForeignSession(const base::ListValue
* args
);
38 static void RecordActionForNavigation(const content::NavigationEntry
& entry
);
41 // Possible actions taken by the user on the NTP. This enum is also defined in
42 // histograms.xml. WARNING: these values must stay in sync with histograms.xml
43 // and new actions can be added only at the end of the enum.
45 // User performed a search using the omnibox
46 ACTION_SEARCHED_USING_OMNIBOX
= 0,
47 // User navigated to Google search homepage using the omnibox
48 ACTION_NAVIGATED_TO_GOOGLE_HOMEPAGE
= 1,
49 // User navigated to any other page using the omnibox
50 ACTION_NAVIGATED_USING_OMNIBOX
= 2,
51 // User opened a most visited page
52 ACTION_OPENED_MOST_VISITED_ENTRY
= 3,
53 // User opened a recently closed tab
54 ACTION_OPENED_RECENTLY_CLOSED_ENTRY
= 4,
55 // User opened a bookmark
56 ACTION_OPENED_BOOKMARK
= 5,
57 // User opened a foreign session (from other devices section)
58 ACTION_OPENED_FOREIGN_SESSION
= 6,
59 // The number of possible actions
63 static void RecordAction(Action action
);
65 DISALLOW_COPY_AND_ASSIGN(NavigationHandler
);
68 #endif // CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_NAVIGATION_HANDLER_H_