Index: chrome/browser/instant/instant_loader.cc |
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc |
index 1eadd705ac5e1b1521e76df6c5ae38f1c9df759e..afcafa64f3c4a8897441298ae7a57815a93d85bb 100644 |
--- a/chrome/browser/instant/instant_loader.cc |
+++ b/chrome/browser/instant/instant_loader.cc |
@@ -104,6 +104,14 @@ class InstantLoader::WebContentsDelegateImpl |
int height, |
InstantSizeUnits units); |
+ // Message from the renderer requesting the browser to start capturing user |
+ // key strokes. |
+ void OnStartCapturingKeyStrokes(int page_id); |
+ |
+ // Message from the renderer requesting the browser to stop capturing user |
+ // key strokes. |
+ void OnStopCapturingKeyStrokes(int page_id); |
+ |
void CommitFromPointerReleaseIfNecessary(); |
void MaybeSetAndNotifyInstantSupportDetermined(bool supports_instant); |
@@ -212,6 +220,10 @@ bool InstantLoader::WebContentsDelegateImpl::OnMessageReceived( |
OnInstantSupportDetermined) |
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowInstantPreview, |
OnShowInstantPreview); |
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_StartCapturingKeyStrokes, |
+ OnStartCapturingKeyStrokes); |
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_StopCapturingKeyStrokes, |
+ OnStopCapturingKeyStrokes); |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP() |
return handled; |
@@ -256,6 +268,30 @@ void InstantLoader::WebContentsDelegateImpl::OnShowInstantPreview( |
} |
} |
+void InstantLoader::WebContentsDelegateImpl::OnStartCapturingKeyStrokes( |
+ 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_->StartCapturingKeyStrokes(loader_); |
+ } |
+} |
+ |
+void InstantLoader::WebContentsDelegateImpl::OnStopCapturingKeyStrokes( |
+ 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); |
+ // NOTE(samarth): we don't do anything else yet in this case. |
+ } |
+} |
+ |
void InstantLoader::WebContentsDelegateImpl |
::CommitFromPointerReleaseIfNecessary() { |
if (is_pointer_down_from_activate_) { |