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

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: rebase again Created 8 years 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 c68f093f965aeb67375405406b6b20e87aabd666..40a9af5aa7b42d7e0a7ebea8d41c868bf48cea64 100644
--- a/webkit/media/crypto/proxy_decryptor.h
+++ b/webkit/media/crypto/proxy_decryptor.h
@@ -8,13 +8,10 @@
#include <string>
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "base/synchronization/lock.h"
#include "media/base/decryptor.h"
-namespace media {
-class DecryptorClient;
-}
-
namespace WebKit {
class WebFrame;
class WebMediaPlayerClient;
@@ -28,9 +25,12 @@ namespace webkit_media {
// objects. Fix this when needed.
class ProxyDecryptor {
public:
- ProxyDecryptor(media::DecryptorClient* decryptor_client,
- WebKit::WebMediaPlayerClient* web_media_player_client,
- WebKit::WebFrame* web_frame);
+ ProxyDecryptor(WebKit::WebMediaPlayerClient* web_media_player_client,
+ WebKit::WebFrame* web_frame,
+ const media::KeyAddedCB& key_added_cb,
+ const media::KeyErrorCB& key_error_cb,
+ const media::KeyMessageCB& key_message_cb,
+ const media::NeedKeyCB& need_key_cb);
virtual ~ProxyDecryptor();
// Requests the ProxyDecryptor to notify the decryptor when it's ready through
@@ -55,13 +55,31 @@ class ProxyDecryptor {
const std::string& key_system);
scoped_ptr<media::Decryptor> CreateDecryptor(const std::string& key_system);
- // DecryptorClient through which key events are fired.
- media::DecryptorClient* client_;
+ // Callbacks for firing key events.
+ void KeyAdded(const std::string& key_system, const std::string& session_id);
+ void KeyError(const std::string& key_system,
+ const std::string& session_id,
+ media::Decryptor::KeyError error_code,
+ int system_code);
+ void KeyMessage(const std::string& key_system,
+ const std::string& session_id,
+ const std::string& message,
+ const std::string& default_url);
+ void NeedKey(const std::string& key_system,
+ const std::string& session_id,
+ const std::string& type,
+ scoped_array<uint8> init_data, int init_data_size);
// Needed to create the PpapiDecryptor.
WebKit::WebMediaPlayerClient* web_media_player_client_;
WebKit::WebFrame* web_frame_;
+ // Callbacks for firing key events.
+ media::KeyAddedCB key_added_cb_;
+ media::KeyErrorCB key_error_cb_;
+ media::KeyMessageCB key_message_cb_;
+ media::NeedKeyCB need_key_cb_;
+
// Protects the |decryptor_|. Note that |decryptor_| itself should be thread
// safe as per the Decryptor interface.
base::Lock lock_;
@@ -72,6 +90,8 @@ class ProxyDecryptor {
// This pointer is protected by the |lock_|.
scoped_ptr<media::Decryptor> decryptor_;
+ base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor);
};

Powered by Google App Engine
This is Rietveld 408576698