From 4c1b035dd362ef394df78a5abdb46c6242d22fc4 Mon Sep 17 00:00:00 2001 From: "sky@chromium.org" Date: Fri, 10 Dec 2010 02:32:23 +0000 Subject: Fixes bug where we would show an instant preview when we thought the search engine supported instant but it doesn't. BUG=66133 TEST=covered by interactive ui test. You can also manually test Review URL: http://codereview.chromium.org/5771001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68816 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/instant/instant_controller.cc | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'chrome/browser/instant/instant_controller.cc') diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc index 4e58b8f..c2e8ab6 100644 --- a/chrome/browser/instant/instant_controller.cc +++ b/chrome/browser/instant/instant_controller.cc @@ -371,29 +371,27 @@ void InstantController::CommitInstantLoader(InstantLoader* loader) { } void InstantController::InstantLoaderDoesntSupportInstant( - InstantLoader* loader, - bool needs_reload, - const GURL& url_to_load) { + InstantLoader* loader) { DCHECK(!loader->ready()); // We better not be showing this loader. DCHECK(loader->template_url_id()); + VLOG(1) << " provider does not support instant"; + + // Don't attempt to use instant for this search engine again. BlacklistFromInstant(loader->template_url_id()); if (loader_manager_->active_loader() == loader) { - // The loader is active. Continue to use it, but make sure it isn't tied to - // to the search engine anymore. ClearTemplateURLID ends up showing the - // loader. - loader_manager_->RemoveLoaderFromInstant(loader); - loader->ClearTemplateURLID(); - - if (needs_reload) { - string16 suggested_text; - loader->Update(tab_contents_, 0, url_to_load, last_transition_type_, - loader->user_text(), false, &suggested_text); - } + // The loader is active, shut down instant. + DestroyPreviewContents(); } else { + if (loader_manager_->current_loader() == loader && is_active_) { + // There is a pending loader and we're active. Hide the preview. When then + // pending loader finishes loading we'll notify the delegate to show. + DCHECK(loader_manager_->pending_loader()); + is_active_ = false; + delegate_->HideInstant(); + } loader_manager_->DestroyLoader(loader); - loader = NULL; } } -- cgit v1.1