| 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 WEBKIT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ | 5 #ifndef WEBKIT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ |
| 6 #define WEBKIT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ | 6 #define WEBKIT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // May only be called after InitializeCDM() succeeds. | 48 // May only be called after InitializeCDM() succeeds. |
| 49 virtual bool GenerateKeyRequest(const std::string& type, | 49 virtual bool GenerateKeyRequest(const std::string& type, |
| 50 const uint8* init_data, | 50 const uint8* init_data, |
| 51 int init_data_length) OVERRIDE; | 51 int init_data_length) OVERRIDE; |
| 52 virtual void AddKey(const uint8* key, int key_length, | 52 virtual void AddKey(const uint8* key, int key_length, |
| 53 const uint8* init_data, int init_data_length, | 53 const uint8* init_data, int init_data_length, |
| 54 const std::string& session_id) OVERRIDE; | 54 const std::string& session_id) OVERRIDE; |
| 55 virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE; | 55 virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE; |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 // Helper functions to create decryptors to handle the given |key_system|. | 58 // Helper functions to create MediaKeys to handle the given |key_system|. |
| 59 scoped_ptr<media::Decryptor> CreateDecryptor(const std::string& key_system); | 59 scoped_ptr<media::MediaKeys> CreateMediaKeys(const std::string& key_system); |
| 60 |
| 60 #if defined(ENABLE_PEPPER_CDMS) | 61 #if defined(ENABLE_PEPPER_CDMS) |
| 61 scoped_ptr<media::Decryptor> CreatePpapiDecryptor( | 62 scoped_ptr<media::MediaKeys> CreatePpapiDecryptor( |
| 62 const std::string& key_system); | 63 const std::string& key_system); |
| 63 // Callback for cleaning up a Pepper CDM. | 64 // Callback for cleaning up a Pepper CDM. |
| 64 void DestroyHelperPlugin(); | 65 void DestroyHelperPlugin(); |
| 65 #endif // defined(ENABLE_PEPPER_CDMS) | 66 #endif // defined(ENABLE_PEPPER_CDMS) |
| 66 | 67 |
| 67 // Callbacks for firing key events. | 68 // Callbacks for firing key events. |
| 68 void KeyAdded(const std::string& session_id); | 69 void KeyAdded(const std::string& session_id); |
| 69 void KeyError(const std::string& session_id, | 70 void KeyError(const std::string& session_id, |
| 70 media::MediaKeys::KeyError error_code, | 71 media::MediaKeys::KeyError error_code, |
| 71 int system_code); | 72 int system_code); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 85 media::KeyErrorCB key_error_cb_; | 86 media::KeyErrorCB key_error_cb_; |
| 86 media::KeyMessageCB key_message_cb_; | 87 media::KeyMessageCB key_message_cb_; |
| 87 media::NeedKeyCB need_key_cb_; | 88 media::NeedKeyCB need_key_cb_; |
| 88 | 89 |
| 89 // Protects the |decryptor_|. Note that |decryptor_| itself should be thread | 90 // Protects the |decryptor_|. Note that |decryptor_| itself should be thread |
| 90 // safe as per the Decryptor interface. | 91 // safe as per the Decryptor interface. |
| 91 base::Lock lock_; | 92 base::Lock lock_; |
| 92 | 93 |
| 93 media::DecryptorReadyCB decryptor_ready_cb_; | 94 media::DecryptorReadyCB decryptor_ready_cb_; |
| 94 | 95 |
| 95 // The real decryptor that does decryption for the ProxyDecryptor. | 96 // The real MediaKeys that manages key operations for the ProxyDecryptor. |
| 96 // This pointer is protected by the |lock_|. | 97 // This pointer is protected by the |lock_|. |
| 97 scoped_ptr<media::Decryptor> decryptor_; | 98 scoped_ptr<media::MediaKeys> media_keys_; |
| 98 | 99 |
| 99 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; | 100 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; |
| 100 | 101 |
| 101 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); | 102 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); |
| 102 }; | 103 }; |
| 103 | 104 |
| 104 } // namespace webkit_media | 105 } // namespace webkit_media |
| 105 | 106 |
| 106 #endif // WEBKIT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ | 107 #endif // WEBKIT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ |
| OLD | NEW |