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

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

Issue 11369137: Implement {Start,Stop}CapturingKeyStrokes for Instant. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix which active tab we use. Created 8 years, 1 month 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: chrome/browser/instant/instant_loader.cc
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index 4a474f7deca846bc56386e602e46218492b6a0c9..0202341308ff623dd721795e413ee45dbab316ad 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -94,6 +94,12 @@ class InstantLoader::WebContentsDelegateImpl
// Message from the renderer determining whether it supports the Instant API.
void OnInstantSupportDetermined(int page_id, bool result);
+ // Message from the renderer saying the web searchbox lost focus.
+ void OnWebSearchBoxBlur(int page_id);
+
+ // Message from the renderer saying the web searchbox received focus.
+ void OnWebSearchBoxFocus(int page_id);
+
// Message from the renderer requesting the preview be shown.
void OnShowInstantPreview(int page_id,
InstantShownReason reason,
@@ -208,6 +214,10 @@ bool InstantLoader::WebContentsDelegateImpl::OnMessageReceived(
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined,
OnInstantSupportDetermined)
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_OnWebSearchBoxBlur,
+ OnWebSearchBoxBlur);
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_OnWebSearchBoxFocus,
+ OnWebSearchBoxFocus);
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowInstantPreview,
OnShowInstantPreview);
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -239,6 +249,28 @@ void InstantLoader::WebContentsDelegateImpl::OnInstantSupportDetermined(
MaybeSetAndNotifyInstantSupportDetermined(result);
}
+void InstantLoader::WebContentsDelegateImpl::OnWebSearchBoxBlur(int page_id) {
+ DCHECK(loader_->preview_contents());
+ DCHECK(loader_->preview_contents_->web_contents());
+ content::NavigationEntry* entry = loader_->preview_contents_->web_contents()->
+ GetController().GetActiveEntry();
+ if (entry && page_id == entry->GetPageID()) {
+ MaybeSetAndNotifyInstantSupportDetermined(true);
+ loader_->controller_->OnWebSearchBoxBlur(loader_);
+ }
+}
+
+void InstantLoader::WebContentsDelegateImpl::OnWebSearchBoxFocus(int page_id) {
+ DCHECK(loader_->preview_contents());
+ DCHECK(loader_->preview_contents_->web_contents());
+ content::NavigationEntry* entry = loader_->preview_contents_->web_contents()->
+ GetController().GetActiveEntry();
+ if (entry && page_id == entry->GetPageID()) {
+ MaybeSetAndNotifyInstantSupportDetermined(true);
+ loader_->controller_->OnWebSearchBoxFocus(loader_);
+ }
+}
+
void InstantLoader::WebContentsDelegateImpl::OnShowInstantPreview(
int page_id,
InstantShownReason reason,

Powered by Google App Engine
This is Rietveld 408576698