Commit 3895fc1c authored by lazyboy's avatar lazyboy Committed by Commit bot

Add keyboard handler for mime-handler-view.

BUG=411753
Test=With mime handler view turned on, click on a PDF to
focus the plugin, now send some keyboard event, like CTRL+L.
See the keyboard event work, i.e. the chrome address bar gets focus.

Review URL: https://codereview.chromium.org/557523002

Cr-Commit-Position: refs/heads/master@{#293868}
parent 940e498e
...@@ -94,4 +94,20 @@ void MimeHandlerViewGuest::DidAttachToEmbedder() { ...@@ -94,4 +94,20 @@ void MimeHandlerViewGuest::DidAttachToEmbedder() {
std::string()); std::string());
} }
void MimeHandlerViewGuest::HandleKeyboardEvent(
WebContents* source,
const content::NativeWebKeyboardEvent& event) {
if (!attached())
return;
// Send the keyboard events back to the embedder to reprocess them.
// TODO(fsamuel): This introduces the possibility of out-of-order keyboard
// events because the guest may be arbitrarily delayed when responding to
// keyboard events. In that time, the embedder may have received and processed
// additional key events. This needs to be fixed as soon as possible.
// See http://crbug.com/229882.
embedder_web_contents()->GetDelegate()->HandleKeyboardEvent(web_contents(),
event);
}
} // namespace extensions } // namespace extensions
...@@ -26,6 +26,11 @@ class MimeHandlerViewGuest : public GuestView<MimeHandlerViewGuest> { ...@@ -26,6 +26,11 @@ class MimeHandlerViewGuest : public GuestView<MimeHandlerViewGuest> {
const WebContentsCreatedCallback& callback) OVERRIDE; const WebContentsCreatedCallback& callback) OVERRIDE;
virtual void DidAttachToEmbedder() OVERRIDE; virtual void DidAttachToEmbedder() OVERRIDE;
// WebContentsDelegate implementation.
virtual void HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) OVERRIDE;
private: private:
MimeHandlerViewGuest(content::BrowserContext* browser_context, MimeHandlerViewGuest(content::BrowserContext* browser_context,
int guest_instance_id); int guest_instance_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment