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

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

Issue 1132773003: Revert of Plumb |use_secure_codecs| through to BrowserCdmFactoryAndroid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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/render_cdm_factory.h" 5 #include "content/renderer/media/crypto/render_cdm_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop_proxy.h" 11 #include "base/message_loop/message_loop_proxy.h"
12 #include "media/base/cdm_config.h"
13 #include "media/base/cdm_promise.h" 12 #include "media/base/cdm_promise.h"
14 #include "media/base/key_systems.h" 13 #include "media/base/key_systems.h"
15 #include "media/base/media_keys.h" 14 #include "media/base/media_keys.h"
16 #include "media/cdm/aes_decryptor.h" 15 #include "media/cdm/aes_decryptor.h"
17 #include "url/gurl.h" 16 #include "url/gurl.h"
18 #if defined(ENABLE_PEPPER_CDMS) 17 #if defined(ENABLE_PEPPER_CDMS)
19 #include "content/renderer/media/crypto/ppapi_decryptor.h" 18 #include "content/renderer/media/crypto/ppapi_decryptor.h"
20 #elif defined(ENABLE_BROWSER_CDMS) 19 #elif defined(ENABLE_BROWSER_CDMS)
21 #include "content/renderer/media/crypto/proxy_media_keys.h" 20 #include "content/renderer/media/crypto/proxy_media_keys.h"
22 #endif // defined(ENABLE_PEPPER_CDMS) 21 #endif // defined(ENABLE_PEPPER_CDMS)
(...skipping 15 matching lines...) Expand all
38 #endif // defined(ENABLE_PEPPER_CDMS) 37 #endif // defined(ENABLE_PEPPER_CDMS)
39 { 38 {
40 } 39 }
41 40
42 RenderCdmFactory::~RenderCdmFactory() { 41 RenderCdmFactory::~RenderCdmFactory() {
43 DCHECK(thread_checker_.CalledOnValidThread()); 42 DCHECK(thread_checker_.CalledOnValidThread());
44 } 43 }
45 44
46 void RenderCdmFactory::Create( 45 void RenderCdmFactory::Create(
47 const std::string& key_system, 46 const std::string& key_system,
47 bool allow_distinctive_identifier,
48 bool allow_persistent_state,
48 const GURL& security_origin, 49 const GURL& security_origin,
49 const media::CdmConfig& cdm_config,
50 const media::SessionMessageCB& session_message_cb, 50 const media::SessionMessageCB& session_message_cb,
51 const media::SessionClosedCB& session_closed_cb, 51 const media::SessionClosedCB& session_closed_cb,
52 const media::LegacySessionErrorCB& legacy_session_error_cb, 52 const media::LegacySessionErrorCB& legacy_session_error_cb,
53 const media::SessionKeysChangeCB& session_keys_change_cb, 53 const media::SessionKeysChangeCB& session_keys_change_cb,
54 const media::SessionExpirationUpdateCB& session_expiration_update_cb, 54 const media::SessionExpirationUpdateCB& session_expiration_update_cb,
55 const media::CdmCreatedCB& cdm_created_cb) { 55 const media::CdmCreatedCB& cdm_created_cb) {
56 DCHECK(thread_checker_.CalledOnValidThread()); 56 DCHECK(thread_checker_.CalledOnValidThread());
57 57
58 if (!security_origin.is_valid()) { 58 if (!security_origin.is_valid()) {
59 base::MessageLoopProxy::current()->PostTask( 59 base::MessageLoopProxy::current()->PostTask(
60 FROM_HERE, base::Bind(cdm_created_cb, nullptr, "Invalid origin.")); 60 FROM_HERE, base::Bind(cdm_created_cb, nullptr, "Invalid origin."));
61 return; 61 return;
62 } 62 }
63 63
64 if (media::CanUseAesDecryptor(key_system)) { 64 if (media::CanUseAesDecryptor(key_system)) {
65 // TODO(sandersd): Currently the prefixed API always allows distinctive 65 // TODO(sandersd): Currently the prefixed API always allows distinctive
66 // identifiers and persistent state. Once that changes we can sanity check 66 // identifiers and persistent state. Once that changes we can sanity check
67 // here that neither is allowed for AesDecryptor, since it does not support 67 // here that neither is allowed for AesDecryptor, since it does not support
68 // them and should never be configured that way. http://crbug.com/455271 68 // them and should never be configured that way. http://crbug.com/455271
69 scoped_ptr<media::MediaKeys> cdm( 69 scoped_ptr<media::MediaKeys> cdm(
70 new media::AesDecryptor(security_origin, session_message_cb, 70 new media::AesDecryptor(security_origin, session_message_cb,
71 session_closed_cb, session_keys_change_cb)); 71 session_closed_cb, session_keys_change_cb));
72 base::MessageLoopProxy::current()->PostTask( 72 base::MessageLoopProxy::current()->PostTask(
73 FROM_HERE, base::Bind(cdm_created_cb, base::Passed(&cdm), "")); 73 FROM_HERE, base::Bind(cdm_created_cb, base::Passed(&cdm), ""));
74 return; 74 return;
75 } 75 }
76 76
77 #if defined(ENABLE_PEPPER_CDMS) 77 #if defined(ENABLE_PEPPER_CDMS)
78 DCHECK(!cdm_config.use_hw_secure_codecs);
79 PpapiDecryptor::Create( 78 PpapiDecryptor::Create(
80 key_system, security_origin, cdm_config.allow_distinctive_identifier, 79 key_system, allow_distinctive_identifier, allow_persistent_state,
81 cdm_config.allow_persistent_state, create_pepper_cdm_cb_, 80 security_origin, create_pepper_cdm_cb_, session_message_cb,
82 session_message_cb, session_closed_cb, legacy_session_error_cb, 81 session_closed_cb, legacy_session_error_cb, session_keys_change_cb,
83 session_keys_change_cb, session_expiration_update_cb, cdm_created_cb); 82 session_expiration_update_cb, cdm_created_cb);
84 #elif defined(ENABLE_BROWSER_CDMS) 83 #elif defined(ENABLE_BROWSER_CDMS)
85 DCHECK(cdm_config.allow_distinctive_identifier); 84 DCHECK(allow_distinctive_identifier);
86 DCHECK(cdm_config.allow_persistent_state); 85 DCHECK(allow_persistent_state);
87 ProxyMediaKeys::Create( 86 ProxyMediaKeys::Create(key_system, security_origin, manager_,
88 key_system, security_origin, cdm_config.use_hw_secure_codecs, manager_, 87 session_message_cb, session_closed_cb,
89 session_message_cb, session_closed_cb, legacy_session_error_cb, 88 legacy_session_error_cb, session_keys_change_cb,
90 session_keys_change_cb, session_expiration_update_cb, cdm_created_cb); 89 session_expiration_update_cb, cdm_created_cb);
91 #else 90 #else
92 // No possible CDM to create, so fail the request. 91 // No possible CDM to create, so fail the request.
93 base::MessageLoopProxy::current()->PostTask( 92 base::MessageLoopProxy::current()->PostTask(
94 FROM_HERE, 93 FROM_HERE,
95 base::Bind(cdm_created_cb, nullptr, "Key system not supported.")); 94 base::Bind(cdm_created_cb, nullptr, "Key system not supported."));
96 #endif // defined(ENABLE_PEPPER_CDMS) 95 #endif // defined(ENABLE_PEPPER_CDMS)
97 } 96 }
98 97
99 } // namespace content 98 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/crypto/render_cdm_factory.h ('k') | content/renderer/media/crypto/renderer_cdm_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698