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 #include "content/renderer/media/crypto/proxy_decryptor.h" | 5 #include "content/renderer/media/crypto/proxy_decryptor.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "content/renderer/media/crypto/content_decryption_module_factory.h" | 13 #include "content/renderer/media/crypto/content_decryption_module_factory.h" |
14 #include "media/cdm/json_web_key.h" | 14 #include "media/cdm/json_web_key.h" |
15 #include "media/cdm/key_system_names.h" | 15 #include "media/cdm/key_system_names.h" |
16 | 16 |
17 #if defined(ENABLE_PEPPER_CDMS) | 17 #if defined(ENABLE_PEPPER_CDMS) |
18 #include "content/renderer/media/crypto/pepper_cdm_wrapper.h" | 18 #include "content/renderer/media/crypto/pepper_cdm_wrapper.h" |
19 #endif // defined(ENABLE_PEPPER_CDMS) | 19 #endif // defined(ENABLE_PEPPER_CDMS) |
20 | 20 |
21 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
22 #include "content/renderer/media/android/renderer_media_player_manager.h" | 22 #include "content/renderer/media/crypto/renderer_cdm_manager.h" |
23 #endif // defined(OS_ANDROID) | 23 #endif // defined(OS_ANDROID) |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 | 26 |
27 // Since these reference IDs may conflict with the ones generated in | 27 // Since these reference IDs may conflict with the ones generated in |
28 // WebContentDecryptionModuleSessionImpl for the short time both paths are | 28 // WebContentDecryptionModuleSessionImpl for the short time both paths are |
29 // active, start with 100000 and generate the IDs from there. | 29 // active, start with 100000 and generate the IDs from there. |
30 // TODO(jrummell): Only allow one path http://crbug.com/306680. | 30 // TODO(jrummell): Only allow one path http://crbug.com/306680. |
31 uint32 ProxyDecryptor::next_session_id_ = 100000; | 31 uint32 ProxyDecryptor::next_session_id_ = 100000; |
32 | 32 |
33 const uint32 kInvalidSessionId = 0; | 33 const uint32 kInvalidSessionId = 0; |
34 | 34 |
35 // Special system code to signal a closed persistent session in a SessionError() | 35 // Special system code to signal a closed persistent session in a SessionError() |
36 // call. This is needed because there is no SessionClosed() call in the prefixed | 36 // call. This is needed because there is no SessionClosed() call in the prefixed |
37 // EME API. | 37 // EME API. |
38 const int kSessionClosedSystemCode = 29127; | 38 const int kSessionClosedSystemCode = 29127; |
39 | 39 |
40 ProxyDecryptor::ProxyDecryptor( | 40 ProxyDecryptor::ProxyDecryptor( |
41 #if defined(ENABLE_PEPPER_CDMS) | 41 #if defined(ENABLE_PEPPER_CDMS) |
42 const CreatePepperCdmCB& create_pepper_cdm_cb, | 42 const CreatePepperCdmCB& create_pepper_cdm_cb, |
43 #elif defined(OS_ANDROID) | 43 #elif defined(OS_ANDROID) |
44 RendererMediaPlayerManager* manager, | 44 RendererCdmManager* manager, |
45 #endif // defined(ENABLE_PEPPER_CDMS) | 45 #endif // defined(ENABLE_PEPPER_CDMS) |
46 const KeyAddedCB& key_added_cb, | 46 const KeyAddedCB& key_added_cb, |
47 const KeyErrorCB& key_error_cb, | 47 const KeyErrorCB& key_error_cb, |
48 const KeyMessageCB& key_message_cb) | 48 const KeyMessageCB& key_message_cb) |
49 : | 49 : |
50 #if defined(ENABLE_PEPPER_CDMS) | 50 #if defined(ENABLE_PEPPER_CDMS) |
51 create_pepper_cdm_cb_(create_pepper_cdm_cb), | 51 create_pepper_cdm_cb_(create_pepper_cdm_cb), |
52 #elif defined(OS_ANDROID) | 52 #elif defined(OS_ANDROID) |
53 manager_(manager), | 53 manager_(manager), |
54 cdm_id_(RendererMediaPlayerManager::kInvalidCdmId), | 54 cdm_id_(RendererCdmManager::kInvalidCdmId), |
55 #endif // defined(ENABLE_PEPPER_CDMS) | 55 #endif // defined(ENABLE_PEPPER_CDMS) |
56 key_added_cb_(key_added_cb), | 56 key_added_cb_(key_added_cb), |
57 key_error_cb_(key_error_cb), | 57 key_error_cb_(key_error_cb), |
58 key_message_cb_(key_message_cb), | 58 key_message_cb_(key_message_cb), |
59 is_clear_key_(false), | 59 is_clear_key_(false), |
60 weak_ptr_factory_(this) { | 60 weak_ptr_factory_(this) { |
61 #if defined(ENABLE_PEPPER_CDMS) | 61 #if defined(ENABLE_PEPPER_CDMS) |
62 DCHECK(!create_pepper_cdm_cb_.is_null()); | 62 DCHECK(!create_pepper_cdm_cb_.is_null()); |
63 #endif // defined(ENABLE_PEPPER_CDMS) | 63 #endif // defined(ENABLE_PEPPER_CDMS) |
64 DCHECK(!key_added_cb_.is_null()); | 64 DCHECK(!key_added_cb_.is_null()); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 const std::string& ProxyDecryptor::LookupWebSessionId(uint32 session_id) const { | 270 const std::string& ProxyDecryptor::LookupWebSessionId(uint32 session_id) const { |
271 DCHECK_NE(session_id, kInvalidSessionId); | 271 DCHECK_NE(session_id, kInvalidSessionId); |
272 | 272 |
273 // Session may not exist if error happens during GenerateKeyRequest(). | 273 // Session may not exist if error happens during GenerateKeyRequest(). |
274 SessionIdMap::const_iterator it = sessions_.find(session_id); | 274 SessionIdMap::const_iterator it = sessions_.find(session_id); |
275 return (it != sessions_.end()) ? it->second : base::EmptyString(); | 275 return (it != sessions_.end()) ? it->second : base::EmptyString(); |
276 } | 276 } |
277 | 277 |
278 } // namespace content | 278 } // namespace content |
OLD | NEW |