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 f6a951f607749a10049441595a7753b374509c4d..d92a4ef472c716c9b8df93c6a20a5f2017e3792d 100644 |
--- a/media/base/android/media_drm_bridge.h |
+++ b/media/base/android/media_drm_bridge.h |
@@ -43,6 +43,10 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm { |
// to check IsAvailable() explicitly before calling them. |
static bool IsAvailable(); |
+ // Checks whether we can create the DRM for key system and security level. |
+ static bool CanCreate(const std::string& key_system, |
+ SecurityLevel widevine_security_level); |
+ |
// Checks whether |key_system| is supported. |
static bool IsKeySystemSupported(const std::string& key_system); |
@@ -61,8 +65,9 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm { |
// Returns a MediaDrmBridge instance if |key_system| is supported, or a NULL |
// pointer otherwise. |
// TODO(xhwang): Is it okay not to update session expiration info? |
- static scoped_ptr<MediaDrmBridge> Create( |
+ static scoped_ptr<MediaDrmBridge, BrowserCdmDeleter> Create( |
const std::string& key_system, |
+ SecurityLevel widevine_security_level, |
const SessionMessageCB& session_message_cb, |
const SessionClosedCB& session_closed_cb, |
const LegacySessionErrorCB& legacy_session_error_cb, |
@@ -72,8 +77,8 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm { |
// Returns a MediaDrmBridge instance if |key_system| is supported, or a NULL |
// otherwise. No session callbacks are provided. This is used when we need to |
// use MediaDrmBridge without creating any sessions. |
- static scoped_ptr<MediaDrmBridge> CreateWithoutSessionSupport( |
- const std::string& key_system); |
+ static scoped_ptr<MediaDrmBridge, BrowserCdmDeleter> |
+ CreateWithoutSessionSupport(const std::string& key_system); |
// Returns true if |security_level| is successfully set, or false otherwise. |
// Call this function right after Create() and before any other calls. |
@@ -199,6 +204,17 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm { |
// Get the security level of the media. |
SecurityLevel GetSecurityLevel(); |
+ void InternalPromiseResolved(uint32_t promise_id); |
+ void InternalPromiseResolvedWithSession(uint32_t promise_id, |
+ const std::string& session_id); |
+ void InternalPromiseRejected(uint32_t promise_id, |
+ const std::string& error_message); |
+ void InternalSessionKeysChanged(const std::string& session_id, |
+ bool has_additional_usable_key, |
+ CdmKeysInfo cdm_keys_info); |
+ |
+ void InternalKeysAdded(bool has_additional_usable_key); |
+ |
// UUID of the key system. |
std::vector<uint8> scheme_uuid_; |
@@ -220,6 +236,20 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm { |
CdmPromiseAdapter cdm_promise_adapter_; |
+ // Callbacks for posting Java notifications to Media thread |
+ typedef base::Callback<void(uint32_t)> PromiseCallback; |
+ typedef base::Callback<void(uint32_t, const std::string&)> PromiseWSCallback; |
+ typedef base::Callback<void(bool)> KeysAddedCallback; |
+ |
+ PromiseCallback internal_promise_resolved_cb_; |
+ PromiseWSCallback internal_promise_resolved_with_session_cb_; |
+ PromiseWSCallback internal_promise_rejected_cb_; |
+ SessionKeysChangeCB internal_session_keys_changed_cb_; |
+ |
+ KeysAddedCallback internal_keys_added_cb_; |
+ |
+ bool run_on_media_thread_; |
+ |
DISALLOW_COPY_AND_ASSIGN(MediaDrmBridge); |
}; |