Skip to content

Commit 935d969

Browse files
(merge m59) media: Add UMA to record whether encrypted media is enabled
The UMA is recorded when requestMediaKeySystemAccess is called on non-ClearKey key system but will reported at most once per renderer process. BUG=711348 TEST=Manually tested Review-Url: https://codereview.chromium.org/2824643002 Cr-Commit-Position: refs/heads/master@{#465159} (cherry picked from commit 6041683) Review-Url: https://codereview.chromium.org/2834653002 . Cr-Commit-Position: refs/branch-heads/3071@{nwjs#85} Cr-Branched-From: a106f0a-refs/heads/master@{#464641}
1 parent 1e54e3f commit 935d969

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,20 @@ ScriptPromise NavigatorRequestMediaKeySystemAccess::requestMediaKeySystemAccess(
278278
//
279279
// Do not check settings for Clear Key.
280280
if (key_system != "org.w3.clearkey") {
281-
// For other key systems, check settings.
282-
if (!document->GetSettings() ||
283-
!document->GetSettings()->GetEncryptedMediaEnabled()) {
281+
// For other key systems, check settings and report UMA.
282+
bool encypted_media_enabled =
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) {
284295
return ScriptPromise::RejectWithDOMException(
285296
script_state,
286297
DOMException::Create(kNotSupportedError, "Unsupported keySystem"));

tools/metrics/histograms/histograms.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26933,6 +26933,16 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
2693326933
</summary>
2693426934
</histogram>
2693526935

26936+
<histogram name="Media.EME.EncryptedMediaEnabled" enum="BooleanEnabled">
26937+
<owner>[email protected]</owner>
26938+
<summary>
26939+
Whether encrypted media is enabled when requestMediaKeySystemAccess() is
26940+
called. User can enable and disable encrypted media in content settings.
26941+
Recorded when requestMediaKeySystemAccess() is called but will be reported
26942+
at most once per renderer process.
26943+
</summary>
26944+
</histogram>
26945+
2693626946
<histogram name="Media.EME.IsIncognito" enum="BooleanIncognito">
2693726947
<owner>[email protected]</owner>
2693826948
<summary>

0 commit comments

Comments
 (0)