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, |