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

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

Issue 17444007: Revert 207790 "InstantExtended: Don't create overlay, again." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 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
Index: trunk/src/chrome/browser/ui/search/instant_controller.cc
===================================================================
--- trunk/src/chrome/browser/ui/search/instant_controller.cc (revision 207797)
+++ trunk/src/chrome/browser/ui/search/instant_controller.cc (working copy)
@@ -433,7 +433,7 @@
if (UseTabForSuggestions()) {
// On a search results page, tell it to clear old results.
instant_tab_->Update(string16(), 0, 0, true);
- } else if (overlay_ && search_mode_.is_origin_ntp()) {
+ } else if (search_mode_.is_origin_ntp()) {
// On the NTP, tell the overlay to clear old results. Don't hide the
// overlay so it can show a blank page or logo if it wants.
overlay_->Update(string16(), 0, 0, true);
@@ -461,7 +461,7 @@
last_suggestion_ = InstantSuggestion();
if (UseTabForSuggestions())
instant_tab_->Update(string16(), 0, 0, true);
- else if (overlay_ && search_mode_.is_origin_ntp())
+ else if (search_mode_.is_origin_ntp())
overlay_->Update(string16(), 0, 0, true);
else
HideOverlay();
@@ -517,7 +517,7 @@
if (UseTabForSuggestions()) {
instant_tab_->Update(user_text, selection_start, selection_end, verbatim);
- } else if (overlay_) {
+ } else {
allow_overlay_to_show_search_suggestions_ = true;
overlay_->Update(extended_enabled() ? user_text : full_text,
@@ -671,7 +671,7 @@
if (UseTabForSuggestions())
instant_tab_->SendAutocompleteResults(results);
- else if (overlay_)
+ else
overlay_->SendAutocompleteResults(results);
content::NotificationService::current()->Notify(
@@ -707,7 +707,7 @@
if (UseTabForSuggestions())
instant_tab_->UpOrDownKeyPressed(count);
- else if (overlay_)
+ else
overlay_->UpOrDownKeyPressed(count);
return true;
@@ -737,7 +737,7 @@
if (UseTabForSuggestions()) {
instant_tab_->CancelSelection(user_text, full_text.size(), user_text.size(),
last_verbatim_);
- } else if (overlay_) {
+ } else {
overlay_->CancelSelection(user_text, full_text.size(), user_text.size(),
last_verbatim_);
}
@@ -850,9 +850,6 @@
return false;
}
- if (!overlay_)
- return false;
-
// If the overlay is not showing at all, don't commit it.
if (!model_.mode().is_search_suggestions())
return false;
@@ -1126,7 +1123,7 @@
}
void InstantController::OverlayLoadCompletedMainFrame() {
- if (!overlay_ || overlay_->supports_instant())
+ if (overlay_->supports_instant())
return;
InstantService* instant_service =
InstantServiceFactory::GetForProfile(browser_->profile());
@@ -1635,7 +1632,16 @@
void InstantController::ResetOverlay(const std::string& instant_url) {
HideInternal();
- overlay_.reset();
+ // If there's no active tab, the browser is opening or closing.
+ const content::WebContents* active_tab = browser_->GetActiveWebContents();
+ if (!active_tab || instant_url.empty()) {
+ overlay_.reset();
+ } else {
+ overlay_.reset(new InstantOverlay(this, instant_url));
+ overlay_->InitContents(browser_->profile(), active_tab);
+ }
+ LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf(
+ "ResetOverlay: instant_url='%s'", instant_url.c_str()));
}
InstantController::InstantFallbackReason
@@ -1727,10 +1733,6 @@
}
void InstantController::ShowOverlay(int height, InstantSizeUnits units) {
- // Nothing to see here.
- if (!overlay_)
- return;
-
// If we are on a committed search results page, the |overlay_| is not in use.
if (UseTabForSuggestions())
return;

Powered by Google App Engine
This is Rietveld 408576698