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; |
} |