diff options
Diffstat (limited to 'chromium/media/mojo')
3 files changed, 19 insertions, 9 deletions
diff --git a/chromium/media/mojo/interfaces/watch_time_recorder.mojom b/chromium/media/mojo/interfaces/watch_time_recorder.mojom index fb162233ec9..1e3492ecd84 100644 --- a/chromium/media/mojo/interfaces/watch_time_recorder.mojom +++ b/chromium/media/mojo/interfaces/watch_time_recorder.mojom @@ -20,7 +20,12 @@ struct PlaybackProperties { bool is_eme; bool is_embedded_media_experience; // Playback from 'Downloads' on Android. gfx.mojom.Size natural_size; // Size of video frame; (0, 0) if audio only. - url.mojom.Origin origin; + + // For privacy, only record the top origin. "Untrusted" signals that this + // value comes from the renderer and should not be used for security checks. + // TODO(crbug.com/787209): Stop getting origin from the renderer. + url.mojom.Origin untrusted_top_origin; + bool is_top_frame; // False for any inner/iframe playbacks. }; // Interface by which the WatchTimeReporter reports watch time. This is used to diff --git a/chromium/media/mojo/services/watch_time_recorder.cc b/chromium/media/mojo/services/watch_time_recorder.cc index f4f6d9eedfc..ed60fc41c95 100644 --- a/chromium/media/mojo/services/watch_time_recorder.cc +++ b/chromium/media/mojo/services/watch_time_recorder.cc @@ -173,9 +173,14 @@ void WatchTimeRecorder::RecordUkmPlaybackData() { } const int32_t source_id = ukm_recorder->GetNewSourceID(); - ukm_recorder->UpdateSourceURL(source_id, properties_->origin.GetURL()); + + // TODO(crbug.com/787209): Stop getting origin from the renderer. + ukm_recorder->UpdateSourceURL(source_id, + properties_->untrusted_top_origin.GetURL()); ukm::builders::Media_BasicPlayback builder(source_id); + builder.SetIsTopFrame(properties_->is_top_frame); + bool recorded_all_metric = false; for (auto& kv : aggregate_watch_time_info_) { if (kv.first == WatchTimeKey::kAudioAll || diff --git a/chromium/media/mojo/services/watch_time_recorder_unittest.cc b/chromium/media/mojo/services/watch_time_recorder_unittest.cc index 3535bec3e3a..025c936e34a 100644 --- a/chromium/media/mojo/services/watch_time_recorder_unittest.cc +++ b/chromium/media/mojo/services/watch_time_recorder_unittest.cc @@ -55,10 +55,10 @@ class WatchTimeRecorderTest : public testing::Test { bool is_mse, bool is_encrypted) { provider_->AcquireWatchTimeRecorder( - mojom::PlaybackProperties::New(kUnknownAudioCodec, kUnknownVideoCodec, - has_audio, has_video, is_mse, - is_encrypted, false, gfx::Size(800, 600), - url::Origin(GURL(kTestOrigin))), + mojom::PlaybackProperties::New( + kUnknownAudioCodec, kUnknownVideoCodec, has_audio, has_video, + is_mse, is_encrypted, false, gfx::Size(800, 600), + url::Origin(GURL(kTestOrigin)), true /* is_top_frame */), mojo::MakeRequest(&wtr_)); } @@ -246,7 +246,7 @@ TEST_F(WatchTimeRecorderTest, TestRebufferingMetrics) { TEST_F(WatchTimeRecorderTest, BasicUkmAudioVideo) { mojom::PlaybackPropertiesPtr properties = mojom::PlaybackProperties::New( kCodecAAC, kCodecH264, true, true, false, false, false, - gfx::Size(800, 600), url::Origin(GURL(kTestOrigin))); + gfx::Size(800, 600), url::Origin(GURL(kTestOrigin)), true); provider_->AcquireWatchTimeRecorder(properties.Clone(), mojo::MakeRequest(&wtr_)); @@ -287,7 +287,7 @@ TEST_F(WatchTimeRecorderTest, BasicUkmAudioVideo) { TEST_F(WatchTimeRecorderTest, BasicUkmAudioVideoWithExtras) { mojom::PlaybackPropertiesPtr properties = mojom::PlaybackProperties::New( kCodecOpus, kCodecVP9, true, true, true, true, false, gfx::Size(800, 600), - url::Origin(GURL(kTestOrigin))); + url::Origin(GURL(kTestOrigin)), true); provider_->AcquireWatchTimeRecorder(properties.Clone(), mojo::MakeRequest(&wtr_)); @@ -354,7 +354,7 @@ TEST_F(WatchTimeRecorderTest, BasicUkmAudioVideoWithExtras) { TEST_F(WatchTimeRecorderTest, BasicUkmAudioVideoBackground) { mojom::PlaybackPropertiesPtr properties = mojom::PlaybackProperties::New( kCodecAAC, kCodecH264, true, true, false, false, false, - gfx::Size(800, 600), url::Origin(GURL(kTestOrigin))); + gfx::Size(800, 600), url::Origin(GURL(kTestOrigin)), true); provider_->AcquireWatchTimeRecorder(properties.Clone(), mojo::MakeRequest(&wtr_)); |