Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 AddKey(const std::string& key_system, | 49 virtual void AddKey(const std::string& key_system, |
| 50 const uint8* key, int key_length, | 50 const uint8* key, int key_length, |
| 51 const uint8* init_data, int init_data_length, | 51 const uint8* init_data, int init_data_length, |
| 52 const std::string& session_id) OVERRIDE; | 52 const std::string& session_id) OVERRIDE; |
| 53 virtual void CancelKeyRequest(const std::string& key_system, | 53 virtual void CancelKeyRequest(const std::string& key_system, |
| 54 const std::string& session_id) OVERRIDE; | 54 const std::string& session_id) OVERRIDE; |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 // Helper functions to create decryptors to handle the given |key_system|. | 57 // Helper functions to create MediaKeys to handle the given |key_system|. |
| 58 scoped_ptr<media::Decryptor> CreateDecryptor(const std::string& key_system); | 58 scoped_ptr<media::MediaKeys> CreateMediaKeys(const std::string& key_system); |
| 59 | |
| 59 #if defined(ENABLE_PEPPER_CDMS) | 60 #if defined(ENABLE_PEPPER_CDMS) |
| 60 scoped_ptr<media::Decryptor> CreatePpapiDecryptor( | 61 scoped_ptr<media::MediaKeys> CreatePpapiDecryptor( |
|
ddorwin
2013/06/19 00:14:35
"Decryptor" is odd in the name now. Should we repl
xhwang
2013/06/19 04:28:30
Do we also want to rename AesDecryptor to AesCdm?
| |
| 61 const std::string& key_system); | 62 const std::string& key_system); |
| 62 // Callback for cleaning up a Pepper CDM. | 63 // Callback for cleaning up a Pepper CDM. |
| 63 void DestroyHelperPlugin(); | 64 void DestroyHelperPlugin(); |
| 64 #endif // defined(ENABLE_PEPPER_CDMS) | 65 #endif // defined(ENABLE_PEPPER_CDMS) |
| 65 | 66 |
| 66 // Callbacks for firing key events. | 67 // Callbacks for firing key events. |
| 67 void KeyAdded(const std::string& key_system, const std::string& session_id); | 68 void KeyAdded(const std::string& key_system, const std::string& session_id); |
| 68 void KeyError(const std::string& key_system, | 69 void KeyError(const std::string& key_system, |
| 69 const std::string& session_id, | 70 const std::string& session_id, |
| 70 media::MediaKeys::KeyError error_code, | 71 media::MediaKeys::KeyError error_code, |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 87 media::KeyErrorCB key_error_cb_; | 88 media::KeyErrorCB key_error_cb_; |
| 88 media::KeyMessageCB key_message_cb_; | 89 media::KeyMessageCB key_message_cb_; |
| 89 media::NeedKeyCB need_key_cb_; | 90 media::NeedKeyCB need_key_cb_; |
| 90 | 91 |
| 91 // Protects the |decryptor_|. Note that |decryptor_| itself should be thread | 92 // Protects the |decryptor_|. Note that |decryptor_| itself should be thread |
| 92 // safe as per the Decryptor interface. | 93 // safe as per the Decryptor interface. |
| 93 base::Lock lock_; | 94 base::Lock lock_; |
| 94 | 95 |
| 95 media::DecryptorReadyCB decryptor_ready_cb_; | 96 media::DecryptorReadyCB decryptor_ready_cb_; |
| 96 | 97 |
| 97 // The real decryptor that does decryption for the ProxyDecryptor. | 98 // The real MediaKeys that manages key operations for the ProxyDecryptor. |
| 98 // This pointer is protected by the |lock_|. | 99 // This pointer is protected by the |lock_|. |
| 99 scoped_ptr<media::Decryptor> decryptor_; | 100 scoped_ptr<media::MediaKeys> media_keys_; |
| 100 | 101 |
| 101 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; | 102 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; |
| 102 | 103 |
| 103 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); | 104 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 } // namespace webkit_media | 107 } // namespace webkit_media |
| 107 | 108 |
| 108 #endif // WEBKIT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ | 109 #endif // WEBKIT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ |
| OLD | NEW |