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

Side by Side Diff: third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp

Issue 2834653002: (merge m59) media: Add UMA to record whether encrypted media is enabled (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('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 "modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h" 5 #include "modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 Document* document = ToDocument(execution_context); 271 Document* document = ToDocument(execution_context);
272 272
273 // From https://w3c.github.io/encrypted-media/#common-key-systems 273 // From https://w3c.github.io/encrypted-media/#common-key-systems
274 // All user agents MUST support the common key systems described in this 274 // All user agents MUST support the common key systems described in this
275 // section. 275 // section.
276 // 9.1 Clear Key: The "org.w3.clearkey" Key System uses plain-text clear 276 // 9.1 Clear Key: The "org.w3.clearkey" Key System uses plain-text clear
277 // (unencrypted) key(s) to decrypt the source. 277 // (unencrypted) key(s) to decrypt the source.
278 // 278 //
279 // Do not check settings for Clear Key. 279 // Do not check settings for Clear Key.
280 if (key_system != "org.w3.clearkey") { 280 if (key_system != "org.w3.clearkey") {
281 // For other key systems, check settings. 281 // For other key systems, check settings and report UMA.
282 if (!document->GetSettings() || 282 bool encypted_media_enabled =
283 !document->GetSettings()->GetEncryptedMediaEnabled()) { 283 document->GetSettings() &&
284 document->GetSettings()->GetEncryptedMediaEnabled();
285
286 static bool has_reported_uma = false;
287 if (!has_reported_uma) {
288 has_reported_uma = true;
289 DEFINE_STATIC_LOCAL(BooleanHistogram, histogram,
290 ("Media.EME.EncryptedMediaEnabled"));
291 histogram.Count(encypted_media_enabled);
292 }
293
294 if (!encypted_media_enabled) {
284 return ScriptPromise::RejectWithDOMException( 295 return ScriptPromise::RejectWithDOMException(
285 script_state, 296 script_state,
286 DOMException::Create(kNotSupportedError, "Unsupported keySystem")); 297 DOMException::Create(kNotSupportedError, "Unsupported keySystem"));
287 } 298 }
288 } 299 }
289 300
290 // From https://w3c.github.io/encrypted-media/#requestMediaKeySystemAccess 301 // From https://w3c.github.io/encrypted-media/#requestMediaKeySystemAccess
291 // When this method is invoked, the user agent must run the following steps: 302 // When this method is invoked, the user agent must run the following steps:
292 // 1. If keySystem is the empty string, return a promise rejected with a 303 // 1. If keySystem is the empty string, return a promise rejected with a
293 // newly created TypeError. 304 // newly created TypeError.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 WebEncryptedMediaClient* media_client = 344 WebEncryptedMediaClient* media_client =
334 controller->EncryptedMediaClient(execution_context); 345 controller->EncryptedMediaClient(execution_context);
335 media_client->RequestMediaKeySystemAccess( 346 media_client->RequestMediaKeySystemAccess(
336 WebEncryptedMediaRequest(initializer)); 347 WebEncryptedMediaRequest(initializer));
337 348
338 // 7. Return promise. 349 // 7. Return promise.
339 return promise; 350 return promise;
340 } 351 }
341 352
342 } // namespace blink 353 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698