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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // TODO(xhwang): Currently we don't support run-time switching among decryptor | 42 // TODO(xhwang): Currently we don't support run-time switching among decryptor |
43 // objects. Fix this when needed. | 43 // objects. Fix this when needed. |
44 // TODO(xhwang): The ProxyDecryptor is not a Decryptor. Find a better name! | 44 // TODO(xhwang): The ProxyDecryptor is not a Decryptor. Find a better name! |
45 class ProxyDecryptor { | 45 class ProxyDecryptor { |
46 public: | 46 public: |
47 // These are similar to the callbacks in media_keys.h, but pass back the | 47 // These are similar to the callbacks in media_keys.h, but pass back the |
48 // web session ID rather than the internal session ID. | 48 // web session ID rather than the internal session ID. |
49 typedef base::Callback<void(const std::string& session_id)> KeyAddedCB; | 49 typedef base::Callback<void(const std::string& session_id)> KeyAddedCB; |
50 typedef base::Callback<void(const std::string& session_id, | 50 typedef base::Callback<void(const std::string& session_id, |
51 media::MediaKeys::KeyError error_code, | 51 media::MediaKeys::KeyError error_code, |
52 int 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 RendererMediaPlayerManager* manager, |
62 int cdm_id, | 62 int cdm_id, |
(...skipping 29 matching lines...) Expand all Loading... |
92 | 92 |
93 // Callbacks for firing session events. | 93 // Callbacks for firing session events. |
94 void OnSessionCreated(uint32 session_id, const std::string& web_session_id); | 94 void OnSessionCreated(uint32 session_id, const std::string& web_session_id); |
95 void OnSessionMessage(uint32 session_id, | 95 void OnSessionMessage(uint32 session_id, |
96 const std::vector<uint8>& message, | 96 const std::vector<uint8>& message, |
97 const std::string& default_url); | 97 const std::string& default_url); |
98 void OnSessionReady(uint32 session_id); | 98 void OnSessionReady(uint32 session_id); |
99 void OnSessionClosed(uint32 session_id); | 99 void OnSessionClosed(uint32 session_id); |
100 void OnSessionError(uint32 session_id, | 100 void OnSessionError(uint32 session_id, |
101 media::MediaKeys::KeyError error_code, | 101 media::MediaKeys::KeyError error_code, |
102 int 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_; | 112 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; |
(...skipping 24 matching lines...) Expand all Loading... |
137 std::set<uint32> persistent_sessions_; | 137 std::set<uint32> persistent_sessions_; |
138 | 138 |
139 bool is_clear_key_; | 139 bool is_clear_key_; |
140 | 140 |
141 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); | 141 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); |
142 }; | 142 }; |
143 | 143 |
144 } // namespace content | 144 } // namespace content |
145 | 145 |
146 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ | 146 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ |
OLD | NEW |