Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: content/renderer/media/crypto/proxy_decryptor.cc

Issue 318753010: Introduce the ENABLE_BROWSER_CDMS macro. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MEDIA_EXPORT Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/base/cdm_promise.h" 14 #include "media/base/cdm_promise.h"
15 #include "media/cdm/json_web_key.h" 15 #include "media/cdm/json_web_key.h"
16 #include "media/cdm/key_system_names.h" 16 #include "media/cdm/key_system_names.h"
17 17
18 #if defined(ENABLE_PEPPER_CDMS) 18 #if defined(ENABLE_PEPPER_CDMS)
19 #include "content/renderer/media/crypto/pepper_cdm_wrapper.h" 19 #include "content/renderer/media/crypto/pepper_cdm_wrapper.h"
20 #endif // defined(ENABLE_PEPPER_CDMS) 20 #endif // defined(ENABLE_PEPPER_CDMS)
21 21
22 #if defined(OS_ANDROID) 22 #if defined(ENABLE_BROWSER_CDMS)
23 #include "content/renderer/media/crypto/renderer_cdm_manager.h" 23 #include "content/renderer/media/crypto/renderer_cdm_manager.h"
24 #endif // defined(OS_ANDROID) 24 #endif // defined(ENABLE_BROWSER_CDMS)
25 25
26 namespace content { 26 namespace content {
27 27
28 // Special system code to signal a closed persistent session in a SessionError() 28 // Special system code to signal a closed persistent session in a SessionError()
29 // call. This is needed because there is no SessionClosed() call in the prefixed 29 // call. This is needed because there is no SessionClosed() call in the prefixed
30 // EME API. 30 // EME API.
31 const int kSessionClosedSystemCode = 29127; 31 const int kSessionClosedSystemCode = 29127;
32 32
33 ProxyDecryptor::ProxyDecryptor( 33 ProxyDecryptor::ProxyDecryptor(
34 #if defined(ENABLE_PEPPER_CDMS) 34 #if defined(ENABLE_PEPPER_CDMS)
35 const CreatePepperCdmCB& create_pepper_cdm_cb, 35 const CreatePepperCdmCB& create_pepper_cdm_cb,
36 #elif defined(OS_ANDROID) 36 #elif defined(ENABLE_BROWSER_CDMS)
37 RendererCdmManager* manager, 37 RendererCdmManager* manager,
38 #endif // defined(ENABLE_PEPPER_CDMS) 38 #endif // defined(ENABLE_PEPPER_CDMS)
39 const KeyAddedCB& key_added_cb, 39 const KeyAddedCB& key_added_cb,
40 const KeyErrorCB& key_error_cb, 40 const KeyErrorCB& key_error_cb,
41 const KeyMessageCB& key_message_cb) 41 const KeyMessageCB& key_message_cb)
42 : 42 :
43 #if defined(ENABLE_PEPPER_CDMS) 43 #if defined(ENABLE_PEPPER_CDMS)
44 create_pepper_cdm_cb_(create_pepper_cdm_cb), 44 create_pepper_cdm_cb_(create_pepper_cdm_cb),
45 #elif defined(OS_ANDROID) 45 #elif defined(ENABLE_BROWSER_CDMS)
46 manager_(manager), 46 manager_(manager),
47 cdm_id_(RendererCdmManager::kInvalidCdmId), 47 cdm_id_(RendererCdmManager::kInvalidCdmId),
48 #endif // defined(ENABLE_PEPPER_CDMS) 48 #endif // defined(ENABLE_PEPPER_CDMS)
49 key_added_cb_(key_added_cb), 49 key_added_cb_(key_added_cb),
50 key_error_cb_(key_error_cb), 50 key_error_cb_(key_error_cb),
51 key_message_cb_(key_message_cb), 51 key_message_cb_(key_message_cb),
52 is_clear_key_(false), 52 is_clear_key_(false),
53 weak_ptr_factory_(this) { 53 weak_ptr_factory_(this) {
54 #if defined(ENABLE_PEPPER_CDMS) 54 #if defined(ENABLE_PEPPER_CDMS)
55 DCHECK(!create_pepper_cdm_cb_.is_null()); 55 DCHECK(!create_pepper_cdm_cb_.is_null());
56 #endif // defined(ENABLE_PEPPER_CDMS) 56 #endif // defined(ENABLE_PEPPER_CDMS)
57 DCHECK(!key_added_cb_.is_null()); 57 DCHECK(!key_added_cb_.is_null());
58 DCHECK(!key_error_cb_.is_null()); 58 DCHECK(!key_error_cb_.is_null());
59 DCHECK(!key_message_cb_.is_null()); 59 DCHECK(!key_message_cb_.is_null());
60 } 60 }
61 61
62 ProxyDecryptor::~ProxyDecryptor() { 62 ProxyDecryptor::~ProxyDecryptor() {
63 // Destroy the decryptor explicitly before destroying the plugin. 63 // Destroy the decryptor explicitly before destroying the plugin.
64 media_keys_.reset(); 64 media_keys_.reset();
65 } 65 }
66 66
67 media::Decryptor* ProxyDecryptor::GetDecryptor() { 67 media::Decryptor* ProxyDecryptor::GetDecryptor() {
68 return media_keys_ ? media_keys_->GetDecryptor() : NULL; 68 return media_keys_ ? media_keys_->GetDecryptor() : NULL;
69 } 69 }
70 70
71 #if defined(OS_ANDROID) 71 #if defined(ENABLE_BROWSER_CDMS)
72 int ProxyDecryptor::GetCdmId() { 72 int ProxyDecryptor::GetCdmId() {
73 return cdm_id_; 73 return cdm_id_;
74 } 74 }
75 #endif 75 #endif
76 76
77 bool ProxyDecryptor::InitializeCDM(const std::string& key_system, 77 bool ProxyDecryptor::InitializeCDM(const std::string& key_system,
78 const GURL& security_origin) { 78 const GURL& security_origin) {
79 DVLOG(1) << "InitializeCDM: key_system = " << key_system; 79 DVLOG(1) << "InitializeCDM: key_system = " << key_system;
80 80
81 DCHECK(!media_keys_); 81 DCHECK(!media_keys_);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 206
207 scoped_ptr<media::MediaKeys> ProxyDecryptor::CreateMediaKeys( 207 scoped_ptr<media::MediaKeys> ProxyDecryptor::CreateMediaKeys(
208 const std::string& key_system, 208 const std::string& key_system,
209 const GURL& security_origin) { 209 const GURL& security_origin) {
210 return ContentDecryptionModuleFactory::Create( 210 return ContentDecryptionModuleFactory::Create(
211 key_system, 211 key_system,
212 security_origin, 212 security_origin,
213 #if defined(ENABLE_PEPPER_CDMS) 213 #if defined(ENABLE_PEPPER_CDMS)
214 create_pepper_cdm_cb_, 214 create_pepper_cdm_cb_,
215 #elif defined(OS_ANDROID) 215 #elif defined(ENABLE_BROWSER_CDMS)
216 manager_, 216 manager_,
217 &cdm_id_, 217 &cdm_id_,
218 #endif // defined(ENABLE_PEPPER_CDMS) 218 #endif // defined(ENABLE_PEPPER_CDMS)
219 base::Bind(&ProxyDecryptor::OnSessionMessage, 219 base::Bind(&ProxyDecryptor::OnSessionMessage,
220 weak_ptr_factory_.GetWeakPtr()), 220 weak_ptr_factory_.GetWeakPtr()),
221 base::Bind(&ProxyDecryptor::OnSessionReady, 221 base::Bind(&ProxyDecryptor::OnSessionReady,
222 weak_ptr_factory_.GetWeakPtr()), 222 weak_ptr_factory_.GetWeakPtr()),
223 base::Bind(&ProxyDecryptor::OnSessionClosed, 223 base::Bind(&ProxyDecryptor::OnSessionClosed,
224 weak_ptr_factory_.GetWeakPtr()), 224 weak_ptr_factory_.GetWeakPtr()),
225 base::Bind(&ProxyDecryptor::OnSessionError, 225 base::Bind(&ProxyDecryptor::OnSessionError,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 272 }
273 key_error_cb_.Run(web_session_id, error_code, system_code); 273 key_error_cb_.Run(web_session_id, error_code, system_code);
274 } 274 }
275 275
276 void ProxyDecryptor::SetSessionId(bool persistent, 276 void ProxyDecryptor::SetSessionId(bool persistent,
277 const std::string& web_session_id) { 277 const std::string& web_session_id) {
278 active_sessions_.insert(std::make_pair(web_session_id, persistent)); 278 active_sessions_.insert(std::make_pair(web_session_id, persistent));
279 } 279 }
280 280
281 } // namespace content 281 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/crypto/proxy_decryptor.h ('k') | content/renderer/media/webcontentdecryptionmodule_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698