Make getUserMedia work in <webview>, fixes #845

This commit is contained in:
Cheng Zhao 2014-12-18 12:02:23 -08:00
parent 48b0d85f54
commit a1ae399d10
2 changed files with 13 additions and 0 deletions

View file

@ -22,6 +22,7 @@
#include "content/public/browser/web_contents.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "vendor/brightray/browser/media/media_stream_devices_controller.h"
#include "atom/common/node_includes.h"
@ -134,6 +135,14 @@ content::WebContents* WebContents::OpenURLFromTab(
return web_contents();
}
void WebContents::RequestMediaAccessPermission(
content::WebContents*,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) {
brightray::MediaStreamDevicesController controller(request, callback);
controller.TakeAction();
}
void WebContents::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {

View file

@ -113,6 +113,10 @@ class WebContents : public mate::EventEmitter,
content::WebContents* OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) override;
void RequestMediaAccessPermission(
content::WebContents*,
const content::MediaStreamRequest&,
const content::MediaResponseCallback&) override;
void HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) override;