Skip to content

Commit

Permalink
media: Add UMA to record whether encrypted media is enabled
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
xhwang-chromium authored and Commit bot committed Apr 18, 2017
1 parent c16e5c5 commit 6041683
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,20 @@ ScriptPromise NavigatorRequestMediaKeySystemAccess::requestMediaKeySystemAccess(
//
// Do not check settings for Clear Key.
if (key_system != "org.w3.clearkey") {
// For other key systems, check settings.
if (!document->GetSettings() ||
!document->GetSettings()->GetEncryptedMediaEnabled()) {
// For other key systems, check settings and report UMA.
bool encypted_media_enabled =
document->GetSettings() &&
document->GetSettings()->GetEncryptedMediaEnabled();

static bool has_reported_uma = false;
if (!has_reported_uma) {
has_reported_uma = true;
DEFINE_STATIC_LOCAL(BooleanHistogram, histogram,
("Media.EME.EncryptedMediaEnabled"));
histogram.Count(encypted_media_enabled);
}

if (!encypted_media_enabled) {
return ScriptPromise::RejectWithDOMException(
script_state,
DOMException::Create(kNotSupportedError, "Unsupported keySystem"));
Expand Down
10 changes: 10 additions & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26939,6 +26939,16 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>

<histogram name="Media.EME.EncryptedMediaEnabled" enum="BooleanEnabled">
<owner>xhwang@chromium.org</owner>
<summary>
Whether encrypted media is enabled when requestMediaKeySystemAccess() is
called. User can enable and disable encrypted media in content settings.
Recorded when requestMediaKeySystemAccess() is called but will be reported
at most once per renderer process.
</summary>
</histogram>

<histogram name="Media.EME.IsIncognito" enum="BooleanIncognito">
<owner>xhwang@chromium.org</owner>
<summary>
Expand Down

0 comments on commit 6041683

Please sign in to comment.