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

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

Issue 1137993004: Revert of Restrict use of hardware-secure codecs based on the RendererPreference. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setsecurity
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
« no previous file with comments | « media/blink/webencryptedmediaclient_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "webencryptedmediaclient_impl.h" 5 #include "webencryptedmediaclient_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 KEY_SYSTEM_SUPPORT_STATUS_COUNT + 1, 71 KEY_SYSTEM_SUPPORT_STATUS_COUNT + 1,
72 base::Histogram::kUmaTargetedHistogramFlag)->Add(status); 72 base::Histogram::kUmaTargetedHistogramFlag)->Add(status);
73 } 73 }
74 74
75 const std::string uma_name_; 75 const std::string uma_name_;
76 bool is_request_reported_; 76 bool is_request_reported_;
77 bool is_support_reported_; 77 bool is_support_reported_;
78 }; 78 };
79 79
80 WebEncryptedMediaClientImpl::WebEncryptedMediaClientImpl( 80 WebEncryptedMediaClientImpl::WebEncryptedMediaClientImpl(
81 base::Callback<bool(void)> are_secure_codecs_supported_cb,
82 CdmFactory* cdm_factory, 81 CdmFactory* cdm_factory,
83 MediaPermission* media_permission) 82 MediaPermission* media_permission)
84 : are_secure_codecs_supported_cb_(are_secure_codecs_supported_cb), 83 : cdm_factory_(cdm_factory),
85 cdm_factory_(cdm_factory),
86 key_system_config_selector_(KeySystems::GetInstance(), media_permission), 84 key_system_config_selector_(KeySystems::GetInstance(), media_permission),
87 weak_factory_(this) { 85 weak_factory_(this) {
88 DCHECK(cdm_factory_); 86 DCHECK(cdm_factory_);
89 } 87 }
90 88
91 WebEncryptedMediaClientImpl::~WebEncryptedMediaClientImpl() { 89 WebEncryptedMediaClientImpl::~WebEncryptedMediaClientImpl() {
92 } 90 }
93 91
94 void WebEncryptedMediaClientImpl::requestMediaKeySystemAccess( 92 void WebEncryptedMediaClientImpl::requestMediaKeySystemAccess(
95 blink::WebEncryptedMediaRequest request) { 93 blink::WebEncryptedMediaRequest request) {
96 GetReporter(request.keySystem())->ReportRequested(); 94 GetReporter(request.keySystem())->ReportRequested();
97 key_system_config_selector_.SelectConfig( 95 key_system_config_selector_.SelectConfig(
98 request.keySystem(), request.supportedConfigurations(), 96 request.keySystem(), request.supportedConfigurations(),
99 request.securityOrigin(), are_secure_codecs_supported_cb_.Run(), 97 request.securityOrigin(),
100 base::Bind(&WebEncryptedMediaClientImpl::OnRequestSucceeded, 98 base::Bind(&WebEncryptedMediaClientImpl::OnRequestSucceeded,
101 weak_factory_.GetWeakPtr(), request), 99 weak_factory_.GetWeakPtr(), request),
102 base::Bind(&WebEncryptedMediaClientImpl::OnRequestNotSupported, 100 base::Bind(&WebEncryptedMediaClientImpl::OnRequestNotSupported,
103 weak_factory_.GetWeakPtr(), request)); 101 weak_factory_.GetWeakPtr(), request));
104 } 102 }
105 103
106 void WebEncryptedMediaClientImpl::CreateCdm( 104 void WebEncryptedMediaClientImpl::CreateCdm(
107 const blink::WebString& key_system, 105 const blink::WebString& key_system,
108 bool allow_distinctive_identifier, 106 bool allow_distinctive_identifier,
109 bool allow_persistent_state, 107 bool allow_persistent_state,
110 const blink::WebSecurityOrigin& security_origin, 108 const blink::WebSecurityOrigin& security_origin,
111 blink::WebContentDecryptionModuleResult result) { 109 blink::WebContentDecryptionModuleResult result) {
112 WebContentDecryptionModuleImpl::Create( 110 WebContentDecryptionModuleImpl::Create(
113 cdm_factory_, key_system, allow_distinctive_identifier, 111 cdm_factory_, key_system, allow_distinctive_identifier,
114 allow_persistent_state, security_origin, result); 112 allow_persistent_state, security_origin, result);
115 } 113 }
116 114
117 void WebEncryptedMediaClientImpl::OnRequestSucceeded( 115 void WebEncryptedMediaClientImpl::OnRequestSucceeded(
118 blink::WebEncryptedMediaRequest request, 116 blink::WebEncryptedMediaRequest request,
119 const blink::WebMediaKeySystemConfiguration& accumulated_configuration, 117 const blink::WebMediaKeySystemConfiguration& accumulated_configuration) {
120 bool are_secure_codecs_required) {
121 GetReporter(request.keySystem())->ReportSupported(); 118 GetReporter(request.keySystem())->ReportSupported();
122 // TODO(sandersd): Pass |are_secure_codecs_required| along and use it to
123 // configure the CDM security level and use of secure surfaces on Android.
124 request.requestSucceeded(WebContentDecryptionModuleAccessImpl::Create( 119 request.requestSucceeded(WebContentDecryptionModuleAccessImpl::Create(
125 request.keySystem(), accumulated_configuration, request.securityOrigin(), 120 request.keySystem(), accumulated_configuration, request.securityOrigin(),
126 weak_factory_.GetWeakPtr())); 121 weak_factory_.GetWeakPtr()));
127 } 122 }
128 123
129 void WebEncryptedMediaClientImpl::OnRequestNotSupported( 124 void WebEncryptedMediaClientImpl::OnRequestNotSupported(
130 blink::WebEncryptedMediaRequest request, 125 blink::WebEncryptedMediaRequest request,
131 const blink::WebString& error_message) { 126 const blink::WebString& error_message) {
132 request.requestNotSupported(error_message); 127 request.requestNotSupported(error_message);
133 } 128 }
(...skipping 10 matching lines...) Expand all
144 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii); 139 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii);
145 Reporter* reporter = reporters_.get(uma_name); 140 Reporter* reporter = reporters_.get(uma_name);
146 if (!reporter) { 141 if (!reporter) {
147 reporter = new Reporter(uma_name); 142 reporter = new Reporter(uma_name);
148 reporters_.add(uma_name, make_scoped_ptr(reporter)); 143 reporters_.add(uma_name, make_scoped_ptr(reporter));
149 } 144 }
150 return reporter; 145 return reporter;
151 } 146 }
152 147
153 } // namespace media 148 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webencryptedmediaclient_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698