Skip to content
Permalink
Browse files

implement cef_display_handler::on_favicon_urlchange

also fixes #6166 but with more fix than last fix
  • Loading branch information
Mike Blumenkrantz
Mike Blumenkrantz committed Jun 3, 2015
1 parent 12f20f1 commit 5d99933ddc54cd058839b552e635a8d799d7af98
Showing with 15 additions and 2 deletions.
  1. +3 −0 ports/cef/browser.rs
  2. +12 −2 ports/cef/window.rs
@@ -111,6 +111,8 @@ pub struct ServoCefBrowser {
pub forward: Cell<bool>,
/// whether the browser is loading
pub loading: Cell<bool>,
/// a vec of favicon urls for the current page
pub favicons: RefCell<Vec<String>>,
/// the display system window handle: only to be used with host.get_window_handle()
window_handle: cef_window_handle_t,

@@ -154,6 +156,7 @@ impl ServoCefBrowser {
back: Cell::new(false),
forward: Cell::new(false),
loading: Cell::new(false),
favicons: RefCell::new(vec!()),
window_handle: window_handle,
}
}
@@ -316,11 +316,16 @@ impl WindowMethods for Window {
}
}

fn set_favicon(&self, _: Url) {
fn set_favicon(&self, url: Url) {
let browser = self.cef_browser.borrow();
let browser = match *browser {
None => return,
Some(ref browser) => browser,
};
browser.downcast().favicons.borrow_mut().push(url.to_string().clone());
}

fn load_start(&self, back: bool, forward: bool) {
// FIXME(pcwalton): The status code 200 is a lie.
let browser = self.cef_browser.borrow();
let browser = match *browser {
None => return,
@@ -329,6 +334,7 @@ impl WindowMethods for Window {
browser.downcast().loading.set(true);
browser.downcast().back.set(back);
browser.downcast().forward.set(forward);
browser.downcast().favicons.borrow_mut().clear();
if check_ptr_exist!(browser.get_host().get_client(), get_load_handler) &&
check_ptr_exist!(browser.get_host().get_client().get_load_handler(), on_loading_state_change) {
browser.get_host()
@@ -348,6 +354,10 @@ impl WindowMethods for Window {
browser.downcast().loading.set(false);
browser.downcast().back.set(back);
browser.downcast().forward.set(forward);
if check_ptr_exist!(browser.get_host().get_client(), get_display_handler) &&
check_ptr_exist!(browser.get_host().get_client().get_display_handler(), on_favicon_urlchange) {
browser.get_host().get_client().get_display_handler().on_favicon_urlchange((*browser).clone(), browser.downcast().favicons.borrow().clone());
}
if check_ptr_exist!(browser.get_host().get_client(), get_load_handler) &&
check_ptr_exist!(browser.get_host().get_client().get_load_handler(), on_loading_state_change) {
browser.get_host()

0 comments on commit 5d99933

Please sign in to comment.
You can’t perform that action at this time.