diff options
author | shishir@chromium.org <shishir@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-07 04:55:59 +0000 |
---|---|---|
committer | shishir@chromium.org <shishir@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-07 04:55:59 +0000 |
commit | 411c9c04ef6059c27ebf6dc8872b0aaba5733e9a (patch) | |
tree | 23d50e8236f658ba866d8602a3c4dac0e33dee92 /chrome/browser/ui/browser_instant_controller.cc | |
parent | c6b94c384107f67d826cfaf67c86e75c877b957d (diff) | |
download | chromium_src-411c9c04ef6059c27ebf6dc8872b0aaba5733e9a.zip chromium_src-411c9c04ef6059c27ebf6dc8872b0aaba5733e9a.tar.gz chromium_src-411c9c04ef6059c27ebf6dc8872b0aaba5733e9a.tar.bz2 |
Instant Extended should respect the search prediction pref.
BUG=165903
Review URL: https://chromiumcodereview.appspot.com/12225021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181210 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_instant_controller.cc')
-rw-r--r-- | chrome/browser/ui/browser_instant_controller.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc index 4118de5..49d93da 100644 --- a/chrome/browser/ui/browser_instant_controller.cc +++ b/chrome/browser/ui/browser_instant_controller.cc @@ -39,8 +39,7 @@ namespace chrome { BrowserInstantController::BrowserInstantController(Browser* browser) : browser_(browser), instant_(ALLOW_THIS_IN_INITIALIZER_LIST(this), - chrome::search::IsInstantExtendedAPIEnabled(browser->profile()), - browser->profile()->IsOffTheRecord()), + chrome::search::IsInstantExtendedAPIEnabled(browser->profile())), instant_unload_handler_(browser), initialized_theme_info_(false), theme_area_height_(0) { @@ -49,6 +48,10 @@ BrowserInstantController::BrowserInstantController(Browser* browser) GetInstantPrefName(browser_->profile()), base::Bind(&BrowserInstantController::ResetInstant, base::Unretained(this))); + profile_pref_registrar_.Add( + prefs::kSearchSuggestEnabled, + base::Bind(&BrowserInstantController::ResetInstant, + base::Unretained(this))); ResetInstant(); browser_->search_model()->AddObserver(this); @@ -197,7 +200,13 @@ void BrowserInstantController::SetMarginSize(int start, int end) { } void BrowserInstantController::ResetInstant() { - instant_.SetInstantEnabled(IsInstantEnabled(browser_->profile())); + Profile* profile = browser_->profile(); + + bool instant_enabled = IsInstantEnabled(profile); + bool use_local_preview_only = profile->IsOffTheRecord() || + (!instant_enabled && + !profile->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled)); + instant_.SetInstantEnabled(instant_enabled, use_local_preview_only); } //////////////////////////////////////////////////////////////////////////////// |