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 02ba4d3c6a367e313050d415e01b35bf01b8838f..c2bab79753c3dfdf4803907c10588272e4f1968f 100644 |
--- a/chrome/browser/ui/search/instant_controller.cc |
+++ b/chrome/browser/ui/search/instant_controller.cc |
@@ -971,7 +971,9 @@ void InstantController::SearchModeChanged(const SearchMode& old_mode, |
if (!new_mode.is_search_suggestions()) |
HideOverlay(); |
- ResetInstantTab(); |
+ // Now that the overlay is hidden, try |instant_tab_| again. |
samarth
2013/05/08 02:38:48
Let's take out all the instant tab resetting logic
kmadhusu
2013/05/09 02:40:40
Done.
|
+ if (!instant_tab_) |
+ ResetInstantTab(); |
} |
void InstantController::ActiveTabChanged() { |
@@ -1523,12 +1525,20 @@ void InstantController::ResetInstantTab() { |
if (!instant_tab_ || active_tab != instant_tab_->contents()) { |
instant_tab_.reset(new InstantTab(this)); |
instant_tab_->Init(active_tab); |
- UpdateInfoForInstantTab(); |
- use_tab_for_suggestions_ = true; |
+ // Note that |instant_tab_| may have gotten reset in Init() if it's |
+ // already known to not support instant. |
+ if (instant_tab_) { |
+ UpdateInfoForInstantTab(); |
+ use_tab_for_suggestions_ = true; |
+ } else { |
+ use_tab_for_suggestions_ = false; |
+ } |
} |
- // Hide the |overlay_| since we are now using |instant_tab_| instead. |
- HideOverlay(); |
+ if (instant_tab_) { |
+ // Hide the |overlay_| since we are now using |instant_tab_| instead. |
+ HideOverlay(); |
+ } |
} else { |
instant_tab_.reset(); |
} |
@@ -1589,8 +1599,12 @@ 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); |
- if (instant_tab_) |
+ if (instant_tab_) { |
use_tab_for_suggestions_ = true; |
+ } else { |
+ // Now that the overlay is hidden, try |instant_tab_| again. |
+ ResetInstantTab(); |
+ } |
return; |
} |