[Global Media Controls] Add MediaKeysListenerManager
This CL adds a MediaKeysListenerManager that uses a global
MediaKeysListener to receive media key events and then selectively
propagates those to registered delegates. In particular, it owns a
HardwareKeyMediaController that uses media key events to control the
active media session.
GlobalShortcutListenerWin is updated to use MediaKeysListenerManager
to receive media key events, which allows extensions to prevent the
HardwareKeyMediaController from receiving media key events.
This CL also makes a slight change to the MediaKeysListener API to
allow delegates to know if a key fails to register.
Bug: 915420
Change-Id: I6b6111a41c66cf522ffa3ed9f66d90d06b916430
Reviewed-on: https://chromium-review.googlesource.com/c/1379180
Commit-Queue: Tommy Steimel <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Becca Hughes <[email protected]>
Reviewed-by: Mounir Lamouri <[email protected]>
Cr-Commit-Position: refs/heads/master@{#625544}
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
index 54eceff..2f87c627 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -1171,6 +1171,8 @@
"media/flinging_renderer.h",
"media/forwarding_audio_stream_factory.cc",
"media/forwarding_audio_stream_factory.h",
+ "media/hardware_key_media_controller.cc",
+ "media/hardware_key_media_controller.h",
"media/in_process_audio_loopback_stream_creator.cc",
"media/in_process_audio_loopback_stream_creator.h",
"media/media_devices_permission_checker.cc",
@@ -1189,6 +1191,8 @@
"media/media_internals_proxy.h",
"media/media_internals_ui.cc",
"media/media_internals_ui.h",
+ "media/media_keys_listener_manager_impl.cc",
+ "media/media_keys_listener_manager_impl.h",
"media/media_web_contents_observer.cc",
"media/media_web_contents_observer.h",
"media/midi_host.cc",