Index: media/base/android/media_drm_bridge.h |
diff --git a/media/base/android/media_drm_bridge.h b/media/base/android/media_drm_bridge.h |
index b767aa64a117f8941bbc281bb085dca069057852..3e1a31a496d62dd98c46f609fe9584e84b0066c7 100644 |
--- a/media/base/android/media_drm_bridge.h |
+++ b/media/base/android/media_drm_bridge.h |
@@ -27,6 +27,30 @@ class MediaPlayerManager; |
// This class provides DRM services for android EME implementation. |
class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm { |
public: |
+ // Allows embedders to modify the Android DRM flow. Delegates are registered |
+ // to a specific key system. |
+ class Delegate { |
+ public: |
+ Delegate(); |
+ virtual ~Delegate(); |
+ |
+ // Invoked from CreateSession. |
+ // If |init_data_out| is filled, it replaces |init_data| to send to the |
+ // DRM plugin. |
+ // If |optional_parameters_out| is filled, it is expected to be an |
+ // even-length list of (key, value) pairs to send to the DRM plugin. |
+ // Returns false if the request should be rejected. |
+ virtual bool OnCreateSession( |
+ const EmeInitDataType init_data_type, |
+ const uint8* init_data, |
+ int init_data_length, |
+ std::vector<uint8>& init_data_out, |
+ std::vector<std::string>& optional_parameters_out); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(Delegate); |
+ }; |
+ |
// TODO(ddorwin): These are specific to Widevine. http://crbug.com/459400 |
enum SecurityLevel { |
SECURITY_LEVEL_NONE = 0, |
@@ -56,6 +80,11 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm { |
const std::string& key_system, |
const std::string& container_mime_type); |
+ // Registers a delegate to handle requests with a given UUID. |
+ static void RegisterDelegate( |
+ const std::string& key_system, |
+ Delegate* delegate); |
+ |
static bool RegisterMediaDrmBridge(JNIEnv* env); |
// Returns a MediaDrmBridge instance if |key_system| is supported, or a NULL |
@@ -185,7 +214,8 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm { |
const SessionMessageCB& session_message_cb, |
const SessionClosedCB& session_closed_cb, |
const LegacySessionErrorCB& legacy_session_error_cb, |
- const SessionKeysChangeCB& session_keys_change_cb); |
+ const SessionKeysChangeCB& session_keys_change_cb, |
+ Delegate* delegate); |
static bool IsSecureDecoderRequired(SecurityLevel security_level); |
@@ -198,6 +228,8 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm { |
// Java MediaDrm instance. |
base::android::ScopedJavaGlobalRef<jobject> j_media_drm_; |
+ Delegate* const delegate_; |
xhwang
2015/04/09 22:37:10
nit: document about lifetime.
gunsch
2015/04/10 00:21:11
Done.
|
+ |
// Callbacks for firing session events. |
SessionMessageCB session_message_cb_; |
SessionClosedCB session_closed_cb_; |