Commit 8ea0f9f5 authored by Mark Pearson's avatar Mark Pearson Committed by Commit Bot

Adds Histogram to Count Uses of Home Button to non-Chrome Pages

i.e., allows counting of home button uses that lead to places
besides, say, the new tab page.

Right now all home button uses are logged as a user action "Home"
and it's a pain to try to figure out based on other UMA histograms
whether the home button leads to the new tab page or some web page.
This makes it easier.

Bug: 953445
Change-Id: I2ad455af3b6bd8884813186a1f54ebaa244b2c73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1609973Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Reviewed-by: default avatarPedro Amaral <amaralp@chromium.org>
Commit-Queue: Mark Pearson <mpearson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660058}
parent c7fe4eda
......@@ -113,6 +113,7 @@ import org.chromium.content_public.browser.NavigationEntry;
import org.chromium.content_public.browser.NavigationHandle;
import org.chromium.content_public.browser.UiThreadTaskTraits;
import org.chromium.content_public.browser.WebContents;
import org.chromium.content_public.common.ContentUrlConstants;
import org.chromium.ui.base.DeviceFormFactor;
import org.chromium.ui.base.PageTransition;
import org.chromium.ui.widget.Toast;
......@@ -1455,6 +1456,12 @@ public class ToolbarManager implements ScrimObserver, ToolbarTabController, UrlF
if (TextUtils.isEmpty(homePageUrl) || isNewTabPageButtonEnabled) {
homePageUrl = UrlConstants.NTP_URL;
}
boolean is_chrome_internal =
homePageUrl.startsWith(ContentUrlConstants.ABOUT_URL_SHORT_PREFIX)
|| homePageUrl.startsWith(UrlConstants.CHROME_URL_SHORT_PREFIX)
|| homePageUrl.startsWith(UrlConstants.CHROME_NATIVE_URL_SHORT_PREFIX);
RecordHistogram.recordBooleanHistogram(
"Navigation.Home.IsChromeInternal", is_chrome_internal);
if (isNewTabPageButtonEnabled) {
recordToolbarUseForIPH(EventConstants.CLEAR_TAB_BUTTON_CLICKED);
} else {
......
......@@ -9,6 +9,7 @@
#include <vector>
#include "base/command_line.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/strings/utf_string_conversions.h"
......@@ -61,6 +62,7 @@
#include "chrome/common/chrome_features.h"
#include "chrome/common/content_restriction.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/browser/bookmark_utils.h"
#include "components/bookmarks/common/bookmark_pref_names.h"
......@@ -96,6 +98,7 @@
#include "ui/base/clipboard/scoped_clipboard_writer.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "url/gurl.h"
#include "url/url_constants.h"
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/api/commands/command_service.h"
......@@ -533,6 +536,11 @@ void Home(Browser* browser, WindowOpenDisposition disposition) {
extensions::MaybeShowExtensionControlledHomeNotification(browser);
#endif
bool is_chrome_internal = url.SchemeIs(url::kAboutScheme) ||
url.SchemeIs(content::kChromeUIScheme) ||
url.SchemeIs(chrome::kChromeNativeScheme);
base::UmaHistogramBoolean("Navigation.Home.IsChromeInternal",
is_chrome_internal);
OpenURLParams params(
url, Referrer(), disposition,
ui::PageTransitionFromInt(ui::PAGE_TRANSITION_AUTO_BOOKMARK |
......
......@@ -62428,6 +62428,19 @@ uploading your change for review.
</summary>
</histogram>
<histogram name="Navigation.Home.IsChromeInternal" enum="Boolean"
expires_after="2020-05-08">
<owner>mpearson@chromium.org</owner>
<owner>amaralp@chromium.org</owner>
<summary>
Emitted every time a user uses a Home button to go to their home page.
Records whether the page is chrome-internal (most likely the New Tab Page or
about:blank) or not (most likely an actual web site). For the purpose of
this histogram, about:, chrome: and chrome-native: are considered
chrome-internal; everything else is not.
</summary>
</histogram>
<histogram name="Navigation.Intercept.Ignored" enum="Boolean">
<owner>csharrison@chromium.org</owner>
<summary>
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