Send unhandled key event to embedder

This commit is contained in:
Cheng Zhao 2014-10-24 21:46:47 +08:00
parent e214ce6bc4
commit a96cde254b
2 changed files with 15 additions and 1 deletions

View file

@ -83,6 +83,17 @@ content::WebContents* WebContents::OpenURLFromTab(
return web_contents();
}
void WebContents::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {
if (!attached())
return;
// Send the unhandled keyboard events back to the embedder to reprocess them.
embedder_web_contents_->GetDelegate()->HandleKeyboardEvent(
web_contents(), event);
}
void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
base::ListValue args;
args.AppendInteger(render_view_host->GetProcess()->GetID());

View file

@ -88,9 +88,12 @@ class WebContents : public mate::EventEmitter,
v8::Isolate* isolate) override;
// content::WebContentsDelegate:
virtual content::WebContents* OpenURLFromTab(
content::WebContents* OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) override;
void HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) override;
// content::WebContentsObserver:
virtual void RenderViewDeleted(content::RenderViewHost*) override;