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

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

Issue 871663003: media: Add MediaPermission interface and MediaPermissionDispatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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') | media/media.gyp » ('j') | 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/logging.h" 8 #include "base/logging.h"
8 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
10 #include "media/base/key_systems.h" 11 #include "media/base/key_systems.h"
12 #include "media/base/media_permission.h"
11 #include "net/base/mime_util.h" 13 #include "net/base/mime_util.h"
12 #include "third_party/WebKit/public/platform/WebEncryptedMediaRequest.h" 14 #include "third_party/WebKit/public/platform/WebEncryptedMediaRequest.h"
13 #include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h" 15 #include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h"
14 #include "third_party/WebKit/public/platform/WebString.h" 16 #include "third_party/WebKit/public/platform/WebString.h"
15 #include "third_party/WebKit/public/platform/WebVector.h" 17 #include "third_party/WebKit/public/platform/WebVector.h"
16 #include "webcontentdecryptionmoduleaccess_impl.h" 18 #include "webcontentdecryptionmoduleaccess_impl.h"
17 19
18 namespace media { 20 namespace media {
19 21
20 static bool IsSupportedContentType( 22 static bool IsSupportedContentType(
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 126 }
125 127
126 // TODO(sandersd): Prompt for distinctive identifiers and/or persistent state 128 // TODO(sandersd): Prompt for distinctive identifiers and/or persistent state
127 // if required. Make sure that future checks are silent. 129 // if required. Make sure that future checks are silent.
128 // http://crbug.com/446263. 130 // http://crbug.com/446263.
129 131
130 return true; 132 return true;
131 } 133 }
132 134
133 WebEncryptedMediaClientImpl::WebEncryptedMediaClientImpl( 135 WebEncryptedMediaClientImpl::WebEncryptedMediaClientImpl(
134 scoped_ptr<CdmFactory> cdm_factory) 136 scoped_ptr<CdmFactory> cdm_factory,
135 : cdm_factory_(cdm_factory.Pass()) { 137 MediaPermission* media_permission)
138 : cdm_factory_(cdm_factory.Pass()), media_permission_(media_permission) {
136 } 139 }
137 140
138 WebEncryptedMediaClientImpl::~WebEncryptedMediaClientImpl() { 141 WebEncryptedMediaClientImpl::~WebEncryptedMediaClientImpl() {
139 } 142 }
140 143
144 static void OnPermissionStatus(bool granted) {
145 DVLOG(2) << __FUNCTION__ << ": " << granted;
146 }
147
141 void WebEncryptedMediaClientImpl::requestMediaKeySystemAccess( 148 void WebEncryptedMediaClientImpl::requestMediaKeySystemAccess(
142 blink::WebEncryptedMediaRequest request) { 149 blink::WebEncryptedMediaRequest request) {
143 // TODO(jrummell): This should be asynchronous. 150 // TODO(jrummell): This should be asynchronous.
144 151
152 GURL security_origin_as_gurl(request.securityOrigin().toString());
153 media_permission_->HasPermission(MediaPermission::PROTECTED_MEDIA_IDENTIFIER,
154 security_origin_as_gurl,
155 base::Bind(&OnPermissionStatus));
xhwang 2015/01/22 23:40:54 FYI: This is how I test this CL with LayoutTests/m
156
145 // Continued from requestMediaKeySystemAccess(), step 7, from 157 // Continued from requestMediaKeySystemAccess(), step 7, from
146 // https://w3c.github.io/encrypted-media/#requestmediakeysystemaccess 158 // https://w3c.github.io/encrypted-media/#requestmediakeysystemaccess
147 // 159 //
148 // 7.1 If keySystem is not one of the Key Systems supported by the user 160 // 7.1 If keySystem is not one of the Key Systems supported by the user
149 // agent, reject promise with with a new DOMException whose name is 161 // agent, reject promise with with a new DOMException whose name is
150 // NotSupportedError. String comparison is case-sensitive. 162 // NotSupportedError. String comparison is case-sensitive.
151 if (!base::IsStringASCII(request.keySystem())) { 163 if (!base::IsStringASCII(request.keySystem())) {
152 request.requestNotSupported("Only ASCII keySystems are supported"); 164 request.requestNotSupported("Only ASCII keySystems are supported");
153 return; 165 return;
154 } 166 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return; 203 return;
192 } 204 }
193 } 205 }
194 206
195 // 7.4 Reject promise with a new DOMException whose name is NotSupportedError. 207 // 7.4 Reject promise with a new DOMException whose name is NotSupportedError.
196 request.requestNotSupported( 208 request.requestNotSupported(
197 "None of the requested configurations were supported."); 209 "None of the requested configurations were supported.");
198 } 210 }
199 211
200 } // namespace media 212 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webencryptedmediaclient_impl.h ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698