system_media_controls_bridge.h
describes a class that can be instantiated sometimes ‘in-process’ (with respect to the browser process) or ‘out-of-process’ (within each dPWA app shim process). This allows us to write the code that speaks to macOS once, but use it from within the browser process for the browser singleton System Media Controls and reuse it any number of times from each app shim process to represent an independent app playing audio.
To achieve this ‘bridge’ concept, remote_cocoa/system_media_controls.mojom
describes a communication interface that allows SystemMediaControlsMac
to speak with the SystemMediaControlsBridge
without knowing whether its core functionality (implemented by ...Bridge
) resides in or out of process.
In the scenario that an out of process bridge is required for dPWAs, we leverage the existing ApplicationBridge interface with app shims to facilitate its creation. See //components/remote_cocoa/app_shim/application_bridge.h
.
now_playing_info_center_delegate[_cocoa]
is used to pass information to macOS.
remote_command_center_deleate[_cocoa]
is used to receive messages from macOS such as a request to pause or play.
Design docs are available in the overview documentation here: //content/browser/media/system_media_controls/README.md