Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Unified Diff: webkit/media/crypto/proxy_decryptor.h

Issue 11226019: Encrypted Media: Replace DecryptorClient with key event callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/media/crypto/proxy_decryptor.h
diff --git a/webkit/media/crypto/proxy_decryptor.h b/webkit/media/crypto/proxy_decryptor.h
index 9f65a6dd4884ad4e2fd92045ac57ebb25ab73459..95bc0431bf9112851bc62779689b7a662b40c896 100644
--- a/webkit/media/crypto/proxy_decryptor.h
+++ b/webkit/media/crypto/proxy_decryptor.h
@@ -10,6 +10,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "media/base/decryptor.h"
+#include "media/base/decryptor_client.h"
namespace base {
class MessageLoopProxy;
@@ -30,10 +31,29 @@ namespace webkit_media {
// forwards decryptor calls to it.
// TODO(xhwang): Currently we don't support run-time switching among decryptor
// objects. Fix this when needed.
-class ProxyDecryptor : public media::Decryptor {
+class ProxyDecryptor : public media::Decryptor, public media::DecryptorClient {
public:
+ typedef base::Callback<void(const std::string& key_system,
+ const std::string& session_id)> KeyAddedCB;
+ typedef base::Callback<void(const std::string& key_system,
+ const std::string& session_id,
+ media::Decryptor::KeyError error_code,
+ int system_code)> KeyErrorCB;
+ typedef base::Callback<void(const std::string& key_system,
+ const std::string& session_id,
+ scoped_array<uint8> message,
+ int message_length,
+ const std::string& default_url)> KeyMessageCB;
+ typedef base::Callback<void(const std::string& key_system,
+ const std::string& session_id,
+ scoped_array<uint8> init_data,
+ int init_data_size)> NeedKeyCB;
Ami GONE FROM CHROMIUM 2012/10/23 06:52:22 ISTM this CL went half-way to the real goal: delet
xhwang 2012/10/23 07:32:13 Agreed that if we choose the pure callback path th
+
ProxyDecryptor(const scoped_refptr<base::MessageLoopProxy>& message_loop,
- media::DecryptorClient* decryptor_client,
+ const KeyAddedCB& key_added_cb,
+ const KeyErrorCB& key_error_cb,
+ const KeyMessageCB& key_message_cb,
+ const NeedKeyCB& need_key_cb,
WebKit::WebMediaPlayerClient* web_media_player_client,
WebKit::WebFrame* web_frame);
virtual ~ProxyDecryptor();
@@ -85,6 +105,23 @@ class ProxyDecryptor : public media::Decryptor {
virtual void ResetDecoder(StreamType stream_type) OVERRIDE;
virtual void DeinitializeDecoder(StreamType stream_type) OVERRIDE;
+ // media::DecryptorClient implementation.
+ virtual void KeyAdded(const std::string& key_system,
+ const std::string& session_id) OVERRIDE;
+ virtual void KeyError(const std::string& key_system,
+ const std::string& session_id,
+ Decryptor::KeyError error_code,
+ int system_code) OVERRIDE;
+ virtual void KeyMessage(const std::string& key_system,
+ const std::string& session_id,
+ scoped_array<uint8> message,
+ int message_length,
+ const std::string& default_url) OVERRIDE;
+ virtual void NeedKey(const std::string& key_system,
+ const std::string& session_id,
+ scoped_array<uint8> init_data,
+ int init_data_length) OVERRIDE;
+
private:
// Helper functions to create decryptors to handle the given |key_system|.
scoped_ptr<media::Decryptor> CreatePpapiDecryptor(
@@ -105,8 +142,11 @@ class ProxyDecryptor : public media::Decryptor {
// key/session-related methods do not run on this message loop.
scoped_refptr<base::MessageLoopProxy> const decryption_message_loop_;
- // DecryptorClient through which key events are fired.
- media::DecryptorClient* client_;
+ // Callbacks for firing key events.
+ KeyAddedCB key_added_cb_;
+ KeyErrorCB key_error_cb_;
+ KeyMessageCB key_message_cb_;
+ NeedKeyCB need_key_cb_;
// Needed to create the PpapiDecryptor.
WebKit::WebMediaPlayerClient* web_media_player_client_;

Powered by Google App Engine
This is Rietveld 408576698