OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 class WEBKIT_PLUGINS_EXPORT ContentDecryptorDelegate { | 32 class WEBKIT_PLUGINS_EXPORT ContentDecryptorDelegate { |
33 public: | 33 public: |
34 // ContentDecryptorDelegate does not take ownership of | 34 // ContentDecryptorDelegate does not take ownership of |
35 // |plugin_decryption_interface|. Therefore |plugin_decryption_interface| | 35 // |plugin_decryption_interface|. Therefore |plugin_decryption_interface| |
36 // must outlive this object. | 36 // must outlive this object. |
37 ContentDecryptorDelegate( | 37 ContentDecryptorDelegate( |
38 PP_Instance pp_instance, | 38 PP_Instance pp_instance, |
39 const PPP_ContentDecryptor_Private* plugin_decryption_interface); | 39 const PPP_ContentDecryptor_Private* plugin_decryption_interface); |
40 | 40 |
| 41 void SetKeyEventCallbacks(const media::KeyAddedCB& key_added_cb, |
| 42 const media::KeyErrorCB& key_error_cb, |
| 43 const media::KeyMessageCB& key_message_cb, |
| 44 const media::NeedKeyCB& need_key_cb); |
| 45 |
41 // Provides access to PPP_ContentDecryptor_Private. | 46 // Provides access to PPP_ContentDecryptor_Private. |
42 void set_decrypt_client(media::DecryptorClient* decryptor_client); | |
43 bool GenerateKeyRequest(const std::string& key_system, | 47 bool GenerateKeyRequest(const std::string& key_system, |
44 const std::string& type, | 48 const std::string& type, |
45 const uint8* init_data, | 49 const uint8* init_data, |
46 int init_data_length); | 50 int init_data_length); |
47 bool AddKey(const std::string& session_id, | 51 bool AddKey(const std::string& session_id, |
48 const uint8* key, | 52 const uint8* key, |
49 int key_length, | 53 int key_length, |
50 const uint8* init_data, | 54 const uint8* init_data, |
51 int init_data_length); | 55 int init_data_length); |
52 bool CancelKeyRequest(const std::string& session_id); | 56 bool CancelKeyRequest(const std::string& session_id); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 const uint8* data, int size, | 117 const uint8* data, int size, |
114 ::ppapi::ScopedPPResource* resource); | 118 ::ppapi::ScopedPPResource* resource); |
115 | 119 |
116 void FreeBuffer(uint32_t buffer_id); | 120 void FreeBuffer(uint32_t buffer_id); |
117 | 121 |
118 void SetBufferToFreeInTrackingInfo(PP_DecryptTrackingInfo* tracking_info); | 122 void SetBufferToFreeInTrackingInfo(PP_DecryptTrackingInfo* tracking_info); |
119 | 123 |
120 const PP_Instance pp_instance_; | 124 const PP_Instance pp_instance_; |
121 const PPP_ContentDecryptor_Private* const plugin_decryption_interface_; | 125 const PPP_ContentDecryptor_Private* const plugin_decryption_interface_; |
122 | 126 |
123 media::DecryptorClient* decryptor_client_; | 127 // Callbacks for firing key events. |
| 128 media::KeyAddedCB key_added_cb_; |
| 129 media::KeyErrorCB key_error_cb_; |
| 130 media::KeyMessageCB key_message_cb_; |
| 131 media::NeedKeyCB need_key_cb_; |
124 | 132 |
125 gfx::Size natural_size_; | 133 gfx::Size natural_size_; |
126 | 134 |
127 // Request ID for tracking pending content decryption callbacks. | 135 // Request ID for tracking pending content decryption callbacks. |
128 // Note that zero indicates an invalid request ID. | 136 // Note that zero indicates an invalid request ID. |
129 // TODO(xhwang): Add completion callbacks for Reset/Stop and remove the use | 137 // TODO(xhwang): Add completion callbacks for Reset/Stop and remove the use |
130 // of request IDs. | 138 // of request IDs. |
131 uint32_t next_decryption_request_id_; | 139 uint32_t next_decryption_request_id_; |
132 | 140 |
133 uint32_t pending_audio_decrypt_request_id_; | 141 uint32_t pending_audio_decrypt_request_id_; |
(...skipping 26 matching lines...) Expand all Loading... |
160 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; | 168 base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_; |
161 base::WeakPtr<ContentDecryptorDelegate> weak_this_; | 169 base::WeakPtr<ContentDecryptorDelegate> weak_this_; |
162 | 170 |
163 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); | 171 DISALLOW_COPY_AND_ASSIGN(ContentDecryptorDelegate); |
164 }; | 172 }; |
165 | 173 |
166 } // namespace ppapi | 174 } // namespace ppapi |
167 } // namespace webkit | 175 } // namespace webkit |
168 | 176 |
169 #endif // WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ | 177 #endif // WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_ |
OLD | NEW |