| 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_PROXY_DECRYPTOR_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ | 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "media/base/decryptor.h" | 17 #include "media/base/decryptor.h" |
| 18 #include "media/base/media_keys.h" | 18 #include "media/base/media_keys.h" |
| 19 | 19 |
| 20 #if defined(ENABLE_PEPPER_CDMS) | 20 #if defined(ENABLE_PEPPER_CDMS) |
| 21 #include "content/renderer/media/crypto/pepper_cdm_wrapper.h" | 21 #include "content/renderer/media/crypto/pepper_cdm_wrapper.h" |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 class GURL; | 24 class GURL; |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 | 27 |
| 28 #if defined(OS_ANDROID) | 28 #if defined(OS_ANDROID) |
| 29 class RendererMediaPlayerManager; | 29 class RendererCdmManager; |
| 30 #endif // defined(OS_ANDROID) | 30 #endif // defined(OS_ANDROID) |
| 31 | 31 |
| 32 // ProxyDecryptor is for EME v0.1b only. It should not be used for the WD API. | 32 // ProxyDecryptor is for EME v0.1b only. It should not be used for the WD API. |
| 33 // A decryptor proxy that creates a real decryptor object on demand and | 33 // A decryptor proxy that creates a real decryptor object on demand and |
| 34 // forwards decryptor calls to it. | 34 // forwards decryptor calls to it. |
| 35 // | 35 // |
| 36 // Now that the Pepper API calls use session ID to match responses with | 36 // Now that the Pepper API calls use session ID to match responses with |
| 37 // requests, this class maintains a mapping between session ID and web session | 37 // requests, this class maintains a mapping between session ID and web session |
| 38 // ID. Callers of this class expect web session IDs in the responses. | 38 // ID. Callers of this class expect web session IDs in the responses. |
| 39 // Session IDs are internal unique references to the session. Web session IDs | 39 // Session IDs are internal unique references to the session. Web session IDs |
| (...skipping 11 matching lines...) Expand all Loading... |
| 51 media::MediaKeys::KeyError error_code, | 51 media::MediaKeys::KeyError error_code, |
| 52 uint32 system_code)> KeyErrorCB; | 52 uint32 system_code)> KeyErrorCB; |
| 53 typedef base::Callback<void(const std::string& session_id, | 53 typedef base::Callback<void(const std::string& session_id, |
| 54 const std::vector<uint8>& message, | 54 const std::vector<uint8>& message, |
| 55 const std::string& default_url)> KeyMessageCB; | 55 const std::string& default_url)> KeyMessageCB; |
| 56 | 56 |
| 57 ProxyDecryptor( | 57 ProxyDecryptor( |
| 58 #if defined(ENABLE_PEPPER_CDMS) | 58 #if defined(ENABLE_PEPPER_CDMS) |
| 59 const CreatePepperCdmCB& create_pepper_cdm_cb, | 59 const CreatePepperCdmCB& create_pepper_cdm_cb, |
| 60 #elif defined(OS_ANDROID) | 60 #elif defined(OS_ANDROID) |
| 61 RendererMediaPlayerManager* manager, | 61 RendererCdmManager* manager, |
| 62 #endif // defined(ENABLE_PEPPER_CDMS) | 62 #endif // defined(ENABLE_PEPPER_CDMS) |
| 63 const KeyAddedCB& key_added_cb, | 63 const KeyAddedCB& key_added_cb, |
| 64 const KeyErrorCB& key_error_cb, | 64 const KeyErrorCB& key_error_cb, |
| 65 const KeyMessageCB& key_message_cb); | 65 const KeyMessageCB& key_message_cb); |
| 66 virtual ~ProxyDecryptor(); | 66 virtual ~ProxyDecryptor(); |
| 67 | 67 |
| 68 // Returns the Decryptor associated with this object. May be NULL if no | 68 // Returns the Decryptor associated with this object. May be NULL if no |
| 69 // Decryptor is associated. | 69 // Decryptor is associated. |
| 70 media::Decryptor* GetDecryptor(); | 70 media::Decryptor* GetDecryptor(); |
| 71 | 71 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 // Helper function to determine web_session_id for the provided |session_id|. | 113 // Helper function to determine web_session_id for the provided |session_id|. |
| 114 // The returned web_session_id is only valid on the main thread, and should be | 114 // The returned web_session_id is only valid on the main thread, and should be |
| 115 // stored by copy. | 115 // stored by copy. |
| 116 const std::string& LookupWebSessionId(uint32 session_id) const; | 116 const std::string& LookupWebSessionId(uint32 session_id) const; |
| 117 | 117 |
| 118 #if defined(ENABLE_PEPPER_CDMS) | 118 #if defined(ENABLE_PEPPER_CDMS) |
| 119 // Callback to create the Pepper plugin. | 119 // Callback to create the Pepper plugin. |
| 120 CreatePepperCdmCB create_pepper_cdm_cb_; | 120 CreatePepperCdmCB create_pepper_cdm_cb_; |
| 121 #elif defined(OS_ANDROID) | 121 #elif defined(OS_ANDROID) |
| 122 RendererMediaPlayerManager* manager_; | 122 RendererCdmManager* manager_; |
| 123 int cdm_id_; | 123 int cdm_id_; |
| 124 #endif // defined(ENABLE_PEPPER_CDMS) | 124 #endif // defined(ENABLE_PEPPER_CDMS) |
| 125 | 125 |
| 126 // The real MediaKeys that manages key operations for the ProxyDecryptor. | 126 // The real MediaKeys that manages key operations for the ProxyDecryptor. |
| 127 scoped_ptr<media::MediaKeys> media_keys_; | 127 scoped_ptr<media::MediaKeys> media_keys_; |
| 128 | 128 |
| 129 // Callbacks for firing key events. | 129 // Callbacks for firing key events. |
| 130 KeyAddedCB key_added_cb_; | 130 KeyAddedCB key_added_cb_; |
| 131 KeyErrorCB key_error_cb_; | 131 KeyErrorCB key_error_cb_; |
| 132 KeyMessageCB key_message_cb_; | 132 KeyMessageCB key_message_cb_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 144 | 144 |
| 145 // NOTE: Weak pointers must be invalidated before all other member variables. | 145 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 146 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; | 146 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; |
| 147 | 147 |
| 148 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); | 148 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } // namespace content | 151 } // namespace content |
| 152 | 152 |
| 153 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ | 153 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ |
| OLD | NEW |