Commit 1d61559a authored by Dylan Cutler's avatar Dylan Cutler Committed by Commit Bot

Instrument ScreenOrientation.lock() for the identifiability study.

This API leaks whether or not a particular Chrome client supports
locking device orientation. This bit of information can be used to
partially fingerprint users across different origins.

The instrumentation reports digests of whether or not screen orientation
locking is supported for UKM for us to analyze how much entropy about a
user's origin this API leaks.

Bug: 973801
Change-Id: I3c89aa6ecdabf166e490f359cb5493a95608d037
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2443511
Commit-Queue: Dylan Cutler <dylancutler@google.com>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarAsanka Herath <asanka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813288}
parent 086a9cd4
......@@ -7,6 +7,8 @@
#include <memory>
#include <utility>
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h"
#include "third_party/blink/public/common/widget/screen_info.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
......@@ -238,6 +240,18 @@ void ScreenOrientationController::OnLockOrientationResult(
if (!pending_callback_ || request_id != request_id_)
return;
if (IdentifiabilityStudySettings::Get()->IsSurfaceAllowed(
IdentifiableSurface::FromTypeAndToken(
IdentifiableSurface::Type::kWebFeature,
WebFeature::kScreenOrientationLock))) {
auto* context = GetExecutionContext();
IdentifiabilityMetricBuilder(context->UkmSourceID())
.SetWebfeature(WebFeature::kScreenOrientationLock,
result == ScreenOrientationLockResult::
SCREEN_ORIENTATION_LOCK_RESULT_SUCCESS)
.Record(context->UkmRecorder());
}
switch (result) {
case ScreenOrientationLockResult::SCREEN_ORIENTATION_LOCK_RESULT_SUCCESS:
pending_callback_->OnSuccess();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment