Index: chrome/browser/instant/instant_controller.cc |
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc |
index 65ba84f4f33ea7ffb97eb38d291decb36f25be5f..06bb4109299e3ad6a2da0a47eda9bc506125a984 100644 |
--- a/chrome/browser/instant/instant_controller.cc |
+++ b/chrome/browser/instant/instant_controller.cc |
@@ -356,6 +356,33 @@ void InstantController::OnAutocompleteLostFocus( |
} |
#endif |
+void InstantController::OnAutocompleteGotFocus( |
+ TabContentsWrapper* tab_contents) { |
+ CommandLine* cl = CommandLine::ForCurrentProcess(); |
+ if (!cl->HasSwitch(switches::kPreloadInstantSearch)) |
+ return; |
+ |
+ if (is_active_) |
+ return; |
+ |
+ TemplateURLModel* model = tab_contents->profile()->GetTemplateURLModel(); |
+ if (!model) |
+ return; |
+ |
+ const TemplateURL* template_url = model->GetDefaultSearchProvider(); |
+ if (!template_url) |
+ return; |
+ |
+ if (tab_contents != tab_contents_) |
+ DestroyPreviewContents(); |
+ tab_contents_ = tab_contents; |
+ |
+ if (!loader_manager_.get()) |
+ loader_manager_.reset(new InstantLoaderManager(this)); |
+ loader_manager_->GetInstantLoader(template_url->id()) |
+ ->MaybeLoadInstantURL(tab_contents, template_url); |
+} |
+ |
TabContentsWrapper* InstantController::ReleasePreviewContents( |
InstantCommitType type) { |
if (!loader_manager_.get()) |