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( |