summaryrefslogtreecommitdiffstats
path: root/content/renderer/media
diff options
context:
space:
mode:
authorkkimlabs@chromium.org <kkimlabs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-23 04:15:45 +0000
committerkkimlabs@chromium.org <kkimlabs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-23 04:15:45 +0000
commitf961a0fedd9bfae93284d6d0d989f42da3caac7b (patch)
tree770a1f9679799f8e50decff35ecc27cad4d89f8a /content/renderer/media
parentd34e683c837a2e48a19c576b768ea516b2dfca1f (diff)
downloadchromium_src-f961a0fedd9bfae93284d6d0d989f42da3caac7b.zip
chromium_src-f961a0fedd9bfae93284d6d0d989f42da3caac7b.tar.gz
chromium_src-f961a0fedd9bfae93284d6d0d989f42da3caac7b.tar.bz2
[Android] EME permission on/off pref and infobar UI.
For protected media identifier access permission, add global on/off preference setting and infobar permission gate UI. BUG=281576 Review URL: https://chromiumcodereview.appspot.com/23531021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224650 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/media')
-rw-r--r--content/renderer/media/android/proxy_media_keys.cc5
-rw-r--r--content/renderer/media/android/proxy_media_keys.h4
-rw-r--r--content/renderer/media/android/webmediaplayer_android.cc2
-rw-r--r--content/renderer/media/android/webmediaplayer_proxy_android.cc6
-rw-r--r--content/renderer/media/android/webmediaplayer_proxy_android.h4
-rw-r--r--content/renderer/media/crypto/content_decryption_module_factory.cc3
-rw-r--r--content/renderer/media/crypto/content_decryption_module_factory.h3
-rw-r--r--content/renderer/media/crypto/proxy_decryptor.cc9
-rw-r--r--content/renderer/media/crypto/proxy_decryptor.h7
-rw-r--r--content/renderer/media/webcontentdecryptionmodule_impl.cc3
-rw-r--r--content/renderer/media/webmediaplayer_impl.cc3
11 files changed, 35 insertions, 14 deletions
diff --git a/content/renderer/media/android/proxy_media_keys.cc b/content/renderer/media/android/proxy_media_keys.cc
index a012f67..2beb66a 100644
--- a/content/renderer/media/android/proxy_media_keys.cc
+++ b/content/renderer/media/android/proxy_media_keys.cc
@@ -19,13 +19,14 @@ ProxyMediaKeys::ProxyMediaKeys(WebMediaPlayerProxyAndroid* proxy,
DCHECK(proxy_);
}
-void ProxyMediaKeys::InitializeCDM(const std::string& key_system) {
+void ProxyMediaKeys::InitializeCDM(const std::string& key_system,
+ const GURL& frame_url) {
#if defined(ENABLE_PEPPER_CDMS)
NOTIMPLEMENTED();
#elif defined(OS_ANDROID)
std::vector<uint8> uuid = GetUUID(key_system);
DCHECK(!uuid.empty());
- proxy_->InitializeCDM(media_keys_id_, uuid);
+ proxy_->InitializeCDM(media_keys_id_, uuid, frame_url);
#endif
}
diff --git a/content/renderer/media/android/proxy_media_keys.h b/content/renderer/media/android/proxy_media_keys.h
index ca13279..847a782 100644
--- a/content/renderer/media/android/proxy_media_keys.h
+++ b/content/renderer/media/android/proxy_media_keys.h
@@ -8,6 +8,8 @@
#include "base/basictypes.h"
#include "media/base/media_keys.h"
+class GURL;
+
namespace content {
class WebMediaPlayerProxyAndroid;
@@ -20,7 +22,7 @@ class ProxyMediaKeys : public media::MediaKeys {
public:
ProxyMediaKeys(WebMediaPlayerProxyAndroid* proxy, int media_keys_id);
- void InitializeCDM(const std::string& key_system);
+ void InitializeCDM(const std::string& key_system, const GURL& frame_url);
// MediaKeys implementation.
virtual bool GenerateKeyRequest(const std::string& type,
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index 575ca17..ba505fc 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -1017,7 +1017,7 @@ WebMediaPlayerAndroid::GenerateKeyRequestInternal(
// We do not support run-time switching between key systems for now.
if (current_key_system_.isEmpty()) {
- if (!decryptor_->InitializeCDM(key_system.utf8()))
+ if (!decryptor_->InitializeCDM(key_system.utf8(), frame_->document().url()))
return WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported;
current_key_system_ = key_system;
} else if (key_system != current_key_system_) {
diff --git a/content/renderer/media/android/webmediaplayer_proxy_android.cc b/content/renderer/media/android/webmediaplayer_proxy_android.cc
index d290edb..39e87a0 100644
--- a/content/renderer/media/android/webmediaplayer_proxy_android.cc
+++ b/content/renderer/media/android/webmediaplayer_proxy_android.cc
@@ -200,8 +200,10 @@ void WebMediaPlayerProxyAndroid::DidCommitCompositorFrame() {
#endif
void WebMediaPlayerProxyAndroid::InitializeCDM(int media_keys_id,
- const std::vector<uint8>& uuid) {
- Send(new MediaKeysHostMsg_InitializeCDM(routing_id(), media_keys_id, uuid));
+ const std::vector<uint8>& uuid,
+ const GURL& frame_url) {
+ Send(new MediaKeysHostMsg_InitializeCDM(
+ routing_id(), media_keys_id, uuid, frame_url));
}
void WebMediaPlayerProxyAndroid::GenerateKeyRequest(
diff --git a/content/renderer/media/android/webmediaplayer_proxy_android.h b/content/renderer/media/android/webmediaplayer_proxy_android.h
index 209f8d2..76d2d43 100644
--- a/content/renderer/media/android/webmediaplayer_proxy_android.h
+++ b/content/renderer/media/android/webmediaplayer_proxy_android.h
@@ -84,7 +84,9 @@ class WebMediaPlayerProxyAndroid : public RenderViewObserver {
#endif
// Encrypted media related methods.
- void InitializeCDM(int media_keys_id, const std::vector<uint8>& uuid);
+ void InitializeCDM(int media_keys_id,
+ const std::vector<uint8>& uuid,
+ const GURL& frame_url);
void GenerateKeyRequest(int media_keys_id,
const std::string& type,
const std::vector<uint8>& init_data);
diff --git a/content/renderer/media/crypto/content_decryption_module_factory.cc b/content/renderer/media/crypto/content_decryption_module_factory.cc
index 1e33528..e53fa17 100644
--- a/content/renderer/media/crypto/content_decryption_module_factory.cc
+++ b/content/renderer/media/crypto/content_decryption_module_factory.cc
@@ -96,6 +96,7 @@ scoped_ptr<media::MediaKeys> ContentDecryptionModuleFactory::Create(
#elif defined(OS_ANDROID)
WebMediaPlayerProxyAndroid* proxy,
int media_keys_id,
+ const GURL& frame_url,
#endif // defined(ENABLE_PEPPER_CDMS)
const media::KeyAddedCB& key_added_cb,
const media::KeyErrorCB& key_error_cb,
@@ -117,7 +118,7 @@ scoped_ptr<media::MediaKeys> ContentDecryptionModuleFactory::Create(
#elif defined(OS_ANDROID)
scoped_ptr<ProxyMediaKeys> proxy_media_keys(
new ProxyMediaKeys(proxy, media_keys_id));
- proxy_media_keys->InitializeCDM(key_system);
+ proxy_media_keys->InitializeCDM(key_system, frame_url);
return proxy_media_keys.PassAs<media::MediaKeys>();
#else
return scoped_ptr<media::MediaKeys>();
diff --git a/content/renderer/media/crypto/content_decryption_module_factory.h b/content/renderer/media/crypto/content_decryption_module_factory.h
index cb435cd..01ab731 100644
--- a/content/renderer/media/crypto/content_decryption_module_factory.h
+++ b/content/renderer/media/crypto/content_decryption_module_factory.h
@@ -10,6 +10,8 @@
#include "base/memory/scoped_ptr.h"
#include "media/base/media_keys.h"
+class GURL;
+
#if defined(ENABLE_PEPPER_CDMS)
namespace WebKit {
class WebFrame;
@@ -33,6 +35,7 @@ class ContentDecryptionModuleFactory {
#elif defined(OS_ANDROID)
WebMediaPlayerProxyAndroid* proxy,
int media_keys_id,
+ const GURL& frame_url,
#endif // defined(ENABLE_PEPPER_CDMS)
const media::KeyAddedCB& key_added_cb,
const media::KeyErrorCB& key_error_cb,
diff --git a/content/renderer/media/crypto/proxy_decryptor.cc b/content/renderer/media/crypto/proxy_decryptor.cc
index 53fae47..c50080f 100644
--- a/content/renderer/media/crypto/proxy_decryptor.cc
+++ b/content/renderer/media/crypto/proxy_decryptor.cc
@@ -75,13 +75,14 @@ void ProxyDecryptor::SetDecryptorReadyCB(
decryptor_ready_cb_ = decryptor_ready_cb;
}
-bool ProxyDecryptor::InitializeCDM(const std::string& key_system) {
+bool ProxyDecryptor::InitializeCDM(const std::string& key_system,
+ const GURL& frame_url) {
DVLOG(1) << "InitializeCDM: key_system = " << key_system;
base::AutoLock auto_lock(lock_);
DCHECK(!media_keys_);
- media_keys_ = CreateMediaKeys(key_system);
+ media_keys_ = CreateMediaKeys(key_system, frame_url);
return media_keys_ != NULL;
}
@@ -119,7 +120,8 @@ void ProxyDecryptor::CancelKeyRequest(const std::string& session_id) {
}
scoped_ptr<media::MediaKeys> ProxyDecryptor::CreateMediaKeys(
- const std::string& key_system) {
+ const std::string& key_system,
+ const GURL& frame_url) {
return ContentDecryptionModuleFactory::Create(
key_system,
#if defined(ENABLE_PEPPER_CDMS)
@@ -130,6 +132,7 @@ scoped_ptr<media::MediaKeys> ProxyDecryptor::CreateMediaKeys(
#elif defined(OS_ANDROID)
proxy_,
media_keys_id_,
+ frame_url,
#endif // defined(ENABLE_PEPPER_CDMS)
base::Bind(&ProxyDecryptor::KeyAdded, weak_ptr_factory_.GetWeakPtr()),
base::Bind(&ProxyDecryptor::KeyError, weak_ptr_factory_.GetWeakPtr()),
diff --git a/content/renderer/media/crypto/proxy_decryptor.h b/content/renderer/media/crypto/proxy_decryptor.h
index 399665f..0202721 100644
--- a/content/renderer/media/crypto/proxy_decryptor.h
+++ b/content/renderer/media/crypto/proxy_decryptor.h
@@ -15,6 +15,8 @@
#include "media/base/decryptor.h"
#include "media/base/media_keys.h"
+class GURL;
+
namespace WebKit {
#if defined(ENABLE_PEPPER_CDMS)
class WebFrame;
@@ -48,7 +50,7 @@ class ProxyDecryptor : public media::MediaKeys {
virtual ~ProxyDecryptor();
// Only call this once.
- bool InitializeCDM(const std::string& key_system);
+ bool InitializeCDM(const std::string& key_system, const GURL& frame_url);
// Requests the ProxyDecryptor to notify the decryptor when it's ready through
// the |decryptor_ready_cb| provided.
@@ -68,7 +70,8 @@ class ProxyDecryptor : public media::MediaKeys {
private:
// Helper function to create MediaKeys to handle the given |key_system|.
- scoped_ptr<media::MediaKeys> CreateMediaKeys(const std::string& key_system);
+ scoped_ptr<media::MediaKeys> CreateMediaKeys(const std::string& key_system,
+ const GURL& frame_url);
// Callbacks for firing key events.
void KeyAdded(const std::string& session_id);
diff --git a/content/renderer/media/webcontentdecryptionmodule_impl.cc b/content/renderer/media/webcontentdecryptionmodule_impl.cc
index 0a430ad..a70ad2a 100644
--- a/content/renderer/media/webcontentdecryptionmodule_impl.cc
+++ b/content/renderer/media/webcontentdecryptionmodule_impl.cc
@@ -16,6 +16,7 @@
#include "content/renderer/media/crypto/content_decryption_module_factory.h"
#include "content/renderer/media/webcontentdecryptionmodulesession_impl.h"
#include "media/base/media_keys.h"
+#include "url/gurl.h"
namespace content {
@@ -87,6 +88,8 @@ bool SessionIdAdapter::Initialize(const std::string& key_system,
// TODO(xhwang): Support Android.
NULL,
0,
+ // TODO(ddorwin): Get the URL for the frame containing the MediaKeys.
+ GURL(),
#endif // defined(ENABLE_PEPPER_CDMS)
base::Bind(&SessionIdAdapter::KeyAdded, weak_this),
base::Bind(&SessionIdAdapter::KeyError, weak_this),
diff --git a/content/renderer/media/webmediaplayer_impl.cc b/content/renderer/media/webmediaplayer_impl.cc
index a99c3ae..9710b90 100644
--- a/content/renderer/media/webmediaplayer_impl.cc
+++ b/content/renderer/media/webmediaplayer_impl.cc
@@ -53,6 +53,7 @@
#include "third_party/WebKit/public/platform/WebSize.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
+#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "v8/include/v8.h"
@@ -728,7 +729,7 @@ WebMediaPlayerImpl::GenerateKeyRequestInternal(
// We do not support run-time switching between key systems for now.
if (current_key_system_.isEmpty()) {
- if (!decryptor_->InitializeCDM(key_system.utf8()))
+ if (!decryptor_->InitializeCDM(key_system.utf8(), frame_->document().url()))
return WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported;
current_key_system_ = key_system;
}