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

Side by Side Diff: media/blink/webcontentdecryptionmodule_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 "webcontentdecryptionmodule_impl.h" 5 #include "webcontentdecryptionmodule_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/logging.h" 9 #include "base/logging.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "media/base/cdm_promise.h" 13 #include "media/base/cdm_promise.h"
14 #include "media/base/key_systems.h" 14 #include "media/base/key_systems.h"
15 #include "media/base/media_keys.h" 15 #include "media/base/media_keys.h"
16 #include "media/blink/cdm_result_promise.h" 16 #include "media/blink/cdm_result_promise.h"
17 #include "media/blink/cdm_session_adapter.h" 17 #include "media/blink/cdm_session_adapter.h"
18 #include "media/blink/webcontentdecryptionmodulesession_impl.h" 18 #include "media/blink/webcontentdecryptionmodulesession_impl.h"
19 #include "third_party/WebKit/public/platform/WebString.h" 19 #include "third_party/WebKit/public/platform/WebString.h"
20 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 20 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
21 #include "url/gurl.h" 21 #include "url/gurl.h"
22 22
23 namespace media { 23 namespace media {
24 24
25 void WebContentDecryptionModuleImpl::Create( 25 void WebContentDecryptionModuleImpl::Create(
26 media::CdmFactory* cdm_factory, 26 media::CdmFactory* cdm_factory,
27 const base::string16& key_system, 27 const base::string16& key_system,
28 bool allow_distinctive_identifier,
29 bool allow_persistent_state,
28 const blink::WebSecurityOrigin& security_origin, 30 const blink::WebSecurityOrigin& security_origin,
29 const CdmConfig& cdm_config,
30 blink::WebContentDecryptionModuleResult result) { 31 blink::WebContentDecryptionModuleResult result) {
31 DCHECK(!security_origin.isNull()); 32 DCHECK(!security_origin.isNull());
32 DCHECK(!key_system.empty()); 33 DCHECK(!key_system.empty());
33 34
34 // TODO(ddorwin): Guard against this in supported types check and remove this. 35 // TODO(ddorwin): Guard against this in supported types check and remove this.
35 // Chromium only supports ASCII key systems. 36 // Chromium only supports ASCII key systems.
36 if (!base::IsStringASCII(key_system)) { 37 if (!base::IsStringASCII(key_system)) {
37 NOTREACHED(); 38 NOTREACHED();
38 result.completeWithError( 39 result.completeWithError(
39 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, 40 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0,
(...skipping 20 matching lines...) Expand all
60 return; 61 return;
61 } 62 }
62 63
63 GURL security_origin_as_gurl(security_origin.toString()); 64 GURL security_origin_as_gurl(security_origin.toString());
64 65
65 // CdmSessionAdapter::CreateCdm() will keep a reference to |adapter|. Then 66 // CdmSessionAdapter::CreateCdm() will keep a reference to |adapter|. Then
66 // if WebContentDecryptionModuleImpl is successfully created (returned in 67 // if WebContentDecryptionModuleImpl is successfully created (returned in
67 // |result|), it will keep a reference to |adapter|. Otherwise, |adapter| will 68 // |result|), it will keep a reference to |adapter|. Otherwise, |adapter| will
68 // be destructed. 69 // be destructed.
69 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter()); 70 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter());
70 adapter->CreateCdm(cdm_factory, key_system_ascii, security_origin_as_gurl, 71 adapter->CreateCdm(cdm_factory, key_system_ascii,
71 cdm_config, result); 72 allow_distinctive_identifier, allow_persistent_state,
73 security_origin_as_gurl, result);
72 } 74 }
73 75
74 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( 76 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl(
75 scoped_refptr<CdmSessionAdapter> adapter) 77 scoped_refptr<CdmSessionAdapter> adapter)
76 : adapter_(adapter) { 78 : adapter_(adapter) {
77 } 79 }
78 80
79 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() { 81 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() {
80 } 82 }
81 83
(...skipping 13 matching lines...) Expand all
95 server_certificate + server_certificate_length), 97 server_certificate + server_certificate_length),
96 scoped_ptr<SimpleCdmPromise>( 98 scoped_ptr<SimpleCdmPromise>(
97 new CdmResultPromise<>(result, std::string()))); 99 new CdmResultPromise<>(result, std::string())));
98 } 100 }
99 101
100 CdmContext* WebContentDecryptionModuleImpl::GetCdmContext() { 102 CdmContext* WebContentDecryptionModuleImpl::GetCdmContext() {
101 return adapter_->GetCdmContext(); 103 return adapter_->GetCdmContext();
102 } 104 }
103 105
104 } // namespace media 106 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webcontentdecryptionmodule_impl.h ('k') | media/blink/webcontentdecryptionmoduleaccess_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698