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

Unified Diff: chrome/browser/ui/search/instant_controller.cc

Issue 14608004: Move instant support to SearchTabHelper. Fix InstantTab reset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Guard instant-extended-only bits. Created 7 years, 8 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/instant_page.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e721a26e45e908da47226ad37f3c128f8caf0cf6..44d9ee2b2dca4990ca840c21204e6c4927d54b9e 100644
--- a/chrome/browser/ui/search/instant_controller.cc
+++ b/chrome/browser/ui/search/instant_controller.cc
@@ -1452,18 +1452,23 @@ void InstantController::ResetInstantTab() {
if (!instant_tab_ || active_tab != instant_tab_->contents()) {
instant_tab_.reset(new InstantTab(this));
instant_tab_->Init(active_tab);
- // Update theme info for this tab.
- browser_->UpdateThemeInfo();
- instant_tab_->SetDisplayInstantResults(instant_enabled_);
- instant_tab_->SetOmniboxBounds(omnibox_bounds_);
- instant_tab_->InitializeFonts();
- StartListeningToMostVisitedChanges();
- instant_tab_->KeyCaptureChanged(
- omnibox_focus_state_ == OMNIBOX_FOCUS_INVISIBLE);
+ // Note that |instant_tab_| may have gotten reset in Init() if it's
+ // already known to not support instant.
+ if (instant_tab_) {
+ // Update theme info for this tab.
+ browser_->UpdateThemeInfo();
+ instant_tab_->SetDisplayInstantResults(instant_enabled_);
+ instant_tab_->SetOmniboxBounds(omnibox_bounds_);
+ instant_tab_->InitializeFonts();
+ StartListeningToMostVisitedChanges();
+ instant_tab_->KeyCaptureChanged(
+ omnibox_focus_state_ == OMNIBOX_FOCUS_INVISIBLE);
+ }
}
// Hide the |overlay_| since we are now using |instant_tab_| instead.
- HideOverlay();
+ if (instant_tab_)
+ HideOverlay();
} else {
instant_tab_.reset();
}
@@ -1489,6 +1494,10 @@ void InstantController::HideInternal() {
overlay_->Update(string16(), 0, 0, true);
}
+ // Now that the overlay is hidden, try |instant_tab_| again.
+ if (!instant_tab_)
+ ResetInstantTab();
+
// Clear the first interaction timestamp for later use.
first_interaction_time_ = base::Time();
}
@@ -1509,6 +1518,11 @@ void InstantController::ShowOverlay(int height, InstantSizeUnits units) {
// HideOverlay()) so that it can change its mind.
if (height == 0) {
model_.SetOverlayState(SearchMode(), 0, INSTANT_SIZE_PERCENT);
+
+ // Now that the overlay is hidden, try |instant_tab_| again.
+ if (!instant_tab_)
+ ResetInstantTab();
+
return;
}
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698