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

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: Keep invisible focus state in OmniboxEditModel. 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 9f2b82b9482a2d70b3f10895a8b4f893d91109a9..14b945f23e87465ae61da81da0f7fbff00f27c85 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -98,6 +98,9 @@ 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 focus state changed.
+ void OnWebSearchBoxFocusChange(int page_id, bool is_focused);
+
// Message from the renderer requesting the preview be shown.
void OnShowInstantPreview(int page_id,
InstantShownReason reason,
@@ -210,6 +213,8 @@ bool InstantLoader::WebContentsDelegateImpl::OnMessageReceived(
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined,
OnInstantSupportDetermined)
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_OnWebSearchBoxFocusChange,
+ OnWebSearchBoxFocusChange);
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowInstantPreview,
OnShowInstantPreview);
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -241,6 +246,19 @@ void InstantLoader::WebContentsDelegateImpl::OnInstantSupportDetermined(
MaybeSetAndNotifyInstantSupportDetermined(result);
}
+void InstantLoader::WebContentsDelegateImpl::OnWebSearchBoxFocusChange(
+ int page_id,
+ bool is_focused) {
+ 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_->OnWebSearchBoxFocusChange(loader_, is_focused);
+ }
+}
+
void InstantLoader::WebContentsDelegateImpl::OnShowInstantPreview(
int page_id,
InstantShownReason reason,

Powered by Google App Engine
This is Rietveld 408576698