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 "media/cdm/proxy_decryptor.h" | 5 #include "media/cdm/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 "media/base/cdm_callback_promise.h" | 13 #include "media/base/cdm_callback_promise.h" |
14 #include "media/base/cdm_factory.h" | 14 #include "media/base/cdm_factory.h" |
15 #include "media/base/cdm_key_information.h" | 15 #include "media/base/cdm_key_information.h" |
16 #include "media/base/key_systems.h" | 16 #include "media/base/key_systems.h" |
| 17 #include "media/base/media_permission.h" |
17 #include "media/cdm/json_web_key.h" | 18 #include "media/cdm/json_web_key.h" |
18 #include "media/cdm/key_system_names.h" | 19 #include "media/cdm/key_system_names.h" |
19 | 20 |
20 namespace media { | 21 namespace media { |
21 | 22 |
22 // Special system code to signal a closed persistent session in a SessionError() | 23 // Special system code to signal a closed persistent session in a SessionError() |
23 // call. This is needed because there is no SessionClosed() call in the prefixed | 24 // call. This is needed because there is no SessionClosed() call in the prefixed |
24 // EME API. | 25 // EME API. |
25 const int kSessionClosedSystemCode = 29127; | 26 const int kSessionClosedSystemCode = 29127; |
26 | 27 |
27 ProxyDecryptor::ProxyDecryptor(const KeyAddedCB& key_added_cb, | 28 ProxyDecryptor::ProxyDecryptor(MediaPermission* media_permission, |
| 29 const KeyAddedCB& key_added_cb, |
28 const KeyErrorCB& key_error_cb, | 30 const KeyErrorCB& key_error_cb, |
29 const KeyMessageCB& key_message_cb) | 31 const KeyMessageCB& key_message_cb) |
30 : key_added_cb_(key_added_cb), | 32 : key_added_cb_(key_added_cb), |
31 key_error_cb_(key_error_cb), | 33 key_error_cb_(key_error_cb), |
32 key_message_cb_(key_message_cb), | 34 key_message_cb_(key_message_cb), |
33 is_clear_key_(false), | 35 is_clear_key_(false), |
34 weak_ptr_factory_(this) { | 36 weak_ptr_factory_(this) { |
| 37 DCHECK(media_permission); |
35 DCHECK(!key_added_cb_.is_null()); | 38 DCHECK(!key_added_cb_.is_null()); |
36 DCHECK(!key_error_cb_.is_null()); | 39 DCHECK(!key_error_cb_.is_null()); |
37 DCHECK(!key_message_cb_.is_null()); | 40 DCHECK(!key_message_cb_.is_null()); |
38 } | 41 } |
39 | 42 |
40 ProxyDecryptor::~ProxyDecryptor() { | 43 ProxyDecryptor::~ProxyDecryptor() { |
41 // Destroy the decryptor explicitly before destroying the plugin. | 44 // Destroy the decryptor explicitly before destroying the plugin. |
42 media_keys_.reset(); | 45 media_keys_.reset(); |
43 } | 46 } |
44 | 47 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 bool is_persistent = | 296 bool is_persistent = |
294 session_type == PersistentSession || session_type == LoadSession; | 297 session_type == PersistentSession || session_type == LoadSession; |
295 active_sessions_.insert(std::make_pair(session_id, is_persistent)); | 298 active_sessions_.insert(std::make_pair(session_id, is_persistent)); |
296 | 299 |
297 // For LoadSession(), generate the KeyAdded event. | 300 // For LoadSession(), generate the KeyAdded event. |
298 if (session_type == LoadSession) | 301 if (session_type == LoadSession) |
299 GenerateKeyAdded(session_id); | 302 GenerateKeyAdded(session_id); |
300 } | 303 } |
301 | 304 |
302 } // namespace media | 305 } // namespace media |
OLD | NEW |