Behave properly when app is suspended

This commit is contained in:
Paul Rouget 2018-08-14 14:26:10 +02:00
parent e051c5880e
commit ae407e9a65
7 changed files with 69 additions and 9 deletions

View file

@ -208,6 +208,12 @@ impl ServoGlue {
self.process_event(event)
}
/// Redraw the page.
pub fn refresh(&mut self) -> Result<(), &'static str> {
info!("refresh");
self.process_event(WindowEvent::Refresh)
}
/// Stop loading the page.
pub fn stop(&mut self) -> Result<(), &'static str> {
debug!("TODO can't stop won't stop");

View file

@ -144,6 +144,12 @@ pub extern "C" fn stop() {
call(|s| s.stop());
}
#[no_mangle]
pub extern "C" fn refresh() {
debug!("refresh");
call(|s| s.refresh());
}
#[no_mangle]
pub extern "C" fn go_back() {
debug!("go_back");

View file

@ -145,6 +145,12 @@ pub fn Java_com_mozilla_servoview_JNIServo_stop(env: JNIEnv, _class: JClass) {
call(env, |s| s.stop());
}
#[no_mangle]
pub fn Java_com_mozilla_servoview_JNIServo_refresh(env: JNIEnv, _class: JClass) {
debug!("refresh");
call(env, |s| s.refresh());
}
#[no_mangle]
pub fn Java_com_mozilla_servoview_JNIServo_goBack(env: JNIEnv, _class: JClass) {
debug!("goBack");