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

Unified Diff: chrome/browser/instant/instant_controller.cc

Issue 6990015: Preload Instant search when omnibox is focused. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebaseline Created 9 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 | « chrome/browser/instant/instant_controller.h ('k') | chrome/browser/instant/instant_loader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())
« no previous file with comments | « chrome/browser/instant/instant_controller.h ('k') | chrome/browser/instant/instant_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698