| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ | 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "content/renderer/media/crypto/pepper_cdm_wrapper.h" | 14 #include "content/renderer/media/crypto/pepper_cdm_wrapper.h" |
| 15 #include "media/base/cdm_context.h" |
| 15 #include "media/base/decryptor.h" | 16 #include "media/base/decryptor.h" |
| 16 #include "media/base/media_keys.h" | 17 #include "media/base/media_keys.h" |
| 17 #include "media/base/video_decoder_config.h" | 18 #include "media/base/video_decoder_config.h" |
| 18 | 19 |
| 19 class GURL; | 20 class GURL; |
| 20 | 21 |
| 21 namespace base { | 22 namespace base { |
| 22 class MessageLoopProxy; | 23 class MessageLoopProxy; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 class ContentDecryptorDelegate; | 27 class ContentDecryptorDelegate; |
| 27 class PepperPluginInstanceImpl; | 28 class PepperPluginInstanceImpl; |
| 28 | 29 |
| 29 // PpapiDecryptor implements media::MediaKeys and media::Decryptor and forwards | 30 // PpapiDecryptor implements media::MediaKeys and media::Decryptor and forwards |
| 30 // all calls to the PluginInstance. | 31 // all calls to the PluginInstance. |
| 31 // This class should always be created & destroyed on the main renderer thread. | 32 // This class should always be created & destroyed on the main renderer thread. |
| 32 class PpapiDecryptor : public media::MediaKeys, public media::Decryptor { | 33 class PpapiDecryptor : public media::MediaKeys, |
| 34 public media::CdmContext, |
| 35 public media::Decryptor { |
| 33 public: | 36 public: |
| 34 static scoped_ptr<PpapiDecryptor> Create( | 37 static scoped_ptr<PpapiDecryptor> Create( |
| 35 const std::string& key_system, | 38 const std::string& key_system, |
| 36 const GURL& security_origin, | 39 const GURL& security_origin, |
| 37 const CreatePepperCdmCB& create_pepper_cdm_cb, | 40 const CreatePepperCdmCB& create_pepper_cdm_cb, |
| 38 const media::SessionMessageCB& session_message_cb, | 41 const media::SessionMessageCB& session_message_cb, |
| 39 const media::SessionReadyCB& session_ready_cb, | 42 const media::SessionReadyCB& session_ready_cb, |
| 40 const media::SessionClosedCB& session_closed_cb, | 43 const media::SessionClosedCB& session_closed_cb, |
| 41 const media::SessionErrorCB& session_error_cb, | 44 const media::SessionErrorCB& session_error_cb, |
| 42 const media::SessionKeysChangeCB& session_keys_change_cb, | 45 const media::SessionKeysChangeCB& session_keys_change_cb, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 59 void UpdateSession(const std::string& web_session_id, | 62 void UpdateSession(const std::string& web_session_id, |
| 60 const uint8* response, | 63 const uint8* response, |
| 61 int response_length, | 64 int response_length, |
| 62 scoped_ptr<media::SimpleCdmPromise> promise) override; | 65 scoped_ptr<media::SimpleCdmPromise> promise) override; |
| 63 void CloseSession(const std::string& web_session_id, | 66 void CloseSession(const std::string& web_session_id, |
| 64 scoped_ptr<media::SimpleCdmPromise> promise) override; | 67 scoped_ptr<media::SimpleCdmPromise> promise) override; |
| 65 void RemoveSession(const std::string& web_session_id, | 68 void RemoveSession(const std::string& web_session_id, |
| 66 scoped_ptr<media::SimpleCdmPromise> promise) override; | 69 scoped_ptr<media::SimpleCdmPromise> promise) override; |
| 67 void GetUsableKeyIds(const std::string& web_session_id, | 70 void GetUsableKeyIds(const std::string& web_session_id, |
| 68 scoped_ptr<media::KeyIdsPromise> promise) override; | 71 scoped_ptr<media::KeyIdsPromise> promise) override; |
| 72 CdmContext* GetCdmContext() override; |
| 73 |
| 74 // media::CdmContext implementation. |
| 69 Decryptor* GetDecryptor() override; | 75 Decryptor* GetDecryptor() override; |
| 70 | 76 |
| 71 // media::Decryptor implementation. | 77 // media::Decryptor implementation. |
| 72 void RegisterNewKeyCB(StreamType stream_type, | 78 void RegisterNewKeyCB(StreamType stream_type, |
| 73 const NewKeyCB& key_added_cb) override; | 79 const NewKeyCB& key_added_cb) override; |
| 74 void Decrypt(StreamType stream_type, | 80 void Decrypt(StreamType stream_type, |
| 75 const scoped_refptr<media::DecoderBuffer>& encrypted, | 81 const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 76 const DecryptCB& decrypt_cb) override; | 82 const DecryptCB& decrypt_cb) override; |
| 77 void CancelDecrypt(StreamType stream_type) override; | 83 void CancelDecrypt(StreamType stream_type) override; |
| 78 void InitializeAudioDecoder(const media::AudioDecoderConfig& config, | 84 void InitializeAudioDecoder(const media::AudioDecoderConfig& config, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 152 |
| 147 // NOTE: Weak pointers must be invalidated before all other member variables. | 153 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 148 base::WeakPtrFactory<PpapiDecryptor> weak_ptr_factory_; | 154 base::WeakPtrFactory<PpapiDecryptor> weak_ptr_factory_; |
| 149 | 155 |
| 150 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); | 156 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); |
| 151 }; | 157 }; |
| 152 | 158 |
| 153 } // namespace content | 159 } // namespace content |
| 154 | 160 |
| 155 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ | 161 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ |
| OLD | NEW |