summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/renderer/media/webcontentdecryptionmodule_impl.cc24
-rw-r--r--content/renderer/media/webcontentdecryptionmodule_impl.h11
-rw-r--r--content/renderer/render_frame_impl.cc11
-rw-r--r--content/renderer/render_frame_impl.h6
4 files changed, 47 insertions, 5 deletions
diff --git a/content/renderer/media/webcontentdecryptionmodule_impl.cc b/content/renderer/media/webcontentdecryptionmodule_impl.cc
index 8a4cf47..0c4a901f 100644
--- a/content/renderer/media/webcontentdecryptionmodule_impl.cc
+++ b/content/renderer/media/webcontentdecryptionmodule_impl.cc
@@ -15,15 +15,33 @@
#include "content/renderer/media/cdm_session_adapter.h"
#include "content/renderer/media/webcontentdecryptionmodulesession_impl.h"
#include "media/base/media_keys.h"
+#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
#if defined(ENABLE_PEPPER_CDMS)
#include "content/renderer/media/crypto/pepper_cdm_wrapper_impl.h"
#endif
+namespace blink {
+class WebFrame;
+}
+
namespace content {
WebContentDecryptionModuleImpl* WebContentDecryptionModuleImpl::Create(
const base::string16& key_system) {
+ blink::WebSecurityOrigin no_origin;
+ return WebContentDecryptionModuleImpl::Create(NULL, no_origin, key_system);
+}
+
+WebContentDecryptionModuleImpl* WebContentDecryptionModuleImpl::Create(
+ blink::WebFrame* frame,
+ const blink::WebSecurityOrigin& security_origin,
+ const base::string16& key_system) {
+ // TODO(jrummell): Use |security_origin| rather than using the document URL.
+ // TODO(jrummell): Once the other Create() method is removed, validate |frame|
+ // and |security_origin|.
+ DCHECK(!key_system.empty());
+
// TODO(ddorwin): Guard against this in supported types check and remove this.
// Chromium only supports ASCII key systems.
if (!IsStringASCII(key_system)) {
@@ -34,11 +52,7 @@ WebContentDecryptionModuleImpl* WebContentDecryptionModuleImpl::Create(
scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter());
if (!adapter->Initialize(
#if defined(ENABLE_PEPPER_CDMS)
- // TODO(jrummell): Figure out how to get a WebFrame from Blink (or
- // something equivalent) so the plugin can actually get created.
- // http://crbug.com/250049
- base::Bind(&PepperCdmWrapperImpl::Create,
- static_cast<blink::WebFrame*>(NULL)),
+ base::Bind(&PepperCdmWrapperImpl::Create, frame),
#endif
base::UTF16ToASCII(key_system))) {
return NULL;
diff --git a/content/renderer/media/webcontentdecryptionmodule_impl.h b/content/renderer/media/webcontentdecryptionmodule_impl.h
index 6ec3a95..d799664 100644
--- a/content/renderer/media/webcontentdecryptionmodule_impl.h
+++ b/content/renderer/media/webcontentdecryptionmodule_impl.h
@@ -12,6 +12,11 @@
#include "base/strings/string16.h"
#include "third_party/WebKit/public/platform/WebContentDecryptionModule.h"
+namespace blink {
+class WebFrame;
+class WebSecurityOrigin;
+}
+
namespace media {
class Decryptor;
class MediaKeys;
@@ -25,7 +30,13 @@ class WebContentDecryptionModuleSessionImpl;
class WebContentDecryptionModuleImpl
: public blink::WebContentDecryptionModule {
public:
+ // TODO(jrummell): Remove this method once all callers have updated to pass
+ // |frame| and |securityOrigin|.
+ static WebContentDecryptionModuleImpl* Create(
+ const base::string16& key_system);
static WebContentDecryptionModuleImpl* Create(
+ blink::WebFrame* frame,
+ const blink::WebSecurityOrigin& security_origin,
const base::string16& key_system);
virtual ~WebContentDecryptionModuleImpl();
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index b0b1743..426630f 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -52,6 +52,7 @@
#include "content/renderer/ime_event_guard.h"
#include "content/renderer/internal_document_state_data.h"
#include "content/renderer/java/java_bridge_dispatcher.h"
+#include "content/renderer/media/webcontentdecryptionmodule_impl.h"
#include "content/renderer/npapi/plugin_channel_host.h"
#include "content/renderer/render_process.h"
#include "content/renderer/render_thread_impl.h"
@@ -1144,6 +1145,16 @@ blink::WebMediaPlayer* RenderFrameImpl::createMediaPlayer(
return render_view_->CreateMediaPlayer(this, frame, url, client);
}
+blink::WebContentDecryptionModule*
+RenderFrameImpl::createContentDecryptionModule(
+ blink::WebFrame* frame,
+ const blink::WebSecurityOrigin& security_origin,
+ const blink::WebString& key_system) {
+ DCHECK(!frame_ || frame_ == frame);
+ return WebContentDecryptionModuleImpl::Create(
+ frame, security_origin, key_system);
+}
+
blink::WebApplicationCacheHost* RenderFrameImpl::createApplicationCacheHost(
blink::WebFrame* frame,
blink::WebApplicationCacheHostClient* client) {
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index b412e10..3283266 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -31,6 +31,8 @@ struct FrameMsg_Navigate_Params;
namespace blink {
class WebInputEvent;
class WebMouseEvent;
+class WebContentDecryptionModule;
+class WebSecurityOrigin;
struct WebCompositionUnderline;
struct WebContextMenuData;
struct WebCursorInfo;
@@ -191,6 +193,10 @@ class CONTENT_EXPORT RenderFrameImpl
blink::WebFrame* frame,
const blink::WebURL& url,
blink::WebMediaPlayerClient* client);
+ virtual blink::WebContentDecryptionModule* createContentDecryptionModule(
+ blink::WebFrame* frame,
+ const blink::WebSecurityOrigin& security_origin,
+ const blink::WebString& key_system);
virtual blink::WebApplicationCacheHost* createApplicationCacheHost(
blink::WebFrame* frame,
blink::WebApplicationCacheHostClient* client);