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

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: Switch order in BIC. Created 8 years 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 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_) {

Powered by Google App Engine
This is Rietveld 408576698