Commit 47ebce48 authored by newt@chromium.org's avatar newt@chromium.org

Update UMA stat code for Android NTP.

BUG=243013

Review URL: https://chromiumcodereview.appspot.com/23537017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221323 0039d316-1c4b-4281-b951-d872f2087c98
parent b845301d
......@@ -35,16 +35,7 @@ NavigationHandler::~NavigationHandler() {
return;
}
Action action;
if ((entry->GetTransitionType() & content::PAGE_TRANSITION_CORE_MASK) ==
content::PAGE_TRANSITION_GENERATED) {
action = ACTION_SEARCHED_USING_OMNIBOX;
} else if (google_util::IsGoogleHomePageUrl(entry->GetURL())) {
action = ACTION_NAVIGATED_TO_GOOGLE_HOMEPAGE;
} else {
action = ACTION_NAVIGATED_USING_OMNIBOX;
}
RecordAction(action);
RecordActionForNavigation(*entry);
}
void NavigationHandler::RegisterMessages() {
......@@ -84,6 +75,22 @@ void NavigationHandler::HandleOpenedForeignSession(
RecordAction(ACTION_OPENED_FOREIGN_SESSION);
}
// static
void NavigationHandler::RecordActionForNavigation(
const content::NavigationEntry& entry) {
Action action;
if ((entry.GetTransitionType() & content::PAGE_TRANSITION_CORE_MASK) ==
content::PAGE_TRANSITION_GENERATED) {
action = ACTION_SEARCHED_USING_OMNIBOX;
} else if (google_util::IsGoogleHomePageUrl(entry.GetURL())) {
action = ACTION_NAVIGATED_TO_GOOGLE_HOMEPAGE;
} else {
action = ACTION_NAVIGATED_USING_OMNIBOX;
}
RecordAction(action);
}
// static
void NavigationHandler::RecordAction(Action action) {
UMA_HISTOGRAM_ENUMERATION("NewTabPage.ActionAndroid", action, NUM_ACTIONS);
}
......@@ -6,6 +6,7 @@
#define CHROME_BROWSER_UI_WEBUI_NTP_ANDROID_NAVIGATION_HANDLER_H_
#include "base/compiler_specific.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_ui_message_handler.h"
namespace base {
......@@ -34,6 +35,8 @@ class NavigationHandler : public content::WebUIMessageHandler {
// Callback for "openedForeignSession".
void HandleOpenedForeignSession(const base::ListValue* args);
static void RecordActionForNavigation(const content::NavigationEntry& entry);
private:
// Possible actions taken by the user on the NTP. This enum is also defined in
// histograms.xml. WARNING: these values must stay in sync with histograms.xml
......@@ -57,7 +60,7 @@ class NavigationHandler : public content::WebUIMessageHandler {
NUM_ACTIONS = 7
};
void RecordAction(Action action);
static void RecordAction(Action action);
DISALLOW_COPY_AND_ASSIGN(NavigationHandler);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment