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

Unified Diff: chrome/browser/prefs/pref_metrics_service.cc

Issue 2006023002: Log some information about the state of the homepage on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: JNI doesn't support null strings :-/ Created 4 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/prefs/pref_metrics_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_metrics_service.cc
diff --git a/chrome/browser/prefs/pref_metrics_service.cc b/chrome/browser/prefs/pref_metrics_service.cc
index 54ee8505c59947eac378c7a6405f4ee6d2532bc2..32698bab5085b060ebbdd2cb468814a6a925a689 100644
--- a/chrome/browser/prefs/pref_metrics_service.cc
+++ b/chrome/browser/prefs/pref_metrics_service.cc
@@ -35,6 +35,7 @@ namespace {
const int kSessionStartupPrefValueMax = SessionStartupPref::kPrefValueMax;
+#if !defined(OS_ANDROID)
// Record a sample for the Settings.NewTabPage rappor metric.
void SampleNewTabPageURL(Profile* profile) {
GURL ntp_url(chrome::kChromeUINewTabURL);
@@ -48,6 +49,7 @@ void SampleNewTabPageURL(Profile* profile) {
"Settings.NewTabPage", ntp_url);
}
}
+#endif
} // namespace
@@ -78,13 +80,14 @@ PrefMetricsService::PrefMetricsService(Profile* profile,
PrefMetricsService::~PrefMetricsService() {
}
-void PrefMetricsService::RecordLaunchPrefs() {
- bool show_home_button = prefs_->GetBoolean(prefs::kShowHomeButton);
- bool home_page_is_ntp = prefs_->GetBoolean(prefs::kHomePageIsNewTabPage);
+// static
+void PrefMetricsService::RecordHomePageLaunchMetrics(bool show_home_button,
+ bool homepage_is_ntp,
+ const GURL& homepage_url) {
UMA_HISTOGRAM_BOOLEAN("Settings.ShowHomeButton", show_home_button);
if (show_home_button) {
UMA_HISTOGRAM_BOOLEAN("Settings.GivenShowHomeButton_HomePageIsNewTabPage",
- home_page_is_ntp);
+ homepage_is_ntp);
}
// For non-NTP homepages, see if the URL comes from the same TLD+1 as a known
@@ -94,8 +97,7 @@ void PrefMetricsService::RecordLaunchPrefs() {
// (pages that share a TLD+1 with a known engine but aren't actually search
// pages, e.g. plus.google.com). Additionally, record the TLD+1 of non-NTP
// homepages through the privacy-preserving Rappor service.
- if (!home_page_is_ntp) {
- GURL homepage_url(prefs_->GetString(prefs::kHomePage));
+ if (!homepage_is_ntp) {
if (homepage_url.is_valid()) {
UMA_HISTOGRAM_ENUMERATION(
"Settings.HomePageEngineType",
@@ -106,9 +108,28 @@ void PrefMetricsService::RecordLaunchPrefs() {
homepage_url);
}
}
+}
+void PrefMetricsService::RecordLaunchPrefs() {
+ // On Android, determining whether the homepage is enabled requires waiting
+ // for a response from a third party provider installed on the device. So,
+ // it will be logged later once all the dependent information is available.
+ // See DeferredStartupHandler.java.
+#if !defined(OS_ANDROID)
+ GURL homepage_url(prefs_->GetString(prefs::kHomePage));
+ RecordHomePageLaunchMetrics(prefs_->GetBoolean(prefs::kShowHomeButton),
+ prefs_->GetBoolean(prefs::kHomePageIsNewTabPage),
+ homepage_url);
+#endif
+
+ // Android does not support overriding the NTP URL.
+#if !defined(OS_ANDROID)
SampleNewTabPageURL(profile_);
+#endif
+ // Tab restoring is always done on Android, so these metrics are not
+ // applicable. Also, startup pages are not supported on Android
+#if !defined(OS_ANDROID)
int restore_on_startup = prefs_->GetInteger(prefs::kRestoreOnStartup);
UMA_HISTOGRAM_ENUMERATION("Settings.StartupPageLoadSettings",
restore_on_startup, kSessionStartupPrefValueMax);
@@ -136,7 +157,9 @@ void PrefMetricsService::RecordLaunchPrefs() {
}
}
}
+#endif
+ // Android does not support pinned tabs.
#if !defined(OS_ANDROID)
StartupTabs startup_tabs = PinnedTabCodec::ReadPinnedTabs(profile_);
UMA_HISTOGRAM_CUSTOM_COUNTS("Settings.PinnedTabs",
« no previous file with comments | « chrome/browser/prefs/pref_metrics_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698