Chromium Code Reviews| Index: chrome/browser/ui/search/instant_controller.cc |
| diff --git a/chrome/browser/ui/search/instant_controller.cc b/chrome/browser/ui/search/instant_controller.cc |
| index 30676a536105ed61d4b161eac4ae7ccb088a0930..d286f38bca4280b30a6b8b2847ae1c7f51edf141 100644 |
| --- a/chrome/browser/ui/search/instant_controller.cc |
| +++ b/chrome/browser/ui/search/instant_controller.cc |
| @@ -220,7 +220,7 @@ InstantController::InstantController(BrowserInstantController* browser, |
| : browser_(browser), |
| extended_enabled_(extended_enabled), |
| instant_enabled_(false), |
| - use_local_overlay_only_(true), |
| + use_local_page_only_(true), |
| model_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| last_omnibox_text_has_inline_autocompletion_(false), |
| last_verbatim_(false), |
| @@ -504,8 +504,11 @@ scoped_ptr<content::WebContents> InstantController::ReleaseNTPContents() { |
| scoped_ptr<content::WebContents> ntp_contents = ntp_->ReleaseContents(); |
| - // Override the blacklist on an explicit user action. |
| - ResetNTP(true, false); |
| + if (!use_local_page_only_) { |
| + // Don't preload the local NTP. Override the blacklist on an explicit user |
|
Jered
2013/04/17 22:42:06
How about:
// Preload a new Instant NTP for the ne
Jered
2013/04/17 22:42:06
Update the comment to explain why the blacklist is
samarth
2013/04/17 23:28:15
Done.
samarth
2013/04/17 23:28:15
Done. How does this sound?
|
| + // action. |
| + ResetNTP(true, false); |
| + } |
| return ntp_contents.Pass(); |
| } |
| @@ -887,26 +890,31 @@ void InstantController::TabDeactivated(content::WebContents* contents) { |
| } |
| void InstantController::SetInstantEnabled(bool instant_enabled, |
| - bool use_local_overlay_only) { |
| + bool use_local_page_only) { |
| LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( |
| - "SetInstantEnabled: instant_enabled=%d, use_local_overlay_only=%d", |
| - instant_enabled, use_local_overlay_only)); |
| + "SetInstantEnabled: instant_enabled=%d, use_local_page_only=%d", |
| + instant_enabled, use_local_page_only)); |
| - // Non extended mode does not care about |use_local_overlay_only|. |
| + // Non extended mode does not care about |use_local_page_only|. |
| if (instant_enabled == instant_enabled_ && |
| (!extended_enabled_ || |
| - use_local_overlay_only == use_local_overlay_only_)) { |
| + use_local_page_only == use_local_page_only_)) { |
| return; |
| } |
| instant_enabled_ = instant_enabled; |
| - use_local_overlay_only_ = use_local_overlay_only; |
| + use_local_page_only_ = use_local_page_only; |
| HideInternal(); |
| overlay_.reset(); |
| if (extended_enabled_ || instant_enabled_) |
| EnsureOverlayIsCurrent(false); |
| - if (extended_enabled_) |
| - ResetNTP(false, false); |
| + if (extended_enabled_) { |
| + // Preload the Instant NTP unless we are using the local NTP. |
|
Jered
2013/04/17 22:42:06
Why not? Why do we want to reset it otherwise?
samarth
2013/04/17 23:28:15
Done.
|
| + if (use_local_page_only_) |
| + ntp_.reset(); |
| + else |
| + ResetNTP(false, false); |
| + } |
| if (instant_tab_) |
| instant_tab_->SetDisplayInstantResults(instant_enabled_); |
| } |
| @@ -1449,7 +1457,7 @@ void InstantController::SendPopupBoundsToPage() { |
| bool InstantController::GetInstantURL(Profile* profile, |
| bool ignore_blacklist, |
| std::string* instant_url) const { |
| - if (extended_enabled_ && use_local_overlay_only_) |
| + if (extended_enabled_ && use_local_page_only_) |
| return false; |
| const GURL instant_url_obj = chrome::GetInstantURL(profile, |