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

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

Issue 1131753003: Plumb |use_secure_codecs| through to BrowserCdmFactoryAndroid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update unittest. 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,
30 const blink::WebSecurityOrigin& security_origin, 28 const blink::WebSecurityOrigin& security_origin,
29 const CdmConfig& cdm_config,
31 blink::WebContentDecryptionModuleResult result) { 30 blink::WebContentDecryptionModuleResult result) {
32 DCHECK(!security_origin.isNull()); 31 DCHECK(!security_origin.isNull());
33 DCHECK(!key_system.empty()); 32 DCHECK(!key_system.empty());
34 33
35 // TODO(ddorwin): Guard against this in supported types check and remove this. 34 // TODO(ddorwin): Guard against this in supported types check and remove this.
36 // Chromium only supports ASCII key systems. 35 // Chromium only supports ASCII key systems.
37 if (!base::IsStringASCII(key_system)) { 36 if (!base::IsStringASCII(key_system)) {
38 NOTREACHED(); 37 NOTREACHED();
39 result.completeWithError( 38 result.completeWithError(
40 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, 39 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0,
(...skipping 20 matching lines...) Expand all
61 return; 60 return;
62 } 61 }
63 62
64 GURL security_origin_as_gurl(security_origin.toString()); 63 GURL security_origin_as_gurl(security_origin.toString());
65 64
66 // CdmSessionAdapter::CreateCdm() will keep a reference to |adapter|. Then 65 // CdmSessionAdapter::CreateCdm() will keep a reference to |adapter|. Then
67 // if WebContentDecryptionModuleImpl is successfully created (returned in 66 // if WebContentDecryptionModuleImpl is successfully created (returned in
68 // |result|), it will keep a reference to |adapter|. Otherwise, |adapter| will 67 // |result|), it will keep a reference to |adapter|. Otherwise, |adapter| will
69 // be destructed. 68 // be destructed.
70 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter()); 69 scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter());
71 adapter->CreateCdm(cdm_factory, key_system_ascii, 70 adapter->CreateCdm(cdm_factory, key_system_ascii, security_origin_as_gurl,
72 allow_distinctive_identifier, allow_persistent_state, 71 cdm_config, result);
73 security_origin_as_gurl, result);
74 } 72 }
75 73
76 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl( 74 WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl(
77 scoped_refptr<CdmSessionAdapter> adapter) 75 scoped_refptr<CdmSessionAdapter> adapter)
78 : adapter_(adapter) { 76 : adapter_(adapter) {
79 } 77 }
80 78
81 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() { 79 WebContentDecryptionModuleImpl::~WebContentDecryptionModuleImpl() {
82 } 80 }
83 81
(...skipping 13 matching lines...) Expand all
97 server_certificate + server_certificate_length), 95 server_certificate + server_certificate_length),
98 scoped_ptr<SimpleCdmPromise>( 96 scoped_ptr<SimpleCdmPromise>(
99 new CdmResultPromise<>(result, std::string()))); 97 new CdmResultPromise<>(result, std::string())));
100 } 98 }
101 99
102 CdmContext* WebContentDecryptionModuleImpl::GetCdmContext() { 100 CdmContext* WebContentDecryptionModuleImpl::GetCdmContext() {
103 return adapter_->GetCdmContext(); 101 return adapter_->GetCdmContext();
104 } 102 }
105 103
106 } // namespace media 104 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698