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

Side by Side Diff: media/blink/webcontentdecryptionmoduleaccess_impl.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 "media/blink/webcontentdecryptionmoduleaccess_impl.h" 5 #include "media/blink/webcontentdecryptionmoduleaccess_impl.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/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
11 #include "media/blink/webencryptedmediaclient_impl.h" 11 #include "media/blink/webencryptedmediaclient_impl.h"
12 12
13 namespace media { 13 namespace media {
14 14
15 // The caller owns the created cdm (passed back using |result|). 15 // The caller owns the created cdm (passed back using |result|).
16 static void CreateCdm(const base::WeakPtr<WebEncryptedMediaClientImpl>& client, 16 static void CreateCdm(const base::WeakPtr<WebEncryptedMediaClientImpl>& client,
17 const blink::WebString& key_system, 17 const blink::WebString& key_system,
18 bool allow_distinctive_identifier,
19 bool allow_persistent_state,
18 const blink::WebSecurityOrigin& security_origin, 20 const blink::WebSecurityOrigin& security_origin,
19 const CdmConfig& cdm_config,
20 blink::WebContentDecryptionModuleResult result) { 21 blink::WebContentDecryptionModuleResult result) {
21 // If |client| is gone (due to the frame getting destroyed), it is 22 // If |client| is gone (due to the frame getting destroyed), it is
22 // impossible to create the CDM, so fail. 23 // impossible to create the CDM, so fail.
23 if (!client) { 24 if (!client) {
24 result.completeWithError( 25 result.completeWithError(
25 blink::WebContentDecryptionModuleExceptionInvalidStateError, 0, 26 blink::WebContentDecryptionModuleExceptionInvalidStateError, 0,
26 "Failed to create CDM."); 27 "Failed to create CDM.");
27 return; 28 return;
28 } 29 }
29 30
30 client->CreateCdm(key_system, security_origin, cdm_config, result); 31 client->CreateCdm(key_system, allow_distinctive_identifier,
32 allow_persistent_state, security_origin, result);
31 } 33 }
32 34
33 WebContentDecryptionModuleAccessImpl* 35 WebContentDecryptionModuleAccessImpl*
34 WebContentDecryptionModuleAccessImpl::Create( 36 WebContentDecryptionModuleAccessImpl::Create(
35 const blink::WebString& key_system, 37 const blink::WebString& key_system,
38 const blink::WebMediaKeySystemConfiguration& configuration,
36 const blink::WebSecurityOrigin& security_origin, 39 const blink::WebSecurityOrigin& security_origin,
37 const blink::WebMediaKeySystemConfiguration& configuration,
38 const CdmConfig& cdm_config,
39 const base::WeakPtr<WebEncryptedMediaClientImpl>& client) { 40 const base::WeakPtr<WebEncryptedMediaClientImpl>& client) {
40 return new WebContentDecryptionModuleAccessImpl( 41 return new WebContentDecryptionModuleAccessImpl(key_system, configuration,
41 key_system, security_origin, configuration, cdm_config, client); 42 security_origin, client);
42 } 43 }
43 44
44 WebContentDecryptionModuleAccessImpl::WebContentDecryptionModuleAccessImpl( 45 WebContentDecryptionModuleAccessImpl::WebContentDecryptionModuleAccessImpl(
45 const blink::WebString& key_system, 46 const blink::WebString& key_system,
47 const blink::WebMediaKeySystemConfiguration& configuration,
46 const blink::WebSecurityOrigin& security_origin, 48 const blink::WebSecurityOrigin& security_origin,
47 const blink::WebMediaKeySystemConfiguration& configuration,
48 const CdmConfig& cdm_config,
49 const base::WeakPtr<WebEncryptedMediaClientImpl>& client) 49 const base::WeakPtr<WebEncryptedMediaClientImpl>& client)
50 : key_system_(key_system), 50 : key_system_(key_system),
51 configuration_(configuration),
51 security_origin_(security_origin), 52 security_origin_(security_origin),
52 configuration_(configuration),
53 cdm_config_(cdm_config),
54 client_(client) { 53 client_(client) {
55 } 54 }
56 55
57 WebContentDecryptionModuleAccessImpl::~WebContentDecryptionModuleAccessImpl() { 56 WebContentDecryptionModuleAccessImpl::~WebContentDecryptionModuleAccessImpl() {
58 } 57 }
59 58
60 blink::WebMediaKeySystemConfiguration 59 blink::WebMediaKeySystemConfiguration
61 WebContentDecryptionModuleAccessImpl::getConfiguration() { 60 WebContentDecryptionModuleAccessImpl::getConfiguration() {
62 return configuration_; 61 return configuration_;
63 } 62 }
64 63
65 void WebContentDecryptionModuleAccessImpl::createContentDecryptionModule( 64 void WebContentDecryptionModuleAccessImpl::createContentDecryptionModule(
66 blink::WebContentDecryptionModuleResult result) { 65 blink::WebContentDecryptionModuleResult result) {
66 // Convert the accumulated configuration requirements to bools. Accumulated
67 // configurations never have optional requirements.
68 DCHECK(configuration_.distinctiveIdentifier !=
69 blink::WebMediaKeySystemConfiguration::Requirement::Optional);
70 DCHECK(configuration_.persistentState !=
71 blink::WebMediaKeySystemConfiguration::Requirement::Optional);
72 bool allow_distinctive_identifier =
73 (configuration_.distinctiveIdentifier ==
74 blink::WebMediaKeySystemConfiguration::Requirement::Required);
75 bool allow_persistent_state =
76 (configuration_.persistentState ==
77 blink::WebMediaKeySystemConfiguration::Requirement::Required);
78
67 // This method needs to run asynchronously, as it may need to load the CDM. 79 // This method needs to run asynchronously, as it may need to load the CDM.
68 // As this object's lifetime is controlled by MediaKeySystemAccess on the 80 // As this object's lifetime is controlled by MediaKeySystemAccess on the
69 // blink side, copy all values needed by CreateCdm() in case the blink object 81 // blink side, copy all values needed by CreateCdm() in case the blink object
70 // gets garbage-collected. 82 // gets garbage-collected.
71 base::ThreadTaskRunnerHandle::Get()->PostTask( 83 base::ThreadTaskRunnerHandle::Get()->PostTask(
72 FROM_HERE, 84 FROM_HERE,
73 base::Bind(&CreateCdm, client_, key_system_, security_origin_, 85 base::Bind(&CreateCdm, client_, key_system_, allow_distinctive_identifier,
74 cdm_config_, result)); 86 allow_persistent_state, security_origin_, result));
75 } 87 }
76 88
77 } // namespace media 89 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webcontentdecryptionmoduleaccess_impl.h ('k') | media/blink/webencryptedmediaclient_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698