mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Extend libsimpleservo API with a callback for media session activation
This commit is contained in:
parent
d7d775ac60
commit
fd040b0a55
2 changed files with 8 additions and 0 deletions
|
@ -130,6 +130,8 @@ pub trait HostTrait {
|
||||||
fn get_clipboard_contents(&self) -> Option<String>;
|
fn get_clipboard_contents(&self) -> Option<String>;
|
||||||
/// Sets system clipboard contents
|
/// Sets system clipboard contents
|
||||||
fn set_clipboard_contents(&self, contents: String);
|
fn set_clipboard_contents(&self, contents: String);
|
||||||
|
/// Called when a media session is activated or deactived.
|
||||||
|
fn on_media_session(&self, active: bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ServoGlue {
|
pub struct ServoGlue {
|
||||||
|
|
|
@ -216,6 +216,7 @@ pub struct CHostCallbacks {
|
||||||
pub on_ime_state_changed: extern "C" fn(show: bool),
|
pub on_ime_state_changed: extern "C" fn(show: bool),
|
||||||
pub get_clipboard_contents: extern "C" fn() -> *const c_char,
|
pub get_clipboard_contents: extern "C" fn() -> *const c_char,
|
||||||
pub set_clipboard_contents: extern "C" fn(contents: *const c_char),
|
pub set_clipboard_contents: extern "C" fn(contents: *const c_char),
|
||||||
|
pub on_media_session: extern "C" fn(active: bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Servo options
|
/// Servo options
|
||||||
|
@ -708,4 +709,9 @@ impl HostTrait for HostCallbacks {
|
||||||
let contents = CString::new(contents).expect("Can't create string");
|
let contents = CString::new(contents).expect("Can't create string");
|
||||||
(self.0.set_clipboard_contents)(contents.as_ptr());
|
(self.0.set_clipboard_contents)(contents.as_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn on_media_session(&self, active: bool) {
|
||||||
|
debug!("on_media_session (active: {:?})", active);
|
||||||
|
(self.0.on_media_session)(active);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue