diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 18:18:59 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 18:18:59 +0000 |
commit | 7c71e94b9702df4cb7eec1ae4920847a4269674f (patch) | |
tree | d2d1f83a9b7b0a9b4d23cdd7f613bf58da6f032a /chrome/browser/instant/instant_controller.cc | |
parent | 9657938c4b074eadb8c4004598469ef164c5ff2a (diff) | |
download | chromium_src-7c71e94b9702df4cb7eec1ae4920847a4269674f.zip chromium_src-7c71e94b9702df4cb7eec1ae4920847a4269674f.tar.gz chromium_src-7c71e94b9702df4cb7eec1ae4920847a4269674f.tar.bz2 |
Makes instant use instant_url for instant results rather than search
url.
BUG=58756
TEST=none
Review URL: http://codereview.chromium.org/3754004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62591 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/instant/instant_controller.cc')
-rw-r--r-- | chrome/browser/instant/instant_controller.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc index 5afaca7..24c70f8 100644 --- a/chrome/browser/instant/instant_controller.cc +++ b/chrome/browser/instant/instant_controller.cc @@ -72,13 +72,14 @@ void InstantController::Update(TabContents* tab_contents, return; } - TemplateURLID template_url_id = GetTemplateURLID(match); + const TemplateURL* template_url = GetTemplateURL(match); + TemplateURLID template_url_id = template_url ? template_url->id() : 0; if (!loader_manager_.get()) loader_manager_.reset(new InstantLoaderManager(this)); if (ShouldUpdateNow(template_url_id, match.destination_url)) { - UpdateLoader(template_url_id, match.destination_url, match.transition, + UpdateLoader(template_url, match.destination_url, match.transition, user_text, suggested_text); } else { ScheduleUpdate(match.destination_url); @@ -269,11 +270,11 @@ void InstantController::ProcessScheduledUpdate() { // We only delay loading of sites that don't support instant, so we can ignore // suggested_text here. string16 suggested_text; - UpdateLoader(0, scheduled_url_, last_transition_type_, string16(), + UpdateLoader(NULL, scheduled_url_, last_transition_type_, string16(), &suggested_text); } -void InstantController::UpdateLoader(TemplateURLID template_url_id, +void InstantController::UpdateLoader(const TemplateURL* template_url, const GURL& url, PageTransition::Type transition_type, const string16& user_text, @@ -282,11 +283,12 @@ void InstantController::UpdateLoader(TemplateURLID template_url_id, InstantLoader* old_loader = loader_manager_->current_loader(); scoped_ptr<InstantLoader> owned_loader; + TemplateURLID template_url_id = template_url ? template_url->id() : 0; InstantLoader* new_loader = loader_manager_->UpdateLoader(template_url_id, &owned_loader); new_loader->SetOmniboxBounds(omnibox_bounds_); - new_loader->Update(tab_contents_, template_url_id, url, transition_type, + new_loader->Update(tab_contents_, template_url, url, transition_type, user_text, suggested_text); if (old_loader != new_loader && new_loader->ready()) delegate_->ShowInstant(new_loader->preview_contents()); @@ -308,7 +310,7 @@ void InstantController::ClearBlacklist() { blacklisted_ids_.clear(); } -TemplateURLID InstantController::GetTemplateURLID( +const TemplateURL* InstantController::GetTemplateURL( const AutocompleteMatch& match) { const TemplateURL* template_url = match.template_url; if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || @@ -318,9 +320,10 @@ TemplateURLID InstantController::GetTemplateURLID( template_url = model ? model->GetDefaultSearchProvider() : NULL; } if (template_url && template_url->id() && + template_url->instant_url() && !IsBlacklistedFromInstant(template_url->id()) && - TemplateURL::SupportsReplacement(template_url)) { - return template_url->id(); + template_url->instant_url()->SupportsReplacement()) { + return template_url; } - return 0; + return NULL; } |