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> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 uint32 system_code); | 102 uint32 system_code); |
103 | 103 |
104 // Helper function to determine session_id for the provided |web_session_id|. | 104 // Helper function to determine session_id for the provided |web_session_id|. |
105 uint32 LookupSessionId(const std::string& web_session_id) const; | 105 uint32 LookupSessionId(const std::string& web_session_id) const; |
106 | 106 |
107 // Helper function to determine web_session_id for the provided |session_id|. | 107 // Helper function to determine web_session_id for the provided |session_id|. |
108 // The returned web_session_id is only valid on the main thread, and should be | 108 // The returned web_session_id is only valid on the main thread, and should be |
109 // stored by copy. | 109 // stored by copy. |
110 const std::string& LookupWebSessionId(uint32 session_id) const; | 110 const std::string& LookupWebSessionId(uint32 session_id) const; |
111 | 111 |
112 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; | |
113 | |
114 #if defined(ENABLE_PEPPER_CDMS) | 112 #if defined(ENABLE_PEPPER_CDMS) |
115 // Callback to create the Pepper plugin. | 113 // Callback to create the Pepper plugin. |
116 CreatePepperCdmCB create_pepper_cdm_cb_; | 114 CreatePepperCdmCB create_pepper_cdm_cb_; |
117 #elif defined(OS_ANDROID) | 115 #elif defined(OS_ANDROID) |
118 RendererMediaPlayerManager* manager_; | 116 RendererMediaPlayerManager* manager_; |
119 int cdm_id_; | 117 int cdm_id_; |
120 #endif // defined(ENABLE_PEPPER_CDMS) | 118 #endif // defined(ENABLE_PEPPER_CDMS) |
121 | 119 |
122 // The real MediaKeys that manages key operations for the ProxyDecryptor. | 120 // The real MediaKeys that manages key operations for the ProxyDecryptor. |
123 scoped_ptr<media::MediaKeys> media_keys_; | 121 scoped_ptr<media::MediaKeys> media_keys_; |
124 | 122 |
125 // Callbacks for firing key events. | 123 // Callbacks for firing key events. |
126 KeyAddedCB key_added_cb_; | 124 KeyAddedCB key_added_cb_; |
127 KeyErrorCB key_error_cb_; | 125 KeyErrorCB key_error_cb_; |
128 KeyMessageCB key_message_cb_; | 126 KeyMessageCB key_message_cb_; |
129 | 127 |
130 // Session IDs are used to uniquely track sessions so that CDM callbacks | 128 // Session IDs are used to uniquely track sessions so that CDM callbacks |
131 // can get mapped to the correct session ID. Session ID should be unique | 129 // can get mapped to the correct session ID. Session ID should be unique |
132 // per renderer process for debugging purposes. | 130 // per renderer process for debugging purposes. |
133 static uint32 next_session_id_; | 131 static uint32 next_session_id_; |
134 | 132 |
135 SessionIdMap sessions_; | 133 SessionIdMap sessions_; |
136 | 134 |
137 std::set<uint32> persistent_sessions_; | 135 std::set<uint32> persistent_sessions_; |
138 | 136 |
139 bool is_clear_key_; | 137 bool is_clear_key_; |
140 | 138 |
| 139 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 140 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; |
| 141 |
141 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); | 142 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); |
142 }; | 143 }; |
143 | 144 |
144 } // namespace content | 145 } // namespace content |
145 | 146 |
146 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ | 147 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ |
OLD | NEW |