| 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 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 const media::SessionCreatedCB& session_created_cb, | 35 const media::SessionCreatedCB& session_created_cb, |
| 36 const media::SessionMessageCB& session_message_cb, | 36 const media::SessionMessageCB& session_message_cb, |
| 37 const media::SessionReadyCB& session_ready_cb, | 37 const media::SessionReadyCB& session_ready_cb, |
| 38 const media::SessionClosedCB& session_closed_cb, | 38 const media::SessionClosedCB& session_closed_cb, |
| 39 const media::SessionErrorCB& session_error_cb, | 39 const media::SessionErrorCB& session_error_cb, |
| 40 const base::Closure& destroy_plugin_cb); | 40 const base::Closure& destroy_plugin_cb); |
| 41 | 41 |
| 42 virtual ~PpapiDecryptor(); | 42 virtual ~PpapiDecryptor(); |
| 43 | 43 |
| 44 // media::MediaKeys implementation. | 44 // media::MediaKeys implementation. |
| 45 virtual bool CreateSession(uint32 reference_id, | 45 virtual bool CreateSession(uint32 session_id, |
| 46 const std::string& type, | 46 const std::string& type, |
| 47 const uint8* init_data, | 47 const uint8* init_data, |
| 48 int init_data_length) OVERRIDE; | 48 int init_data_length) OVERRIDE; |
| 49 virtual void UpdateSession(uint32 reference_id, | 49 virtual void UpdateSession(uint32 session_id, |
| 50 const uint8* response, | 50 const uint8* response, |
| 51 int response_length) OVERRIDE; | 51 int response_length) OVERRIDE; |
| 52 virtual void ReleaseSession(uint32 reference_id) OVERRIDE; | 52 virtual void ReleaseSession(uint32 session_id) OVERRIDE; |
| 53 virtual Decryptor* GetDecryptor() OVERRIDE; | 53 virtual Decryptor* GetDecryptor() OVERRIDE; |
| 54 | 54 |
| 55 // media::Decryptor implementation. | 55 // media::Decryptor implementation. |
| 56 virtual void RegisterNewKeyCB(StreamType stream_type, | 56 virtual void RegisterNewKeyCB(StreamType stream_type, |
| 57 const NewKeyCB& key_added_cb) OVERRIDE; | 57 const NewKeyCB& key_added_cb) OVERRIDE; |
| 58 virtual void Decrypt(StreamType stream_type, | 58 virtual void Decrypt(StreamType stream_type, |
| 59 const scoped_refptr<media::DecoderBuffer>& encrypted, | 59 const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 60 const DecryptCB& decrypt_cb) OVERRIDE; | 60 const DecryptCB& decrypt_cb) OVERRIDE; |
| 61 virtual void CancelDecrypt(StreamType stream_type) OVERRIDE; | 61 virtual void CancelDecrypt(StreamType stream_type) OVERRIDE; |
| 62 virtual void InitializeAudioDecoder(const media::AudioDecoderConfig& config, | 62 virtual void InitializeAudioDecoder(const media::AudioDecoderConfig& config, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 75 private: | 75 private: |
| 76 PpapiDecryptor(const scoped_refptr<PepperPluginInstanceImpl>& plugin_instance, | 76 PpapiDecryptor(const scoped_refptr<PepperPluginInstanceImpl>& plugin_instance, |
| 77 ContentDecryptorDelegate* plugin_cdm_delegate, | 77 ContentDecryptorDelegate* plugin_cdm_delegate, |
| 78 const media::SessionCreatedCB& session_created_cb, | 78 const media::SessionCreatedCB& session_created_cb, |
| 79 const media::SessionMessageCB& session_message_cb, | 79 const media::SessionMessageCB& session_message_cb, |
| 80 const media::SessionReadyCB& session_ready_cb, | 80 const media::SessionReadyCB& session_ready_cb, |
| 81 const media::SessionClosedCB& session_closed_cb, | 81 const media::SessionClosedCB& session_closed_cb, |
| 82 const media::SessionErrorCB& session_error_cb, | 82 const media::SessionErrorCB& session_error_cb, |
| 83 const base::Closure& destroy_plugin_cb); | 83 const base::Closure& destroy_plugin_cb); |
| 84 | 84 |
| 85 void ReportFailureToCallPlugin(uint32 reference_id); | 85 void ReportFailureToCallPlugin(uint32 session_id); |
| 86 | 86 |
| 87 void OnDecoderInitialized(StreamType stream_type, bool success); | 87 void OnDecoderInitialized(StreamType stream_type, bool success); |
| 88 | 88 |
| 89 // Callbacks for |plugin_cdm_delegate_| to fire session events. | 89 // Callbacks for |plugin_cdm_delegate_| to fire session events. |
| 90 void OnSessionCreated(uint32 reference_id, const std::string& session_id); | 90 void OnSessionCreated(uint32 session_id, const std::string& web_session_id); |
| 91 void OnSessionMessage(uint32 reference_id, | 91 void OnSessionMessage(uint32 session_id, |
| 92 const std::vector<uint8>& message, | 92 const std::vector<uint8>& message, |
| 93 const std::string& destination_url); | 93 const std::string& destination_url); |
| 94 void OnSessionReady(uint32 reference_id); | 94 void OnSessionReady(uint32 session_id); |
| 95 void OnSessionClosed(uint32 reference_id); | 95 void OnSessionClosed(uint32 session_id); |
| 96 void OnSessionError(uint32 reference_id, | 96 void OnSessionError(uint32 session_id, |
| 97 media::MediaKeys::KeyError error_code, | 97 media::MediaKeys::KeyError error_code, |
| 98 int system_code); | 98 int system_code); |
| 99 | 99 |
| 100 base::WeakPtr<PpapiDecryptor> weak_this_; | 100 base::WeakPtr<PpapiDecryptor> weak_this_; |
| 101 | 101 |
| 102 // Hold a reference of the plugin instance to make sure the plugin outlives | 102 // Hold a reference of the plugin instance to make sure the plugin outlives |
| 103 // the |plugin_cdm_delegate_|. This is needed because |plugin_cdm_delegate_| | 103 // the |plugin_cdm_delegate_|. This is needed because |plugin_cdm_delegate_| |
| 104 // is owned by the |plugin_instance_|. | 104 // is owned by the |plugin_instance_|. |
| 105 scoped_refptr<PepperPluginInstanceImpl> plugin_instance_; | 105 scoped_refptr<PepperPluginInstanceImpl> plugin_instance_; |
| 106 | 106 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 124 NewKeyCB new_video_key_cb_; | 124 NewKeyCB new_video_key_cb_; |
| 125 | 125 |
| 126 base::WeakPtrFactory<PpapiDecryptor> weak_ptr_factory_; | 126 base::WeakPtrFactory<PpapiDecryptor> weak_ptr_factory_; |
| 127 | 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); | 128 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 } // namespace content | 131 } // namespace content |
| 132 | 132 |
| 133 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ | 133 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ |
| OLD | NEW |