diff --git a/ports/cef/interfaces/cef_browser.rs b/ports/cef/interfaces/cef_browser.rs index 57db64c60a2a..360f2ff6b7fc 100644 --- a/ports/cef/interfaces/cef_browser.rs +++ b/ports/cef/interfaces/cef_browser.rs @@ -174,7 +174,7 @@ pub struct _cef_browser_t { // Returns the names of all existing frames. // pub get_frame_names: Option ()>, + names: &types::cef_string_list_t) -> ()>, // // Send a message to the specified |target_process|. Returns true (1) if the @@ -567,7 +567,7 @@ impl CefBrowser { // // Returns the names of all existing frames. // - pub fn get_frame_names(&self, names: Vec) -> () { + pub fn get_frame_names(&self, names: &Vec) -> () { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") @@ -647,7 +647,7 @@ pub struct _cef_run_file_dialog_callback_t { pub on_file_dialog_dismissed: Option ()>, + file_paths: &types::cef_string_list_t) -> ()>, // // The reference count. This will only be present for Rust instances! @@ -742,7 +742,7 @@ impl CefRunFileDialogCallback { // dialog mode. If the selection was cancelled |file_paths| will be NULL. // pub fn on_file_dialog_dismissed(&self, selected_accept_filter: libc::c_int, - file_paths: Vec) -> () { + file_paths: &Vec) -> () { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") @@ -1047,7 +1047,7 @@ pub struct _cef_browser_host_t { pub run_file_dialog: Option ()>, @@ -1606,7 +1606,7 @@ impl CefBrowserHost { // will be initiated asynchronously on the UI thread. // pub fn run_file_dialog(&self, mode: types::cef_file_dialog_mode_t, - title: &[u16], default_file_path: &[u16], accept_filters: Vec, + title: &[u16], default_file_path: &[u16], accept_filters: &Vec, selected_accept_filter: libc::c_int, callback: interfaces::CefRunFileDialogCallback) -> () { if self.c_object.is_null() || diff --git a/ports/cef/interfaces/cef_browser_process_handler.rs b/ports/cef/interfaces/cef_browser_process_handler.rs index 49cc9e327b18..b4eec4be4ded 100644 --- a/ports/cef/interfaces/cef_browser_process_handler.rs +++ b/ports/cef/interfaces/cef_browser_process_handler.rs @@ -95,7 +95,8 @@ pub struct _cef_browser_process_handler_t { this: *mut cef_browser_process_handler_t) -> *mut interfaces::cef_print_handler_t>, // - // Called when the application should call cef_do_message_loop_work() + // Called when the application should call cef_do_message_loop_work(). May be + // called from a thread. // pub on_work_available: Option ()>, @@ -261,7 +262,8 @@ impl CefBrowserProcessHandler { } // - // Called when the application should call cef_do_message_loop_work() + // Called when the application should call cef_do_message_loop_work(). May be + // called from a thread. // pub fn on_work_available(&self) -> () { if self.c_object.is_null() || diff --git a/ports/cef/interfaces/cef_command_line.rs b/ports/cef/interfaces/cef_command_line.rs index 53674ef25baf..d8926bf76c17 100644 --- a/ports/cef/interfaces/cef_command_line.rs +++ b/ports/cef/interfaces/cef_command_line.rs @@ -109,7 +109,7 @@ pub struct _cef_command_line_t { // array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* } // pub get_argv: Option ()>, + argv: &types::cef_string_list_t) -> ()>, // // Constructs and returns the represented command line string. Use this @@ -183,7 +183,7 @@ pub struct _cef_command_line_t { // Get the remaining command line arguments. // pub get_arguments: Option ()>, + arguments: &types::cef_string_list_t) -> ()>, // // Add an argument to the end of the command line. @@ -392,7 +392,7 @@ impl CefCommandLine { // Retrieve the original command line string as a vector of strings. The argv // array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* } // - pub fn get_argv(&self, argv: Vec) -> () { + pub fn get_argv(&self, argv: &Vec) -> () { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") @@ -572,7 +572,7 @@ impl CefCommandLine { // // Get the remaining command line arguments. // - pub fn get_arguments(&self, arguments: Vec) -> () { + pub fn get_arguments(&self, arguments: &Vec) -> () { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") diff --git a/ports/cef/interfaces/cef_context_menu_handler.rs b/ports/cef/interfaces/cef_context_menu_handler.rs index dedb9fd5c645..27373d33eabd 100644 --- a/ports/cef/interfaces/cef_context_menu_handler.rs +++ b/ports/cef/interfaces/cef_context_menu_handler.rs @@ -403,7 +403,7 @@ pub struct _cef_context_menu_params_t { // pub get_dictionary_suggestions: Option libc::c_int>, + suggestions: &types::cef_string_list_t) -> libc::c_int>, // // Returns true (1) if the context menu was invoked on an editable node. @@ -746,7 +746,7 @@ impl CefContextMenuParams { // is one. // pub fn get_dictionary_suggestions(&self, - suggestions: Vec) -> libc::c_int { + suggestions: &Vec) -> libc::c_int { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") diff --git a/ports/cef/interfaces/cef_cookie.rs b/ports/cef/interfaces/cef_cookie.rs index 1b1090e94998..a41e7dff8797 100644 --- a/ports/cef/interfaces/cef_cookie.rs +++ b/ports/cef/interfaces/cef_cookie.rs @@ -64,7 +64,7 @@ pub struct _cef_cookie_manager_t { // Must be called before any cookies are accessed. // pub set_supported_schemes: Option ()>, // @@ -227,7 +227,7 @@ impl CefCookieManager { // executed asnychronously on the IO thread after the change has been applied. // Must be called before any cookies are accessed. // - pub fn set_supported_schemes(&self, schemes: Vec, + pub fn set_supported_schemes(&self, schemes: &Vec, callback: interfaces::CefCompletionCallback) -> () { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { diff --git a/ports/cef/interfaces/cef_dialog_handler.rs b/ports/cef/interfaces/cef_dialog_handler.rs index c64634e061e8..d31ffc442c6a 100644 --- a/ports/cef/interfaces/cef_dialog_handler.rs +++ b/ports/cef/interfaces/cef_dialog_handler.rs @@ -65,7 +65,7 @@ pub struct _cef_file_dialog_callback_t { // pub cont: Option ()>, + file_paths: &types::cef_string_list_t) -> ()>, // // Cancel the file selection. @@ -165,7 +165,7 @@ impl CefFileDialogCallback { // value is treated the same as calling cancel(). // pub fn cont(&self, selected_accept_filter: libc::c_int, - file_paths: Vec) -> () { + file_paths: &Vec) -> () { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") @@ -251,7 +251,7 @@ pub struct _cef_dialog_handler_t { browser: *mut interfaces::cef_browser_t, mode: types::cef_file_dialog_mode_t, title: *const types::cef_string_t, default_file_path: *const types::cef_string_t, - accept_filters: types::cef_string_list_t, + accept_filters: &types::cef_string_list_t, selected_accept_filter: libc::c_int, callback: *mut interfaces::cef_file_dialog_callback_t) -> libc::c_int>, @@ -357,7 +357,7 @@ impl CefDialogHandler { // pub fn on_file_dialog(&self, browser: interfaces::CefBrowser, mode: types::cef_file_dialog_mode_t, title: &[u16], - default_file_path: &[u16], accept_filters: Vec, + default_file_path: &[u16], accept_filters: &Vec, selected_accept_filter: libc::c_int, callback: interfaces::CefFileDialogCallback) -> libc::c_int { if self.c_object.is_null() || diff --git a/ports/cef/interfaces/cef_display_handler.rs b/ports/cef/interfaces/cef_display_handler.rs index 1221e0e38890..0b9eae298c86 100644 --- a/ports/cef/interfaces/cef_display_handler.rs +++ b/ports/cef/interfaces/cef_display_handler.rs @@ -77,7 +77,7 @@ pub struct _cef_display_handler_t { // pub on_favicon_urlchange: Option ()>, + icon_urls: &types::cef_string_list_t) -> ()>, // // Called when the browser is about to display a tooltip. |text| contains the @@ -234,7 +234,7 @@ impl CefDisplayHandler { // Called when the page icon changes. // pub fn on_favicon_urlchange(&self, browser: interfaces::CefBrowser, - icon_urls: Vec) -> () { + icon_urls: &Vec) -> () { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") diff --git a/ports/cef/interfaces/cef_drag_data.rs b/ports/cef/interfaces/cef_drag_data.rs index 2c4d3ec1349e..eefaa1f23745 100644 --- a/ports/cef/interfaces/cef_drag_data.rs +++ b/ports/cef/interfaces/cef_drag_data.rs @@ -149,7 +149,7 @@ pub struct _cef_drag_data_t { // window. // pub get_file_names: Option libc::c_int>, + names: &types::cef_string_list_t) -> libc::c_int>, // // Set the link URL that is being dragged. @@ -499,7 +499,7 @@ impl CefDragData { // Retrieve the list of file names that are being dragged into the browser // window. // - pub fn get_file_names(&self, names: Vec) -> libc::c_int { + pub fn get_file_names(&self, names: &Vec) -> libc::c_int { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") diff --git a/ports/cef/interfaces/cef_ssl_info.rs b/ports/cef/interfaces/cef_ssl_info.rs index d2cfcba7c59f..27108f472a7b 100644 --- a/ports/cef/interfaces/cef_ssl_info.rs +++ b/ports/cef/interfaces/cef_ssl_info.rs @@ -97,20 +97,20 @@ pub struct _cef_sslcert_principal_t { // pub get_street_addresses: Option ()>, + addresses: &types::cef_string_list_t) -> ()>, // // Retrieve the list of organization names. // pub get_organization_names: Option ( + this: *mut cef_sslcert_principal_t, names: &types::cef_string_list_t) -> ( )>, // // Retrieve the list of organization unit names. // pub get_organization_unit_names: Option ( + this: *mut cef_sslcert_principal_t, names: &types::cef_string_list_t) -> ( )>, // @@ -118,7 +118,7 @@ pub struct _cef_sslcert_principal_t { // pub get_domain_components: Option ()>, + components: &types::cef_string_list_t) -> ()>, // // The reference count. This will only be present for Rust instances! @@ -288,7 +288,7 @@ impl CefSSLCertPrincipal { // // Retrieve the list of street addresses. // - pub fn get_street_addresses(&self, addresses: Vec) -> () { + pub fn get_street_addresses(&self, addresses: &Vec) -> () { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") @@ -304,7 +304,7 @@ impl CefSSLCertPrincipal { // // Retrieve the list of organization names. // - pub fn get_organization_names(&self, names: Vec) -> () { + pub fn get_organization_names(&self, names: &Vec) -> () { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") @@ -320,7 +320,7 @@ impl CefSSLCertPrincipal { // // Retrieve the list of organization unit names. // - pub fn get_organization_unit_names(&self, names: Vec) -> () { + pub fn get_organization_unit_names(&self, names: &Vec) -> () { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") @@ -336,7 +336,7 @@ impl CefSSLCertPrincipal { // // Retrieve the list of domain components. // - pub fn get_domain_components(&self, components: Vec) -> () { + pub fn get_domain_components(&self, components: &Vec) -> () { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") diff --git a/ports/cef/interfaces/cef_v8.rs b/ports/cef/interfaces/cef_v8.rs index efe234b92a38..eed48cc7a048 100644 --- a/ports/cef/interfaces/cef_v8.rs +++ b/ports/cef/interfaces/cef_v8.rs @@ -1364,7 +1364,7 @@ pub struct _cef_v8value_t { // based keys will also be returned as strings. // pub get_keys: Option libc::c_int>, + keys: &types::cef_string_list_t) -> libc::c_int>, // // Sets the user data for this object and returns true (1) on success. Returns @@ -2117,7 +2117,7 @@ impl CefV8Value { // Read the keys for the object's values into the specified vector. Integer- // based keys will also be returned as strings. // - pub fn get_keys(&self, keys: Vec) -> libc::c_int { + pub fn get_keys(&self, keys: &Vec) -> libc::c_int { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") diff --git a/ports/cef/interfaces/cef_values.rs b/ports/cef/interfaces/cef_values.rs index 398ae37b782e..8a9234b4e342 100644 --- a/ports/cef/interfaces/cef_values.rs +++ b/ports/cef/interfaces/cef_values.rs @@ -1099,7 +1099,7 @@ pub struct _cef_dictionary_value_t { // Reads all keys for this dictionary into the specified vector. // pub get_keys: Option libc::c_int>, + keys: &types::cef_string_list_t) -> libc::c_int>, // // Removes the value at the specified key. Returns true (1) is the value was @@ -1489,7 +1489,7 @@ impl CefDictionaryValue { // // Reads all keys for this dictionary into the specified vector. // - pub fn get_keys(&self, keys: Vec) -> libc::c_int { + pub fn get_keys(&self, keys: &Vec) -> libc::c_int { if self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE { panic!("called a CEF method on a null object") diff --git a/ports/cef/window.rs b/ports/cef/window.rs index 4ec98a0ac15f..95987fa7fccd 100644 --- a/ports/cef/window.rs +++ b/ports/cef/window.rs @@ -356,7 +356,7 @@ impl WindowMethods for Window { 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()); + browser.get_host().get_client().get_display_handler().on_favicon_urlchange((*browser).clone(), &browser.downcast().favicons.borrow()); } 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) { diff --git a/ports/cef/wrappers.rs b/ports/cef/wrappers.rs index 2cc1d48fe63c..dcdc686d9e58 100644 --- a/ports/cef/wrappers.rs +++ b/ports/cef/wrappers.rs @@ -135,7 +135,6 @@ cef_noop_wrapper!(*mut cef_jsdialog_handler_t); cef_noop_wrapper!(*mut cef_keyboard_handler_t); cef_noop_wrapper!(*mut cef_load_handler_t); cef_noop_wrapper!(*mut cef_request_handler_t); -cef_noop_wrapper!(*mut cef_string_list_t); cef_noop_wrapper!(*mut cef_string_utf16); cef_noop_wrapper!(c_int); cef_noop_wrapper!(CefApp); @@ -185,10 +184,10 @@ cef_noop_wrapper!(f64); cef_noop_wrapper!(i64); cef_noop_wrapper!(u32); cef_noop_wrapper!(u64); +cef_noop_wrapper!(cef_string_list_t); cef_unimplemented_wrapper!(*const *mut cef_v8value_t, *const CefV8Value); cef_unimplemented_wrapper!(*mut *mut cef_post_data_element_t, *mut CefPostDataElement); -cef_unimplemented_wrapper!(cef_string_list_t, Vec); cef_unimplemented_wrapper!(cef_string_map_t, HashMap); cef_unimplemented_wrapper!(cef_string_multimap_t, HashMap>); cef_unimplemented_wrapper!(cef_string_t, String); @@ -293,3 +292,11 @@ impl<'a> CefWrap for &'a mut String { } } +impl<'a> CefWrap<&'a cef_string_list_t> for &'a cef_string_list_t { + fn to_c(stringlist: &'a cef_string_list_t) -> &'a cef_string_list_t { + stringlist + } + unsafe fn to_rust(_: &'a cef_string_list_t) -> &'a cef_string_list_t { + panic!("unimplemented CEF type conversion: cef_string_t"); + } +}