mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
add back/forward/loading members to ServoCefBrowser with related browser methods
This commit is contained in:
parent
0d46a3b89a
commit
3f8d8a3cc9
2 changed files with 27 additions and 0 deletions
|
@ -60,6 +60,18 @@ cef_class_impl! {
|
|||
this.downcast().host.clone()
|
||||
}}
|
||||
|
||||
fn can_go_back(&this,) -> c_int {{
|
||||
this.downcast().back.get() as c_int
|
||||
}}
|
||||
|
||||
fn can_go_forward(&this,) -> c_int {{
|
||||
this.downcast().forward.get() as c_int
|
||||
}}
|
||||
|
||||
fn is_loading(&this,) -> c_int {{
|
||||
this.downcast().loading.get() as c_int
|
||||
}}
|
||||
|
||||
fn go_back(&this,) -> () {{
|
||||
this.send_window_event(WindowEvent::Navigation(WindowNavigateMsg::Back));
|
||||
}}
|
||||
|
@ -90,6 +102,12 @@ pub struct ServoCefBrowser {
|
|||
pub window: Option<Rc<glutin_app::window::Window>>,
|
||||
/// Whether the on-created callback has fired yet.
|
||||
pub callback_executed: Cell<bool>,
|
||||
/// whether the browser can navigate back
|
||||
pub back: Cell<bool>,
|
||||
/// whether the browser can navigate forward
|
||||
pub forward: Cell<bool>,
|
||||
/// whether the browser is loading
|
||||
pub loading: Cell<bool>,
|
||||
/// the display system window handle: only to be used with host.get_window_handle()
|
||||
window_handle: cef_window_handle_t,
|
||||
|
||||
|
@ -130,6 +148,9 @@ impl ServoCefBrowser {
|
|||
servo_browser: RefCell::new(servo_browser),
|
||||
message_queue: RefCell::new(vec!()),
|
||||
id: id,
|
||||
back: Cell::new(false),
|
||||
forward: Cell::new(false),
|
||||
loading: Cell::new(false),
|
||||
window_handle: window_handle,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -322,6 +322,9 @@ impl WindowMethods for Window {
|
|||
None => return,
|
||||
Some(ref browser) => browser,
|
||||
};
|
||||
browser.downcast().loading.set(true);
|
||||
browser.downcast().back.set(back);
|
||||
browser.downcast().forward.set(forward);
|
||||
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()
|
||||
|
@ -338,6 +341,9 @@ impl WindowMethods for Window {
|
|||
None => return,
|
||||
Some(ref browser) => browser,
|
||||
};
|
||||
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_load_handler) &&
|
||||
check_ptr_exist!(browser.get_host().get_client().get_load_handler(), on_loading_state_change) {
|
||||
browser.get_host()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue