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

Unified Diff: chrome/browser/ui/browser_instant_controller.cc

Issue 12378025: Record InstantExtended pref setting on startup with an UMA histogram. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 | « no previous file | chrome/browser/ui/search/search.h » ('j') | chrome/browser/ui/search/search.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_instant_controller.cc
===================================================================
--- chrome/browser/ui/browser_instant_controller.cc (revision 185538)
+++ chrome/browser/ui/browser_instant_controller.cc (working copy)
@@ -39,6 +39,14 @@
prefs::kInstantExtendedEnabled : prefs::kInstantEnabled;
}
+// Returns the PrefsService to use for checking the Instant pref for the given
+// profile, or NULL if profile does not support instant.
+PrefService* GetPrefsForInstantEnabledCheck(Profile* profile) {
+ if (profile && !profile->IsOffTheRecord())
+ return profile->GetPrefs();
+ return NULL;
+}
+
} // namespace
namespace chrome {
@@ -64,6 +72,15 @@
ResetInstant();
browser_->search_model()->AddObserver(this);
+ if (chrome::search::IsInstantExtendedAPIEnabled(profile())) {
+ // Only record this for valid (e.g. non-incognito) profiles.
+ PrefService* prefs = GetPrefsForInstantEnabledCheck(profile());
+ if (prefs) {
+ const bool pref_value = prefs->GetBoolean(GetInstantPrefName(profile()));
+ chrome::search::RecordInstantExtendedPrefValue(pref_value);
+ }
+ }
+
#if defined(ENABLE_THEMES)
// Listen for theme installation.
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
@@ -77,8 +94,8 @@
}
bool BrowserInstantController::IsInstantEnabled(Profile* profile) {
- return profile && !profile->IsOffTheRecord() && profile->GetPrefs() &&
- profile->GetPrefs()->GetBoolean(GetInstantPrefName(profile));
+ PrefService* prefs = GetPrefsForInstantEnabledCheck(profile);
+ return prefs && prefs->GetBoolean(GetInstantPrefName(profile));
}
void BrowserInstantController::RegisterUserPrefs(
« no previous file with comments | « no previous file | chrome/browser/ui/search/search.h » ('j') | chrome/browser/ui/search/search.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698