Make MediaSession handle embedder requested action

This commit is contained in:
Fernando Jiménez Moreno 2019-10-04 18:05:36 +02:00
parent 6233f78de4
commit fa61191405
2 changed files with 9 additions and 1 deletions

View file

@ -15,6 +15,7 @@ use crate::dom::window::Window;
use crate::script_thread::ScriptThread; use crate::script_thread::ScriptThread;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use msg::constellation_msg::TopLevelBrowsingContextId; use msg::constellation_msg::TopLevelBrowsingContextId;
use script_traits::MediaSessionActionType;
use std::rc::Rc; use std::rc::Rc;
#[dom_struct] #[dom_struct]
@ -46,6 +47,10 @@ impl MediaSession {
MediaSessionBinding::Wrap, MediaSessionBinding::Wrap,
) )
} }
pub fn handle_action(&self, action: MediaSessionActionType) {
// TODO
}
} }
impl MediaSessionMethods for MediaSession { impl MediaSessionMethods for MediaSession {

View file

@ -3941,7 +3941,10 @@ impl ScriptThread {
browsing_context_id: TopLevelBrowsingContextId, browsing_context_id: TopLevelBrowsingContextId,
action: MediaSessionActionType, action: MediaSessionActionType,
) { ) {
// TODO match self.media_sessions.borrow().get(&browsing_context_id) {
Some(session) => session.handle_action(action),
None => warn!("No MediaSession for this browsing context"),
};
} }
pub fn enqueue_microtask(job: Microtask) { pub fn enqueue_microtask(job: Microtask) {