implement cef_load_handler::on_load_start()

This commit is contained in:
Mike Blumenkrantz 2015-05-22 16:46:26 -04:00
parent 1e4ceb0a1f
commit cd9dab7b5b

View file

@ -361,6 +361,9 @@ impl WindowMethods for Window {
} }
fn set_page_url(&self, url: Url) { fn set_page_url(&self, url: Url) {
// it seems to be the case that load start is always called
// IMMEDIATELY before address change, so just stick it here
on_load_start(self);
let browser = self.cef_browser.borrow(); let browser = self.cef_browser.borrow();
let browser = match *browser { let browser = match *browser {
None => return, None => return,
@ -455,6 +458,21 @@ impl CompositorProxy for CefCompositorProxy {
} }
} }
fn on_load_start(window: &Window) {
let browser = window.cef_browser.borrow();
let browser = match *browser {
None => return,
Some(ref browser) => browser,
};
if check_ptr_exist!(browser.get_host().get_client(), get_load_handler) &&
check_ptr_exist!(browser.get_host().get_client().get_load_handler(), on_load_start) {
browser.get_host()
.get_client()
.get_load_handler()
.on_load_start((*browser).clone(), browser.get_main_frame());
}
}
#[cfg(target_os="linux")] #[cfg(target_os="linux")]
pub fn init_window() { pub fn init_window() {
unsafe { unsafe {