Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ | |
| 6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "media/base/decryptor.h" | |
| 12 | |
| 13 namespace media { | |
| 14 class DecryptorClient; | |
| 15 } | |
| 16 | |
| 17 namespace webkit { | |
| 18 namespace ppapi { | |
| 19 class PluginInstance; | |
| 20 } | |
| 21 } | |
| 22 | |
| 23 namespace WebKit { | |
| 24 class WebFrame; | |
| 25 class WebMediaPlayerClient; | |
| 26 } | |
| 27 | |
| 28 namespace webkit_media { | |
| 29 | |
| 30 class PpapiDecryptor : public media::Decryptor { | |
| 31 public: | |
| 32 explicit PpapiDecryptor(media::DecryptorClient* client); | |
| 33 virtual ~PpapiDecryptor(); | |
| 34 | |
| 35 // Returns true if initialization succeeds. | |
| 36 bool Init(const std::string& key_system, | |
| 37 WebKit::WebMediaPlayerClient* web_media_player_client, | |
| 38 WebKit::WebFrame* web_frame); | |
| 39 | |
| 40 // media::Decryptor implementation. | |
| 41 virtual void GenerateKeyRequest(const std::string& key_system, | |
| 42 const uint8* init_data, | |
| 43 int init_data_length) OVERRIDE; | |
| 44 virtual void AddKey(const std::string& key_system, | |
| 45 const uint8* key, | |
| 46 int key_length, | |
| 47 const uint8* init_data, | |
| 48 int init_data_length, | |
| 49 const std::string& session_id) OVERRIDE; | |
| 50 virtual void CancelKeyRequest(const std::string& key_system, | |
| 51 const std::string& session_id) OVERRIDE; | |
| 52 virtual void Decrypt(const scoped_refptr<media::DecoderBuffer>& encrypted, | |
| 53 const DecryptCB& decrypt_cb) OVERRIDE; | |
| 54 | |
| 55 private: | |
| 56 // Callback for the plugin to hand back the decrypted data. | |
| 57 void DataReady(const DecryptCB& decrypt_cb, const uint8* data, int data_size); | |
| 58 | |
| 59 media::DecryptorClient* client_; | |
| 60 scoped_refptr<webkit::ppapi::PluginInstance> cdm_plugin_; | |
|
ddorwin
2012/07/19 01:12:34
Does this need to be a refptr?
xhwang
2012/07/19 15:54:34
PluginInstance is ref counted: http://code.google.
| |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); | |
| 63 }; | |
| 64 | |
| 65 } // namespace webkit_media | |
| 66 | |
| 67 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ | |
| OLD | NEW |