Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / renderer / media / crypto / pepper_cdm_wrapper_impl.cc
index f32dc03..c443e03 100644 (file)
@@ -9,9 +9,11 @@
 #include "content/renderer/pepper/pepper_webplugin_impl.h"
 #include "third_party/WebKit/public/platform/WebString.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
+#include "third_party/WebKit/public/web/WebElement.h"
 #include "third_party/WebKit/public/web/WebFrame.h"
 #include "third_party/WebKit/public/web/WebHelperPlugin.h"
 #include "third_party/WebKit/public/web/WebPlugin.h"
+#include "third_party/WebKit/public/web/WebPluginContainer.h"
 #include "third_party/WebKit/public/web/WebView.h"
 
 namespace content {
@@ -21,14 +23,10 @@ void WebHelperPluginDeleter::operator()(blink::WebHelperPlugin* plugin) const {
 }
 
 scoped_ptr<PepperCdmWrapper> PepperCdmWrapperImpl::Create(
-    blink::WebFrame* frame,
-    const std::string& pluginType) {
-
-  // TODO(jrummell): Convert to DCHECK(frame) once Blink starts passing the
-  // WebFrame to WebContentDecryptionModuleImpl.
-  if (!frame)
-    return scoped_ptr<PepperCdmWrapper>();
-
+    blink::WebLocalFrame* frame,
+    const std::string& pluginType,
+    const GURL& security_origin) {
+  DCHECK(frame);
   ScopedHelperPlugin helper_plugin(blink::WebHelperPlugin::create(
       blink::WebString::fromUTF8(pluginType), frame));
   if (!helper_plugin)
@@ -44,6 +42,10 @@ scoped_ptr<PepperCdmWrapper> PepperCdmWrapperImpl::Create(
   if (!plugin_instance)
     return scoped_ptr<PepperCdmWrapper>();
 
+  GURL url(plugin_instance->container()->element().document().url());
+  CHECK_EQ(security_origin.GetOrigin(), url.GetOrigin())
+      << "Pepper instance has a different origin than the EME call.";
+
   if (!plugin_instance->GetContentDecryptorDelegate())
     return scoped_ptr<PepperCdmWrapper>();