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

Side by Side Diff: media/blink/webcontentdecryptionmoduleaccess_impl.cc

Issue 985113003: Block platform verification and file IO in the CDM adapter if the CDM configuration disallows them. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.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 blink::WebContentDecryptionModuleResult result) { 21 blink::WebContentDecryptionModuleResult result) {
20 // 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
21 // impossible to create the CDM, so fail. 23 // impossible to create the CDM, so fail.
22 if (!client) { 24 if (!client) {
23 result.completeWithError( 25 result.completeWithError(
24 blink::WebContentDecryptionModuleExceptionInvalidStateError, 0, 26 blink::WebContentDecryptionModuleExceptionInvalidStateError, 0,
25 "Failed to create CDM."); 27 "Failed to create CDM.");
26 return; 28 return;
27 } 29 }
28 30
29 client->CreateCdm(key_system, security_origin, result); 31 client->CreateCdm(key_system, allow_distinctive_identifier,
32 allow_persistent_state, security_origin, result);
30 } 33 }
31 34
32 WebContentDecryptionModuleAccessImpl* 35 WebContentDecryptionModuleAccessImpl*
33 WebContentDecryptionModuleAccessImpl::Create( 36 WebContentDecryptionModuleAccessImpl::Create(
34 const blink::WebString& key_system, 37 const blink::WebString& key_system,
35 const blink::WebMediaKeySystemConfiguration& configuration, 38 const blink::WebMediaKeySystemConfiguration& configuration,
36 const blink::WebSecurityOrigin& security_origin, 39 const blink::WebSecurityOrigin& security_origin,
37 const base::WeakPtr<WebEncryptedMediaClientImpl>& client) { 40 const base::WeakPtr<WebEncryptedMediaClientImpl>& client) {
38 return new WebContentDecryptionModuleAccessImpl(key_system, configuration, 41 return new WebContentDecryptionModuleAccessImpl(key_system, configuration,
39 security_origin, client); 42 security_origin, client);
(...skipping 17 matching lines...) Expand all
57 WebContentDecryptionModuleAccessImpl::getConfiguration() { 60 WebContentDecryptionModuleAccessImpl::getConfiguration() {
58 return configuration_; 61 return configuration_;
59 } 62 }
60 63
61 void WebContentDecryptionModuleAccessImpl::createContentDecryptionModule( 64 void WebContentDecryptionModuleAccessImpl::createContentDecryptionModule(
62 blink::WebContentDecryptionModuleResult result) { 65 blink::WebContentDecryptionModuleResult result) {
63 // This method needs to run asynchronously, as it may need to load the CDM. 66 // This method needs to run asynchronously, as it may need to load the CDM.
64 // As this object's lifetime is controlled by MediaKeySystemAccess on the 67 // As this object's lifetime is controlled by MediaKeySystemAccess on the
65 // blink side, copy all values needed by CreateCdm() in case the blink object 68 // blink side, copy all values needed by CreateCdm() in case the blink object
66 // gets garbage-collected. 69 // gets garbage-collected.
70 bool allow_distinctive_identifier =
71 (configuration_.distinctiveIdentifier ==
72 blink::WebMediaKeySystemConfiguration::Requirement::Required);
jrummell 2015/03/06 21:40:47 Should Requirement::Optional be allowed here? If i
sandersd (OOO until July 31) 2015/03/06 22:36:58 No, an accumulated configuration never has Optiona
ddorwin 2015/03/07 02:06:24 We could DCHECK != Optional before line 70. Up to
sandersd (OOO until July 31) 2015/03/09 20:01:35 Done.
73 bool allow_persistent_state =
74 (configuration_.persistentState ==
75 blink::WebMediaKeySystemConfiguration::Requirement::Required);
67 base::MessageLoopProxy::current()->PostTask( 76 base::MessageLoopProxy::current()->PostTask(
68 FROM_HERE, 77 FROM_HERE,
69 base::Bind(&CreateCdm, client_, key_system_, security_origin_, result)); 78 base::Bind(&CreateCdm, client_, key_system_, allow_distinctive_identifier,
79 allow_persistent_state, security_origin_, result));
70 } 80 }
71 81
72 } // namespace media 82 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698