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/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "media/base/cdm_callback_promise.h" | 14 #include "media/base/cdm_callback_promise.h" |
15 #include "media/base/cdm_config.h" | |
15 #include "media/base/cdm_factory.h" | 16 #include "media/base/cdm_factory.h" |
16 #include "media/base/cdm_key_information.h" | 17 #include "media/base/cdm_key_information.h" |
17 #include "media/base/key_systems.h" | 18 #include "media/base/key_systems.h" |
18 #include "media/base/media_permission.h" | 19 #include "media/base/media_permission.h" |
19 #include "media/cdm/json_web_key.h" | 20 #include "media/cdm/json_web_key.h" |
20 #include "media/cdm/key_system_names.h" | 21 #include "media/cdm/key_system_names.h" |
21 | 22 |
22 namespace media { | 23 namespace media { |
23 | 24 |
24 // Special system code to signal a closed persistent session in a SessionError() | 25 // Special system code to signal a closed persistent session in a SessionError() |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 } | 60 } |
60 | 61 |
61 void ProxyDecryptor::CreateCdm(CdmFactory* cdm_factory, | 62 void ProxyDecryptor::CreateCdm(CdmFactory* cdm_factory, |
62 const std::string& key_system, | 63 const std::string& key_system, |
63 const GURL& security_origin, | 64 const GURL& security_origin, |
64 const CdmContextReadyCB& cdm_context_ready_cb) { | 65 const CdmContextReadyCB& cdm_context_ready_cb) { |
65 DVLOG(1) << __FUNCTION__ << ": key_system = " << key_system; | 66 DVLOG(1) << __FUNCTION__ << ": key_system = " << key_system; |
66 DCHECK(!is_creating_cdm_); | 67 DCHECK(!is_creating_cdm_); |
67 DCHECK(!media_keys_); | 68 DCHECK(!media_keys_); |
68 | 69 |
69 // TODO(sandersd): Trigger permissions check here and use it to determine | 70 // TODO(sandersd): Trigger permissions check here and use it to determine |
ddorwin
2015/05/13 06:03:21
What exactly needs to be done here? Do we need to
sandersd (OOO until July 31)
2015/05/14 00:06:57
Yes, although there are synchronization issues we
| |
70 // distinctive identifier support, instead of always requiring the | 71 // distinctive identifier support, instead of always requiring the |
71 // permission. http://crbug.com/455271 | 72 // permission. http://crbug.com/455271 |
72 bool allow_distinctive_identifier = true; | 73 CdmConfig cdm_config; |
73 bool allow_persistent_state = true; | 74 cdm_config.allow_distinctive_identifier = true; |
75 cdm_config.allow_persistent_state = true; | |
74 | 76 |
75 is_creating_cdm_ = true; | 77 is_creating_cdm_ = true; |
76 | 78 |
77 base::WeakPtr<ProxyDecryptor> weak_this = weak_ptr_factory_.GetWeakPtr(); | 79 base::WeakPtr<ProxyDecryptor> weak_this = weak_ptr_factory_.GetWeakPtr(); |
78 cdm_factory->Create( | 80 cdm_factory->Create( |
79 key_system, allow_distinctive_identifier, allow_persistent_state, | 81 key_system, security_origin, cdm_config, |
80 security_origin, base::Bind(&ProxyDecryptor::OnSessionMessage, weak_this), | 82 base::Bind(&ProxyDecryptor::OnSessionMessage, weak_this), |
81 base::Bind(&ProxyDecryptor::OnSessionClosed, weak_this), | 83 base::Bind(&ProxyDecryptor::OnSessionClosed, weak_this), |
82 base::Bind(&ProxyDecryptor::OnLegacySessionError, weak_this), | 84 base::Bind(&ProxyDecryptor::OnLegacySessionError, weak_this), |
83 base::Bind(&ProxyDecryptor::OnSessionKeysChange, weak_this), | 85 base::Bind(&ProxyDecryptor::OnSessionKeysChange, weak_this), |
84 base::Bind(&ProxyDecryptor::OnSessionExpirationUpdate, weak_this), | 86 base::Bind(&ProxyDecryptor::OnSessionExpirationUpdate, weak_this), |
85 base::Bind(&ProxyDecryptor::OnCdmCreated, weak_this, key_system, | 87 base::Bind(&ProxyDecryptor::OnCdmCreated, weak_this, key_system, |
86 security_origin, cdm_context_ready_cb)); | 88 security_origin, cdm_context_ready_cb)); |
87 } | 89 } |
88 | 90 |
89 void ProxyDecryptor::OnCdmCreated(const std::string& key_system, | 91 void ProxyDecryptor::OnCdmCreated(const std::string& key_system, |
90 const GURL& security_origin, | 92 const GURL& security_origin, |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
388 bool is_persistent = | 390 bool is_persistent = |
389 session_type == PersistentSession || session_type == LoadSession; | 391 session_type == PersistentSession || session_type == LoadSession; |
390 active_sessions_.insert(std::make_pair(session_id, is_persistent)); | 392 active_sessions_.insert(std::make_pair(session_id, is_persistent)); |
391 | 393 |
392 // For LoadSession(), generate the KeyAdded event. | 394 // For LoadSession(), generate the KeyAdded event. |
393 if (session_type == LoadSession) | 395 if (session_type == LoadSession) |
394 GenerateKeyAdded(session_id); | 396 GenerateKeyAdded(session_id); |
395 } | 397 } |
396 | 398 |
397 } // namespace media | 399 } // namespace media |
OLD | NEW |