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

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

Issue 14911005: Move instant support to SearchTabHelper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 7 years, 7 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') | chrome/browser/ui/search/instant_page.cc » ('J')
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 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;
}
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_page.h » ('j') | chrome/browser/ui/search/instant_page.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698