From 4679fc77b026bfe4b7ec548dd5c797f526d69216 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 5 May 2015 13:35:47 -0400 Subject: [PATCH] update cef embedding interfaces to latest cef --- ports/cef/interfaces/cef_app.rs | 2 +- ports/cef/interfaces/cef_auth_callback.rs | 2 +- ports/cef/interfaces/cef_browser.rs | 285 ++++- .../interfaces/cef_browser_process_handler.rs | 2 +- ports/cef/interfaces/cef_callback.rs | 2 +- ports/cef/interfaces/cef_client.rs | 22 +- ports/cef/interfaces/cef_command_line.rs | 2 +- .../interfaces/cef_context_menu_handler.rs | 28 +- ports/cef/interfaces/cef_cookie.rs | 444 +++++-- ports/cef/interfaces/cef_dialog_handler.rs | 64 +- ports/cef/interfaces/cef_display_handler.rs | 26 +- ports/cef/interfaces/cef_dom.rs | 42 +- ports/cef/interfaces/cef_download_handler.rs | 42 +- ports/cef/interfaces/cef_download_item.rs | 24 +- ports/cef/interfaces/cef_drag_data.rs | 2 +- ports/cef/interfaces/cef_drag_handler.rs | 2 +- ports/cef/interfaces/cef_find_handler.rs | 205 ++++ ports/cef/interfaces/cef_focus_handler.rs | 2 +- ports/cef/interfaces/cef_frame.rs | 2 +- ports/cef/interfaces/cef_geolocation.rs | 2 +- .../cef/interfaces/cef_geolocation_handler.rs | 2 +- ports/cef/interfaces/cef_jsdialog_handler.rs | 2 +- ports/cef/interfaces/cef_keyboard_handler.rs | 2 +- ports/cef/interfaces/cef_life_span_handler.rs | 68 +- ports/cef/interfaces/cef_load_handler.rs | 2 +- ports/cef/interfaces/cef_menu_model.rs | 2 +- ports/cef/interfaces/cef_navigation_entry.rs | 388 +++++++ ports/cef/interfaces/cef_origin_whitelist.rs | 2 +- ports/cef/interfaces/cef_parser.rs | 46 + ports/cef/interfaces/cef_path_util.rs | 2 +- ports/cef/interfaces/cef_print_handler.rs | 2 +- ports/cef/interfaces/cef_print_settings.rs | 2 +- ports/cef/interfaces/cef_process_message.rs | 2 +- ports/cef/interfaces/cef_process_util.rs | 2 +- ports/cef/interfaces/cef_render_handler.rs | 70 +- .../interfaces/cef_render_process_handler.rs | 2 +- ports/cef/interfaces/cef_request.rs | 25 +- ports/cef/interfaces/cef_request_context.rs | 234 +++- .../interfaces/cef_request_context_handler.rs | 20 +- ports/cef/interfaces/cef_request_handler.rs | 443 ++++--- .../interfaces/cef_resource_bundle_handler.rs | 2 +- ports/cef/interfaces/cef_resource_handler.rs | 2 +- ports/cef/interfaces/cef_response.rs | 2 +- ports/cef/interfaces/cef_scheme.rs | 2 +- ports/cef/interfaces/cef_ssl_info.rs | 628 ++++++++++ ports/cef/interfaces/cef_stream.rs | 2 +- ports/cef/interfaces/cef_string_visitor.rs | 2 +- ports/cef/interfaces/cef_task.rs | 2 +- ports/cef/interfaces/cef_trace.rs | 2 +- ports/cef/interfaces/cef_urlrequest.rs | 25 +- ports/cef/interfaces/cef_v8.rs | 34 +- ports/cef/interfaces/cef_values.rs | 1027 ++++++++++++++++- ports/cef/interfaces/cef_web_plugin.rs | 2 +- ports/cef/interfaces/cef_xml_reader.rs | 2 +- ports/cef/interfaces/cef_zip_reader.rs | 2 +- ports/cef/interfaces/mod.rs | 174 ++- ports/cef/wrappers.rs | 39 +- 57 files changed, 3731 insertions(+), 738 deletions(-) create mode 100644 ports/cef/interfaces/cef_find_handler.rs create mode 100644 ports/cef/interfaces/cef_navigation_entry.rs create mode 100644 ports/cef/interfaces/cef_parser.rs create mode 100644 ports/cef/interfaces/cef_ssl_info.rs diff --git a/ports/cef/interfaces/cef_app.rs b/ports/cef/interfaces/cef_app.rs index 0c22ddc8bc3..287cf5097b4 100644 --- a/ports/cef/interfaces/cef_app.rs +++ b/ports/cef/interfaces/cef_app.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_auth_callback.rs b/ports/cef/interfaces/cef_auth_callback.rs index 076346dd899..94681070a64 100644 --- a/ports/cef/interfaces/cef_auth_callback.rs +++ b/ports/cef/interfaces/cef_auth_callback.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_browser.rs b/ports/cef/interfaces/cef_browser.rs index 474d855ffea..30a580b6d13 100644 --- a/ports/cef/interfaces/cef_browser.rs +++ b/ports/cef/interfaces/cef_browser.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -611,13 +611,15 @@ pub struct _cef_run_file_dialog_callback_t { pub base: types::cef_base_t, // - // Called asynchronously after the file dialog is dismissed. If the selection - // was successful |file_paths| will be a single value or a list of values - // depending on the dialog mode. If the selection was cancelled |file_paths| - // will be NULL. + // Called asynchronously after the file dialog is dismissed. + // |selected_accept_filter| is the 0-based index of the value selected from + // the accept filters array passed to cef_browser_host_t::RunFileDialog. + // |file_paths| will be a single value or a list of values depending on the + // dialog mode. If the selection was cancelled |file_paths| will be NULL. // - pub cont: Option ()>, // @@ -702,21 +704,22 @@ impl CefRunFileDialogCallback { } // - // Called asynchronously after the file dialog is dismissed. If the selection - // was successful |file_paths| will be a single value or a list of values - // depending on the dialog mode. If the selection was cancelled |file_paths| - // will be NULL. + // Called asynchronously after the file dialog is dismissed. + // |selected_accept_filter| is the 0-based index of the value selected from + // the accept filters array passed to cef_browser_host_t::RunFileDialog. + // |file_paths| will be a single value or a list of values depending on the + // dialog mode. If the selection was cancelled |file_paths| will be NULL. // - pub fn cont(&self, browser_host: interfaces::CefBrowserHost, + pub fn on_file_dialog_dismissed(&self, selected_accept_filter: libc::c_int, file_paths: Vec) -> () { if self.c_object.is_null() { panic!("called a CEF method on a null object") } unsafe { CefWrap::to_rust( - ((*self.c_object).cont.unwrap())( + ((*self.c_object).on_file_dialog_dismissed.unwrap())( self.c_object, - CefWrap::to_c(browser_host), + CefWrap::to_c(selected_accept_filter), CefWrap::to_c(file_paths))) } } @@ -747,6 +750,159 @@ impl CefWrap<*mut cef_run_file_dialog_callback_t> for Option libc::c_int>, + + // + // The reference count. This will only be present for Rust instances! + // + pub ref_count: usize, + + // + // Extra data. This will only be present for Rust instances! + // + pub extra: u8, +} + +pub type cef_navigation_entry_visitor_t = _cef_navigation_entry_visitor_t; + + +// +// Callback structure for cef_browser_host_t::GetNavigationEntries. The +// functions of this structure will be called on the browser process UI thread. +// +pub struct CefNavigationEntryVisitor { + c_object: *mut cef_navigation_entry_visitor_t, +} + +impl Clone for CefNavigationEntryVisitor { + fn clone(&self) -> CefNavigationEntryVisitor{ + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base); + } + CefNavigationEntryVisitor { + c_object: self.c_object, + } + } + } +} + +impl Drop for CefNavigationEntryVisitor { + fn drop(&mut self) { + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base); + } + } + } +} + +impl CefNavigationEntryVisitor { + pub unsafe fn from_c_object(c_object: *mut cef_navigation_entry_visitor_t) -> CefNavigationEntryVisitor { + CefNavigationEntryVisitor { + c_object: c_object, + } + } + + pub unsafe fn from_c_object_addref(c_object: *mut cef_navigation_entry_visitor_t) -> CefNavigationEntryVisitor { + if !c_object.is_null() { + ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base); + } + CefNavigationEntryVisitor { + c_object: c_object, + } + } + + pub fn c_object(&self) -> *mut cef_navigation_entry_visitor_t { + self.c_object + } + + pub fn c_object_addrefed(&self) -> *mut cef_navigation_entry_visitor_t { + unsafe { + if !self.c_object.is_null() { + eutil::add_ref(self.c_object as *mut types::cef_base_t); + } + self.c_object + } + } + + pub fn is_null_cef_object(&self) -> bool { + self.c_object.is_null() + } + pub fn is_not_null_cef_object(&self) -> bool { + !self.c_object.is_null() + } + + // + // Method that will be executed. Do not keep a reference to |entry| outside of + // this callback. Return true (1) to continue visiting entries or false (0) to + // stop. |current| is true (1) if this entry is the currently loaded + // navigation entry. |index| is the 0-based index of this entry and |total| is + // the total number of entries. + // + pub fn visit(&self, entry: interfaces::CefNavigationEntry, + current: libc::c_int, index: libc::c_int, + total: libc::c_int) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).visit.unwrap())( + self.c_object, + CefWrap::to_c(entry), + CefWrap::to_c(current), + CefWrap::to_c(index), + CefWrap::to_c(total))) + } + } +} + +impl CefWrap<*mut cef_navigation_entry_visitor_t> for CefNavigationEntryVisitor { + fn to_c(rust_object: CefNavigationEntryVisitor) -> *mut cef_navigation_entry_visitor_t { + rust_object.c_object_addrefed() + } + unsafe fn to_rust(c_object: *mut cef_navigation_entry_visitor_t) -> CefNavigationEntryVisitor { + CefNavigationEntryVisitor::from_c_object_addref(c_object) + } +} +impl CefWrap<*mut cef_navigation_entry_visitor_t> for Option { + fn to_c(rust_object: Option) -> *mut cef_navigation_entry_visitor_t { + match rust_object { + None => ptr::null_mut(), + Some(rust_object) => rust_object.c_object_addrefed(), + } + } + unsafe fn to_rust(c_object: *mut cef_navigation_entry_visitor_t) -> Option { + if c_object.is_null() { + None + } else { + Some(CefNavigationEntryVisitor::from_c_object_addref(c_object)) + } + } +} + + // // Structure used to represent the browser process aspects of a browser window. // The functions of this structure can only be called in the browser process. @@ -837,18 +993,23 @@ pub struct _cef_browser_host_t { // Call to run a file chooser dialog. Only a single file chooser dialog may be // pending at any given time. |mode| represents the type of dialog to display. // |title| to the title to be used for the dialog and may be NULL to show the - // default title ("Open" or "Save" depending on the mode). |default_file_name| - // is the default file name to select in the dialog. |accept_types| is a list - // of valid lower-cased MIME types or file extensions specified in an input - // element and is used to restrict selectable files to such types. |callback| - // will be executed after the dialog is dismissed or immediately if another - // dialog is already pending. The dialog will be initiated asynchronously on - // the UI thread. + // default title ("Open" or "Save" depending on the mode). |default_file_path| + // is the path with optional directory and/or file name component that will be + // initially selected in the dialog. |accept_filters| are used to restrict the + // selectable file types and may any combination of (a) valid lower-cased MIME + // types (e.g. "text/*" or "image/*"), (b) individual file extensions (e.g. + // ".txt" or ".png"), or (c) combined description and file extension delimited + // using "|" and ";" (e.g. "Image Types|.png;.gif;.jpg"). + // |selected_accept_filter| is the 0-based index of the filter that will be + // selected by default. |callback| will be executed after the dialog is + // dismissed or immediately if another dialog is already pending. The dialog + // will be initiated asynchronously on the UI thread. // pub run_file_dialog: Option ()>, // @@ -864,10 +1025,11 @@ pub struct _cef_browser_host_t { // // Search for |searchText|. |identifier| can be used to have multiple searches - // running simultaneously. |forward| indicates whether to search forward or + // running simultaniously. |forward| indicates whether to search forward or // backward within the page. |matchCase| indicates whether the search should // be case-sensitive. |findNext| indicates whether this is the first request - // or a follow-up. + // or a follow-up. The cef_find_handler_t instance, if any, returned via + // cef_client_t::GetFindHandler will be called to report find results. // pub find: Option ( )>, + // + // Retrieve a snapshot of current navigation entries as values sent to the + // specified visitor. If |current_only| is true (1) only the current + // navigation entry will be sent, otherwise all navigation entries will be + // sent. + // + // + pub get_navigation_entries: Option ()>, + // // Set whether mouse cursor change is disabled. // @@ -1089,7 +1263,7 @@ pub struct _cef_browser_host_t { // being cancelled. |x| and |y| are mouse coordinates relative to the upper- // left corner of the view. If the web view is both the drag source and the // drag target then all DragTarget* functions should be called before - // DragSource* methods. This function is only used when window rendering is + // DragSource* mthods. This function is only used when window rendering is // disabled. // pub drag_source_ended_at: Option, + title: &[u16], default_file_path: &[u16], accept_filters: Vec, + selected_accept_filter: libc::c_int, callback: interfaces::CefRunFileDialogCallback) -> () { if self.c_object.is_null() { panic!("called a CEF method on a null object") @@ -1379,8 +1558,9 @@ impl CefBrowserHost { self.c_object, CefWrap::to_c(mode), CefWrap::to_c(title), - CefWrap::to_c(default_file_name), - CefWrap::to_c(accept_types), + CefWrap::to_c(default_file_path), + CefWrap::to_c(accept_filters), + CefWrap::to_c(selected_accept_filter), CefWrap::to_c(callback))) } } @@ -1416,10 +1596,11 @@ impl CefBrowserHost { // // Search for |searchText|. |identifier| can be used to have multiple searches - // running simultaneously. |forward| indicates whether to search forward or + // running simultaniously. |forward| indicates whether to search forward or // backward within the page. |matchCase| indicates whether the search should // be case-sensitive. |findNext| indicates whether this is the first request - // or a follow-up. + // or a follow-up. The cef_find_handler_t instance, if any, returned via + // cef_client_t::GetFindHandler will be called to report find results. // pub fn find(&self, identifier: libc::c_int, searchText: &[u16], forward: libc::c_int, matchCase: libc::c_int, findNext: libc::c_int) -> ( @@ -1490,6 +1671,28 @@ impl CefBrowserHost { } } + // + // Retrieve a snapshot of current navigation entries as values sent to the + // specified visitor. If |current_only| is true (1) only the current + // navigation entry will be sent, otherwise all navigation entries will be + // sent. + // + // + pub fn get_navigation_entries(&self, + visitor: interfaces::CefNavigationEntryVisitor, + current_only: libc::c_int) -> () { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_navigation_entries.unwrap())( + self.c_object, + CefWrap::to_c(visitor), + CefWrap::to_c(current_only))) + } + } + // // Set whether mouse cursor change is disabled. // @@ -1888,7 +2091,7 @@ impl CefBrowserHost { // being cancelled. |x| and |y| are mouse coordinates relative to the upper- // left corner of the view. If the web view is both the drag source and the // drag target then all DragTarget* functions should be called before - // DragSource* methods. This function is only used when window rendering is + // DragSource* mthods. This function is only used when window rendering is // disabled. // pub fn drag_source_ended_at(&self, x: libc::c_int, y: libc::c_int, @@ -1911,7 +2114,7 @@ impl CefBrowserHost { // cef_render_handler_t::StartDragging call has completed. This function may // be called immediately without first calling DragSourceEndedAt to cancel a // drag operation. If the web view is both the drag source and the drag target - // then all DragTarget* functions should be called before DragSource* methods. + // then all DragTarget* functions should be called before DragSource* mthods. // This function is only used when window rendering is disabled. // pub fn drag_source_system_drag_ended(&self) -> () { diff --git a/ports/cef/interfaces/cef_browser_process_handler.rs b/ports/cef/interfaces/cef_browser_process_handler.rs index 66ba7a0635d..fe287c545a1 100644 --- a/ports/cef/interfaces/cef_browser_process_handler.rs +++ b/ports/cef/interfaces/cef_browser_process_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_callback.rs b/ports/cef/interfaces/cef_callback.rs index a4b8fe54a22..fdf78a191b6 100644 --- a/ports/cef/interfaces/cef_callback.rs +++ b/ports/cef/interfaces/cef_callback.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_client.rs b/ports/cef/interfaces/cef_client.rs index 3c75868c9b0..66f099a4d37 100644 --- a/ports/cef/interfaces/cef_client.rs +++ b/ports/cef/interfaces/cef_client.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -88,6 +88,12 @@ pub struct _cef_client_t { pub get_drag_handler: Option *mut interfaces::cef_drag_handler_t>, + // + // Return the handler for find result events. + // + pub get_find_handler: Option *mut interfaces::cef_find_handler_t>, + // // Return the handler for focus events. // @@ -301,6 +307,20 @@ impl CefClient { } } + // + // Return the handler for find result events. + // + pub fn get_find_handler(&self) -> interfaces::CefFindHandler { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_find_handler.unwrap())( + self.c_object)) + } + } + // // Return the handler for focus events. // diff --git a/ports/cef/interfaces/cef_command_line.rs b/ports/cef/interfaces/cef_command_line.rs index 1524296b6e1..f46d4f1044c 100644 --- a/ports/cef/interfaces/cef_command_line.rs +++ b/ports/cef/interfaces/cef_command_line.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_context_menu_handler.rs b/ports/cef/interfaces/cef_context_menu_handler.rs index a3863c491bf..3441b775be5 100644 --- a/ports/cef/interfaces/cef_context_menu_handler.rs +++ b/ports/cef/interfaces/cef_context_menu_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -274,7 +274,7 @@ impl CefWrap<*mut cef_context_menu_handler_t> for Option // -// Provides information about the context menu state. The methods of this +// Provides information about the context menu state. The ethods of this // structure can only be accessed on browser process the UI thread. // #[repr(C)] @@ -387,13 +387,6 @@ pub struct _cef_context_menu_params_t { pub get_misspelled_word: Option types::cef_string_userfree_t>, - // - // Returns the hash of the misspelled word, if any, that the context menu was - // invoked on. - // - pub get_misspelling_hash: Option libc::c_int>, - // // Returns true (1) if suggestions exist, false (0) otherwise. Fills in // |suggestions| from the spell check service for the misspelled word if there @@ -438,7 +431,7 @@ pub type cef_context_menu_params_t = _cef_context_menu_params_t; // -// Provides information about the context menu state. The methods of this +// Provides information about the context menu state. The ethods of this // structure can only be accessed on browser process the UI thread. // pub struct CefContextMenuParams { @@ -720,21 +713,6 @@ impl CefContextMenuParams { } } - // - // Returns the hash of the misspelled word, if any, that the context menu was - // invoked on. - // - pub fn get_misspelling_hash(&self) -> libc::c_int { - if self.c_object.is_null() { - panic!("called a CEF method on a null object") - } - unsafe { - CefWrap::to_rust( - ((*self.c_object).get_misspelling_hash.unwrap())( - self.c_object)) - } - } - // // Returns true (1) if suggestions exist, false (0) otherwise. Fills in // |suggestions| from the spell check service for the misspelled word if there diff --git a/ports/cef/interfaces/cef_cookie.rs b/ports/cef/interfaces/cef_cookie.rs index 4239c95c67e..38291a8b7c9 100644 --- a/ports/cef/interfaces/cef_cookie.rs +++ b/ports/cef/interfaces/cef_cookie.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -58,26 +58,28 @@ pub struct _cef_cookie_manager_t { // // Set the schemes supported by this manager. By default only "http" and - // "https" schemes are supported. Must be called before any cookies are - // accessed. + // "https" schemes are supported. If |callback| is non-NULL it will be + // executed asnychronously on the IO thread after the change has been applied. + // Must be called before any cookies are accessed. // pub set_supported_schemes: Option ( - )>, + this: *mut cef_cookie_manager_t, schemes: types::cef_string_list_t, + callback: *mut interfaces::cef_completion_callback_t) -> ()>, // - // Visit all cookies. The returned cookies are ordered by longest path, then - // by earliest creation date. Returns false (0) if cookies cannot be accessed. + // Visit all cookies on the IO thread. The returned cookies are ordered by + // longest path, then by earliest creation date. Returns false (0) if cookies + // cannot be accessed. // pub visit_all_cookies: Option libc::c_int>, // - // Visit a subset of cookies. The results are filtered by the given url - // scheme, host, domain and path. If |includeHttpOnly| is true (1) HTTP-only - // cookies will also be included in the results. The returned cookies are - // ordered by longest path, then by earliest creation date. Returns false (0) - // if cookies cannot be accessed. + // Visit a subset of cookies on the IO thread. The results are filtered by the + // given url scheme, host, domain and path. If |includeHttpOnly| is true (1) + // HTTP-only cookies will also be included in the results. The returned + // cookies are ordered by longest path, then by earliest creation date. + // Returns false (0) if cookies cannot be accessed. // pub visit_url_cookies: Option libc::c_int>, + url: *const types::cef_string_t, cookie: *const interfaces::cef_cookie_t, + callback: *mut interfaces::cef_set_cookie_callback_t) -> libc::c_int>, // // Delete all cookies that match the specified parameters. If both |url| and - // values |cookie_name| are specified all host and domain cookies matching + // |cookie_name| values are specified all host and domain cookies matching // both will be deleted. If only |url| is specified all host cookies (but not // domain cookies) irrespective of path will be deleted. If |url| is NULL all - // cookies for all hosts and domains will be deleted. Returns false (0) if a - // non- NULL invalid URL is specified or if cookies cannot be accessed. This - // function must be called on the IO thread. + // cookies for all hosts and domains will be deleted. If |callback| is non- + // NULL it will be executed asnychronously on the IO thread after the cookies + // have been deleted. Returns false (0) if a non-NULL invalid URL is specified + // or if cookies cannot be accessed. Cookies can alternately be deleted using + // the Visit*Cookies() functions. // pub delete_cookies: Option libc::c_int>, + url: *const types::cef_string_t, cookie_name: *const types::cef_string_t, + callback: *mut interfaces::cef_delete_cookies_callback_t) -> libc::c_int>, // // Sets the directory path that will be used for storing cookie data. If @@ -114,17 +119,18 @@ pub struct _cef_cookie_manager_t { // stored at the specified |path|. To persist session cookies (cookies without // an expiry date or validity interval) set |persist_session_cookies| to true // (1). Session cookies are generally intended to be transient and most Web - // browsers do not persist them. Returns false (0) if cookies cannot be - // accessed. + // browsers do not persist them. If |callback| is non-NULL it will be executed + // asnychronously on the IO thread after the manager's storage has been + // initialized. Returns false (0) if cookies cannot be accessed. // pub set_storage_path: Option libc::c_int>, + path: *const types::cef_string_t, persist_session_cookies: libc::c_int, + callback: *mut interfaces::cef_completion_callback_t) -> libc::c_int>, // - // Flush the backing store (if any) to disk and execute the specified - // |callback| on the IO thread when done. Returns false (0) if cookies cannot - // be accessed. + // Flush the backing store (if any) to disk. If |callback| is non-NULL it will + // be executed asnychronously on the IO thread after the flush is complete. + // Returns false (0) if cookies cannot be accessed. // pub flush_store: Option libc::c_int>, @@ -212,10 +218,12 @@ impl CefCookieManager { // // Set the schemes supported by this manager. By default only "http" and - // "https" schemes are supported. Must be called before any cookies are - // accessed. + // "https" schemes are supported. If |callback| is non-NULL it will be + // 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() { panic!("called a CEF method on a null object") } @@ -223,13 +231,15 @@ impl CefCookieManager { CefWrap::to_rust( ((*self.c_object).set_supported_schemes.unwrap())( self.c_object, - CefWrap::to_c(schemes))) + CefWrap::to_c(schemes), + CefWrap::to_c(callback))) } } // - // Visit all cookies. The returned cookies are ordered by longest path, then - // by earliest creation date. Returns false (0) if cookies cannot be accessed. + // Visit all cookies on the IO thread. The returned cookies are ordered by + // longest path, then by earliest creation date. Returns false (0) if cookies + // cannot be accessed. // pub fn visit_all_cookies(&self, visitor: interfaces::CefCookieVisitor) -> libc::c_int { @@ -245,11 +255,11 @@ impl CefCookieManager { } // - // Visit a subset of cookies. The results are filtered by the given url - // scheme, host, domain and path. If |includeHttpOnly| is true (1) HTTP-only - // cookies will also be included in the results. The returned cookies are - // ordered by longest path, then by earliest creation date. Returns false (0) - // if cookies cannot be accessed. + // Visit a subset of cookies on the IO thread. The results are filtered by the + // given url scheme, host, domain and path. If |includeHttpOnly| is true (1) + // HTTP-only cookies will also be included in the results. The returned + // cookies are ordered by longest path, then by earliest creation date. + // Returns false (0) if cookies cannot be accessed. // pub fn visit_url_cookies(&self, url: &[u16], includeHttpOnly: libc::c_int, visitor: interfaces::CefCookieVisitor) -> libc::c_int { @@ -270,12 +280,13 @@ impl CefCookieManager { // Sets a cookie given a valid URL and explicit user-provided cookie // attributes. This function expects each attribute to be well-formed. It will // check for disallowed characters (e.g. the ';' character is disallowed - // within the cookie value attribute) and will return false (0) without - // setting the cookie if such characters are found. This function must be - // called on the IO thread. + // within the cookie value attribute) and fail without setting the cookie if + // such characters are found. If |callback| is non-NULL it will be executed + // asnychronously on the IO thread after the cookie has been set. Returns + // false (0) if an invalid URL is specified or if cookies cannot be accessed. // - pub fn set_cookie(&self, url: &[u16], - cookie: &interfaces::CefCookie) -> libc::c_int { + pub fn set_cookie(&self, url: &[u16], cookie: &interfaces::CefCookie, + callback: interfaces::CefSetCookieCallback) -> libc::c_int { if self.c_object.is_null() { panic!("called a CEF method on a null object") } @@ -284,21 +295,24 @@ impl CefCookieManager { ((*self.c_object).set_cookie.unwrap())( self.c_object, CefWrap::to_c(url), - CefWrap::to_c(cookie))) + CefWrap::to_c(cookie), + CefWrap::to_c(callback))) } } // // Delete all cookies that match the specified parameters. If both |url| and - // values |cookie_name| are specified all host and domain cookies matching + // |cookie_name| values are specified all host and domain cookies matching // both will be deleted. If only |url| is specified all host cookies (but not // domain cookies) irrespective of path will be deleted. If |url| is NULL all - // cookies for all hosts and domains will be deleted. Returns false (0) if a - // non- NULL invalid URL is specified or if cookies cannot be accessed. This - // function must be called on the IO thread. + // cookies for all hosts and domains will be deleted. If |callback| is non- + // NULL it will be executed asnychronously on the IO thread after the cookies + // have been deleted. Returns false (0) if a non-NULL invalid URL is specified + // or if cookies cannot be accessed. Cookies can alternately be deleted using + // the Visit*Cookies() functions. // - pub fn delete_cookies(&self, url: &[u16], - cookie_name: &[u16]) -> libc::c_int { + pub fn delete_cookies(&self, url: &[u16], cookie_name: &[u16], + callback: interfaces::CefDeleteCookiesCallback) -> libc::c_int { if self.c_object.is_null() { panic!("called a CEF method on a null object") } @@ -307,7 +321,8 @@ impl CefCookieManager { ((*self.c_object).delete_cookies.unwrap())( self.c_object, CefWrap::to_c(url), - CefWrap::to_c(cookie_name))) + CefWrap::to_c(cookie_name), + CefWrap::to_c(callback))) } } @@ -317,11 +332,13 @@ impl CefCookieManager { // stored at the specified |path|. To persist session cookies (cookies without // an expiry date or validity interval) set |persist_session_cookies| to true // (1). Session cookies are generally intended to be transient and most Web - // browsers do not persist them. Returns false (0) if cookies cannot be - // accessed. + // browsers do not persist them. If |callback| is non-NULL it will be executed + // asnychronously on the IO thread after the manager's storage has been + // initialized. Returns false (0) if cookies cannot be accessed. // pub fn set_storage_path(&self, path: &[u16], - persist_session_cookies: libc::c_int) -> libc::c_int { + persist_session_cookies: libc::c_int, + callback: interfaces::CefCompletionCallback) -> libc::c_int { if self.c_object.is_null() { panic!("called a CEF method on a null object") } @@ -330,14 +347,15 @@ impl CefCookieManager { ((*self.c_object).set_storage_path.unwrap())( self.c_object, CefWrap::to_c(path), - CefWrap::to_c(persist_session_cookies))) + CefWrap::to_c(persist_session_cookies), + CefWrap::to_c(callback))) } } // - // Flush the backing store (if any) to disk and execute the specified - // |callback| on the IO thread when done. Returns false (0) if cookies cannot - // be accessed. + // Flush the backing store (if any) to disk. If |callback| is non-NULL it will + // be executed asnychronously on the IO thread after the flush is complete. + // Returns false (0) if cookies cannot be accessed. // pub fn flush_store(&self, callback: interfaces::CefCompletionCallback) -> libc::c_int { @@ -354,13 +372,18 @@ impl CefCookieManager { // // Returns the global cookie manager. By default data will be stored at - // CefSettings.cache_path if specified or in memory otherwise. + // CefSettings.cache_path if specified or in memory otherwise. If |callback| + // is non-NULL it will be executed asnychronously on the IO thread after the + // manager's storage has been initialized. Using this function is equivalent + // to calling cef_request_tContext::cef_request_context_get_global_context()-> + // get_default_cookie_manager(). // - pub fn get_global_manager() -> interfaces::CefCookieManager { + pub fn get_global_manager( + callback: interfaces::CefCompletionCallback) -> interfaces::CefCookieManager { unsafe { CefWrap::to_rust( ::cookie::cef_cookie_manager_get_global_manager( -)) + CefWrap::to_c(callback))) } } @@ -370,15 +393,17 @@ impl CefCookieManager { // persist session cookies (cookies without an expiry date or validity // interval) set |persist_session_cookies| to true (1). Session cookies are // generally intended to be transient and most Web browsers do not persist - // them. Returns NULL if creation fails. + // them. If |callback| is non-NULL it will be executed asnychronously on the + // IO thread after the manager's storage has been initialized. // - pub fn create_manager(path: &[u16], - persist_session_cookies: libc::c_int) -> interfaces::CefCookieManager { + pub fn create_manager(path: &[u16], persist_session_cookies: libc::c_int, + callback: interfaces::CefCompletionCallback) -> interfaces::CefCookieManager { unsafe { CefWrap::to_rust( ::cookie::cef_cookie_manager_create_manager( CefWrap::to_c(path), - CefWrap::to_c(persist_session_cookies))) + CefWrap::to_c(persist_session_cookies), + CefWrap::to_c(callback))) } } } @@ -559,3 +584,286 @@ impl CefWrap<*mut cef_cookie_visitor_t> for Option { } } + +// +// Structure to implement to be notified of asynchronous completion via +// cef_cookie_manager_t::set_cookie(). +// +#[repr(C)] +pub struct _cef_set_cookie_callback_t { + // + // Base structure. + // + pub base: types::cef_base_t, + + // + // Method that will be called upon completion. |success| will be true (1) if + // the cookie was set successfully. + // + pub on_complete: Option ()>, + + // + // The reference count. This will only be present for Rust instances! + // + pub ref_count: usize, + + // + // Extra data. This will only be present for Rust instances! + // + pub extra: u8, +} + +pub type cef_set_cookie_callback_t = _cef_set_cookie_callback_t; + + +// +// Structure to implement to be notified of asynchronous completion via +// cef_cookie_manager_t::set_cookie(). +// +pub struct CefSetCookieCallback { + c_object: *mut cef_set_cookie_callback_t, +} + +impl Clone for CefSetCookieCallback { + fn clone(&self) -> CefSetCookieCallback{ + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base); + } + CefSetCookieCallback { + c_object: self.c_object, + } + } + } +} + +impl Drop for CefSetCookieCallback { + fn drop(&mut self) { + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base); + } + } + } +} + +impl CefSetCookieCallback { + pub unsafe fn from_c_object(c_object: *mut cef_set_cookie_callback_t) -> CefSetCookieCallback { + CefSetCookieCallback { + c_object: c_object, + } + } + + pub unsafe fn from_c_object_addref(c_object: *mut cef_set_cookie_callback_t) -> CefSetCookieCallback { + if !c_object.is_null() { + ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base); + } + CefSetCookieCallback { + c_object: c_object, + } + } + + pub fn c_object(&self) -> *mut cef_set_cookie_callback_t { + self.c_object + } + + pub fn c_object_addrefed(&self) -> *mut cef_set_cookie_callback_t { + unsafe { + if !self.c_object.is_null() { + eutil::add_ref(self.c_object as *mut types::cef_base_t); + } + self.c_object + } + } + + pub fn is_null_cef_object(&self) -> bool { + self.c_object.is_null() + } + pub fn is_not_null_cef_object(&self) -> bool { + !self.c_object.is_null() + } + + // + // Method that will be called upon completion. |success| will be true (1) if + // the cookie was set successfully. + // + pub fn on_complete(&self, success: libc::c_int) -> () { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).on_complete.unwrap())( + self.c_object, + CefWrap::to_c(success))) + } + } +} + +impl CefWrap<*mut cef_set_cookie_callback_t> for CefSetCookieCallback { + fn to_c(rust_object: CefSetCookieCallback) -> *mut cef_set_cookie_callback_t { + rust_object.c_object_addrefed() + } + unsafe fn to_rust(c_object: *mut cef_set_cookie_callback_t) -> CefSetCookieCallback { + CefSetCookieCallback::from_c_object_addref(c_object) + } +} +impl CefWrap<*mut cef_set_cookie_callback_t> for Option { + fn to_c(rust_object: Option) -> *mut cef_set_cookie_callback_t { + match rust_object { + None => ptr::null_mut(), + Some(rust_object) => rust_object.c_object_addrefed(), + } + } + unsafe fn to_rust(c_object: *mut cef_set_cookie_callback_t) -> Option { + if c_object.is_null() { + None + } else { + Some(CefSetCookieCallback::from_c_object_addref(c_object)) + } + } +} + + +// +// Structure to implement to be notified of asynchronous completion via +// cef_cookie_manager_t::delete_cookies(). +// +#[repr(C)] +pub struct _cef_delete_cookies_callback_t { + // + // Base structure. + // + pub base: types::cef_base_t, + + // + // Method that will be called upon completion. |num_deleted| will be the + // number of cookies that were deleted or -1 if unknown. + // + pub on_complete: Option ( + )>, + + // + // The reference count. This will only be present for Rust instances! + // + pub ref_count: usize, + + // + // Extra data. This will only be present for Rust instances! + // + pub extra: u8, +} + +pub type cef_delete_cookies_callback_t = _cef_delete_cookies_callback_t; + + +// +// Structure to implement to be notified of asynchronous completion via +// cef_cookie_manager_t::delete_cookies(). +// +pub struct CefDeleteCookiesCallback { + c_object: *mut cef_delete_cookies_callback_t, +} + +impl Clone for CefDeleteCookiesCallback { + fn clone(&self) -> CefDeleteCookiesCallback{ + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base); + } + CefDeleteCookiesCallback { + c_object: self.c_object, + } + } + } +} + +impl Drop for CefDeleteCookiesCallback { + fn drop(&mut self) { + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base); + } + } + } +} + +impl CefDeleteCookiesCallback { + pub unsafe fn from_c_object(c_object: *mut cef_delete_cookies_callback_t) -> CefDeleteCookiesCallback { + CefDeleteCookiesCallback { + c_object: c_object, + } + } + + pub unsafe fn from_c_object_addref(c_object: *mut cef_delete_cookies_callback_t) -> CefDeleteCookiesCallback { + if !c_object.is_null() { + ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base); + } + CefDeleteCookiesCallback { + c_object: c_object, + } + } + + pub fn c_object(&self) -> *mut cef_delete_cookies_callback_t { + self.c_object + } + + pub fn c_object_addrefed(&self) -> *mut cef_delete_cookies_callback_t { + unsafe { + if !self.c_object.is_null() { + eutil::add_ref(self.c_object as *mut types::cef_base_t); + } + self.c_object + } + } + + pub fn is_null_cef_object(&self) -> bool { + self.c_object.is_null() + } + pub fn is_not_null_cef_object(&self) -> bool { + !self.c_object.is_null() + } + + // + // Method that will be called upon completion. |num_deleted| will be the + // number of cookies that were deleted or -1 if unknown. + // + pub fn on_complete(&self, num_deleted: libc::c_int) -> () { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).on_complete.unwrap())( + self.c_object, + CefWrap::to_c(num_deleted))) + } + } +} + +impl CefWrap<*mut cef_delete_cookies_callback_t> for CefDeleteCookiesCallback { + fn to_c(rust_object: CefDeleteCookiesCallback) -> *mut cef_delete_cookies_callback_t { + rust_object.c_object_addrefed() + } + unsafe fn to_rust(c_object: *mut cef_delete_cookies_callback_t) -> CefDeleteCookiesCallback { + CefDeleteCookiesCallback::from_c_object_addref(c_object) + } +} +impl CefWrap<*mut cef_delete_cookies_callback_t> for Option { + fn to_c(rust_object: Option) -> *mut cef_delete_cookies_callback_t { + match rust_object { + None => ptr::null_mut(), + Some(rust_object) => rust_object.c_object_addrefed(), + } + } + unsafe fn to_rust(c_object: *mut cef_delete_cookies_callback_t) -> Option { + if c_object.is_null() { + None + } else { + Some(CefDeleteCookiesCallback::from_c_object_addref(c_object)) + } + } +} + diff --git a/ports/cef/interfaces/cef_dialog_handler.rs b/ports/cef/interfaces/cef_dialog_handler.rs index 029ecf9c3a0..d6db8bfd7f6 100644 --- a/ports/cef/interfaces/cef_dialog_handler.rs +++ b/ports/cef/interfaces/cef_dialog_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -56,11 +56,14 @@ pub struct _cef_file_dialog_callback_t { pub base: types::cef_base_t, // - // Continue the file selection with the specified |file_paths|. This may be a - // single value or a list of values depending on the dialog mode. An NULL + // Continue the file selection. |selected_accept_filter| should be the 0-based + // index of the value selected from the accept filters array passed to + // cef_dialog_handler_t::OnFileDialog. |file_paths| should be a single value + // or a list of values depending on the dialog mode. An NULL |file_paths| // value is treated the same as calling cancel(). // pub cont: Option ()>, // @@ -150,11 +153,14 @@ impl CefFileDialogCallback { } // - // Continue the file selection with the specified |file_paths|. This may be a - // single value or a list of values depending on the dialog mode. An NULL + // Continue the file selection. |selected_accept_filter| should be the 0-based + // index of the value selected from the accept filters array passed to + // cef_dialog_handler_t::OnFileDialog. |file_paths| should be a single value + // or a list of values depending on the dialog mode. An NULL |file_paths| // value is treated the same as calling cancel(). // - pub fn cont(&self, file_paths: Vec) -> () { + pub fn cont(&self, selected_accept_filter: libc::c_int, + file_paths: Vec) -> () { if self.c_object.is_null() { panic!("called a CEF method on a null object") } @@ -162,6 +168,7 @@ impl CefFileDialogCallback { CefWrap::to_rust( ((*self.c_object).cont.unwrap())( self.c_object, + CefWrap::to_c(selected_accept_filter), CefWrap::to_c(file_paths))) } } @@ -221,18 +228,23 @@ pub struct _cef_dialog_handler_t { // Called to run a file chooser dialog. |mode| represents the type of dialog // to display. |title| to the title to be used for the dialog and may be NULL // to show the default title ("Open" or "Save" depending on the mode). - // |default_file_name| is the default file name to select in the dialog. - // |accept_types| is a list of valid lower-cased MIME types or file extensions - // specified in an input element and is used to restrict selectable files to - // such types. To display a custom dialog return true (1) and execute - // |callback| either inline or at a later time. To display the default dialog - // return false (0). + // |default_file_path| is the path with optional directory and/or file name + // component that should be initially selected in the dialog. |accept_filters| + // are used to restrict the selectable file types and may any combination of + // (a) valid lower-cased MIME types (e.g. "text/*" or "image/*"), (b) + // individual file extensions (e.g. ".txt" or ".png"), or (c) combined + // description and file extension delimited using "|" and ";" (e.g. "Image + // Types|.png;.gif;.jpg"). |selected_accept_filter| is the 0-based index of + // the filter that should be selected by default. To display a custom dialog + // return true (1) and execute |callback| either inline or at a later time. To + // display the default dialog return false (0). // pub on_file_dialog: Option libc::c_int>, // @@ -320,16 +332,21 @@ impl CefDialogHandler { // Called to run a file chooser dialog. |mode| represents the type of dialog // to display. |title| to the title to be used for the dialog and may be NULL // to show the default title ("Open" or "Save" depending on the mode). - // |default_file_name| is the default file name to select in the dialog. - // |accept_types| is a list of valid lower-cased MIME types or file extensions - // specified in an input element and is used to restrict selectable files to - // such types. To display a custom dialog return true (1) and execute - // |callback| either inline or at a later time. To display the default dialog - // return false (0). + // |default_file_path| is the path with optional directory and/or file name + // component that should be initially selected in the dialog. |accept_filters| + // are used to restrict the selectable file types and may any combination of + // (a) valid lower-cased MIME types (e.g. "text/*" or "image/*"), (b) + // individual file extensions (e.g. ".txt" or ".png"), or (c) combined + // description and file extension delimited using "|" and ";" (e.g. "Image + // Types|.png;.gif;.jpg"). |selected_accept_filter| is the 0-based index of + // the filter that should be selected by default. To display a custom dialog + // return true (1) and execute |callback| either inline or at a later time. To + // display the default dialog return false (0). // pub fn on_file_dialog(&self, browser: interfaces::CefBrowser, mode: types::cef_file_dialog_mode_t, title: &[u16], - default_file_name: &[u16], accept_types: 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() { panic!("called a CEF method on a null object") @@ -341,8 +358,9 @@ impl CefDialogHandler { CefWrap::to_c(browser), CefWrap::to_c(mode), CefWrap::to_c(title), - CefWrap::to_c(default_file_name), - CefWrap::to_c(accept_types), + CefWrap::to_c(default_file_path), + CefWrap::to_c(accept_filters), + CefWrap::to_c(selected_accept_filter), CefWrap::to_c(callback))) } } diff --git a/ports/cef/interfaces/cef_display_handler.rs b/ports/cef/interfaces/cef_display_handler.rs index 4d90e2af6c0..6bfc68d1ca4 100644 --- a/ports/cef/interfaces/cef_display_handler.rs +++ b/ports/cef/interfaces/cef_display_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -71,6 +71,13 @@ pub struct _cef_display_handler_t { browser: *mut interfaces::cef_browser_t, title: *const types::cef_string_t) -> ()>, + // + // Called when the page icon changes. + // + pub on_favicon_urlchange: Option ()>, + // // Called when the browser is about to display a tooltip. |text| contains the // text that will be displayed in the tooltip. To handle the display of the @@ -216,6 +223,23 @@ impl CefDisplayHandler { } } + // + // Called when the page icon changes. + // + pub fn on_favicon_urlchange(&self, browser: interfaces::CefBrowser, + icon_urls: Vec) -> () { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).on_favicon_urlchange.unwrap())( + self.c_object, + CefWrap::to_c(browser), + CefWrap::to_c(icon_urls))) + } + } + // // Called when the browser is about to display a tooltip. |text| contains the // text that will be displayed in the tooltip. To handle the display of the diff --git a/ports/cef/interfaces/cef_dom.rs b/ports/cef/interfaces/cef_dom.rs index fc053c3bcf9..c12fde98f47 100644 --- a/ports/cef/interfaces/cef_dom.rs +++ b/ports/cef/interfaces/cef_dom.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -252,24 +252,12 @@ pub struct _cef_domdocument_t { pub has_selection: Option libc::c_int>, - // - // Returns the selection start node. - // - pub get_selection_start_node: Option *mut interfaces::cef_domnode_t>, - // // Returns the selection offset within the start node. // pub get_selection_start_offset: Option libc::c_int>, - // - // Returns the selection end node. - // - pub get_selection_end_node: Option *mut interfaces::cef_domnode_t>, - // // Returns the selection offset within the end node. // @@ -500,20 +488,6 @@ impl CefDOMDocument { } } - // - // Returns the selection start node. - // - pub fn get_selection_start_node(&self) -> interfaces::CefDOMNode { - if self.c_object.is_null() { - panic!("called a CEF method on a null object") - } - unsafe { - CefWrap::to_rust( - ((*self.c_object).get_selection_start_node.unwrap())( - self.c_object)) - } - } - // // Returns the selection offset within the start node. // @@ -528,20 +502,6 @@ impl CefDOMDocument { } } - // - // Returns the selection end node. - // - pub fn get_selection_end_node(&self) -> interfaces::CefDOMNode { - if self.c_object.is_null() { - panic!("called a CEF method on a null object") - } - unsafe { - CefWrap::to_rust( - ((*self.c_object).get_selection_end_node.unwrap())( - self.c_object)) - } - } - // // Returns the selection offset within the end node. // diff --git a/ports/cef/interfaces/cef_download_handler.rs b/ports/cef/interfaces/cef_download_handler.rs index 0757dfaf728..8555f0435a4 100644 --- a/ports/cef/interfaces/cef_download_handler.rs +++ b/ports/cef/interfaces/cef_download_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -206,6 +206,18 @@ pub struct _cef_download_item_callback_t { pub cancel: Option ( )>, + // + // Call to pause the download. + // + pub pause: Option ( + )>, + + // + // Call to resume the download. + // + pub resume: Option ( + )>, + // // The reference count. This will only be present for Rust instances! // @@ -299,6 +311,34 @@ impl CefDownloadItemCallback { self.c_object)) } } + + // + // Call to pause the download. + // + pub fn pause(&self) -> () { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).pause.unwrap())( + self.c_object)) + } + } + + // + // Call to resume the download. + // + pub fn resume(&self) -> () { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).resume.unwrap())( + self.c_object)) + } + } } impl CefWrap<*mut cef_download_item_callback_t> for CefDownloadItemCallback { diff --git a/ports/cef/interfaces/cef_download_item.rs b/ports/cef/interfaces/cef_download_item.rs index 9fca3943284..55513327f74 100644 --- a/ports/cef/interfaces/cef_download_item.rs +++ b/ports/cef/interfaces/cef_download_item.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -136,6 +136,13 @@ pub struct _cef_download_item_t { pub get_url: Option types::cef_string_userfree_t>, + // + // Returns the original URL before any redirections. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub get_original_url: Option types::cef_string_userfree_t>, + // // Returns the suggested file name. // @@ -423,6 +430,21 @@ impl CefDownloadItem { } } + // + // Returns the original URL before any redirections. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub fn get_original_url(&self) -> String { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_original_url.unwrap())( + self.c_object)) + } + } + // // Returns the suggested file name. // diff --git a/ports/cef/interfaces/cef_drag_data.rs b/ports/cef/interfaces/cef_drag_data.rs index 599727db6dd..5983a7a7098 100644 --- a/ports/cef/interfaces/cef_drag_data.rs +++ b/ports/cef/interfaces/cef_drag_data.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_drag_handler.rs b/ports/cef/interfaces/cef_drag_handler.rs index 38dae28fefa..6236a11056b 100644 --- a/ports/cef/interfaces/cef_drag_handler.rs +++ b/ports/cef/interfaces/cef_drag_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_find_handler.rs b/ports/cef/interfaces/cef_find_handler.rs new file mode 100644 index 00000000000..b1afd79ff11 --- /dev/null +++ b/ports/cef/interfaces/cef_find_handler.rs @@ -0,0 +1,205 @@ +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not be edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#![allow(non_snake_case, unused_imports)] + +use eutil; +use interfaces; +use types; +use wrappers::CefWrap; + +use libc; +use std::collections::HashMap; +use std::ptr; + +// +// Implement this structure to handle events related to find results. The +// functions of this structure will be called on the UI thread. +// +#[repr(C)] +pub struct _cef_find_handler_t { + // + // Base structure. + // + pub base: types::cef_base_t, + + // + // Called to report find results returned by cef_browser_host_t::find(). + // |identifer| is the identifier passed to find(), |count| is the number of + // matches currently identified, |selectionRect| is the location of where the + // match was found (in window coordinates), |activeMatchOrdinal| is the + // current position in the search results, and |finalUpdate| is true (1) if + // this is the last find notification. + // + pub on_find_result: Option ()>, + + // + // The reference count. This will only be present for Rust instances! + // + pub ref_count: usize, + + // + // Extra data. This will only be present for Rust instances! + // + pub extra: u8, +} + +pub type cef_find_handler_t = _cef_find_handler_t; + + +// +// Implement this structure to handle events related to find results. The +// functions of this structure will be called on the UI thread. +// +pub struct CefFindHandler { + c_object: *mut cef_find_handler_t, +} + +impl Clone for CefFindHandler { + fn clone(&self) -> CefFindHandler{ + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base); + } + CefFindHandler { + c_object: self.c_object, + } + } + } +} + +impl Drop for CefFindHandler { + fn drop(&mut self) { + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base); + } + } + } +} + +impl CefFindHandler { + pub unsafe fn from_c_object(c_object: *mut cef_find_handler_t) -> CefFindHandler { + CefFindHandler { + c_object: c_object, + } + } + + pub unsafe fn from_c_object_addref(c_object: *mut cef_find_handler_t) -> CefFindHandler { + if !c_object.is_null() { + ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base); + } + CefFindHandler { + c_object: c_object, + } + } + + pub fn c_object(&self) -> *mut cef_find_handler_t { + self.c_object + } + + pub fn c_object_addrefed(&self) -> *mut cef_find_handler_t { + unsafe { + if !self.c_object.is_null() { + eutil::add_ref(self.c_object as *mut types::cef_base_t); + } + self.c_object + } + } + + pub fn is_null_cef_object(&self) -> bool { + self.c_object.is_null() + } + pub fn is_not_null_cef_object(&self) -> bool { + !self.c_object.is_null() + } + + // + // Called to report find results returned by cef_browser_host_t::find(). + // |identifer| is the identifier passed to find(), |count| is the number of + // matches currently identified, |selectionRect| is the location of where the + // match was found (in window coordinates), |activeMatchOrdinal| is the + // current position in the search results, and |finalUpdate| is true (1) if + // this is the last find notification. + // + pub fn on_find_result(&self, browser: interfaces::CefBrowser, + identifier: libc::c_int, count: libc::c_int, + selectionRect: &types::cef_rect_t, activeMatchOrdinal: libc::c_int, + finalUpdate: libc::c_int) -> () { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).on_find_result.unwrap())( + self.c_object, + CefWrap::to_c(browser), + CefWrap::to_c(identifier), + CefWrap::to_c(count), + CefWrap::to_c(selectionRect), + CefWrap::to_c(activeMatchOrdinal), + CefWrap::to_c(finalUpdate))) + } + } +} + +impl CefWrap<*mut cef_find_handler_t> for CefFindHandler { + fn to_c(rust_object: CefFindHandler) -> *mut cef_find_handler_t { + rust_object.c_object_addrefed() + } + unsafe fn to_rust(c_object: *mut cef_find_handler_t) -> CefFindHandler { + CefFindHandler::from_c_object_addref(c_object) + } +} +impl CefWrap<*mut cef_find_handler_t> for Option { + fn to_c(rust_object: Option) -> *mut cef_find_handler_t { + match rust_object { + None => ptr::null_mut(), + Some(rust_object) => rust_object.c_object_addrefed(), + } + } + unsafe fn to_rust(c_object: *mut cef_find_handler_t) -> Option { + if c_object.is_null() { + None + } else { + Some(CefFindHandler::from_c_object_addref(c_object)) + } + } +} + diff --git a/ports/cef/interfaces/cef_focus_handler.rs b/ports/cef/interfaces/cef_focus_handler.rs index 5314ded7237..6695253dbb4 100644 --- a/ports/cef/interfaces/cef_focus_handler.rs +++ b/ports/cef/interfaces/cef_focus_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_frame.rs b/ports/cef/interfaces/cef_frame.rs index f22a8b68257..0ba77018d20 100644 --- a/ports/cef/interfaces/cef_frame.rs +++ b/ports/cef/interfaces/cef_frame.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_geolocation.rs b/ports/cef/interfaces/cef_geolocation.rs index a2a07a3b862..8ef1072a103 100644 --- a/ports/cef/interfaces/cef_geolocation.rs +++ b/ports/cef/interfaces/cef_geolocation.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_geolocation_handler.rs b/ports/cef/interfaces/cef_geolocation_handler.rs index 5e98e92e8b0..a342fd274ac 100644 --- a/ports/cef/interfaces/cef_geolocation_handler.rs +++ b/ports/cef/interfaces/cef_geolocation_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_jsdialog_handler.rs b/ports/cef/interfaces/cef_jsdialog_handler.rs index 4c03c07f5a3..6519ca2302b 100644 --- a/ports/cef/interfaces/cef_jsdialog_handler.rs +++ b/ports/cef/interfaces/cef_jsdialog_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_keyboard_handler.rs b/ports/cef/interfaces/cef_keyboard_handler.rs index dc347e9dd37..898afec3832 100644 --- a/ports/cef/interfaces/cef_keyboard_handler.rs +++ b/ports/cef/interfaces/cef_keyboard_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_life_span_handler.rs b/ports/cef/interfaces/cef_life_span_handler.rs index 106ce028ae9..92b19e06415 100644 --- a/ports/cef/interfaces/cef_life_span_handler.rs +++ b/ports/cef/interfaces/cef_life_span_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -58,22 +58,29 @@ pub struct _cef_life_span_handler_t { pub base: types::cef_base_t, // - // Called on the IO thread before a new popup window is created. The |browser| - // and |frame| parameters represent the source of the popup request. The - // |target_url| and |target_frame_name| values may be NULL if none were - // specified with the request. The |popupFeatures| structure contains - // information about the requested popup window. To allow creation of the - // popup window optionally modify |windowInfo|, |client|, |settings| and - // |no_javascript_access| and return false (0). To cancel creation of the - // popup window return true (1). The |client| and |settings| values will - // default to the source browser's values. The |no_javascript_access| value - // indicates whether the new browser window should be scriptable and in the - // same process as the source browser. + // Called on the IO thread before a new popup browser is created. The + // |browser| and |frame| values represent the source of the popup request. The + // |target_url| and |target_frame_name| values indicate where the popup + // browser should navigate and may be NULL if not specified with the request. + // The |target_disposition| value indicates where the user intended to open + // the popup (e.g. current tab, new tab, etc). The |user_gesture| value will + // be true (1) if the popup was opened via explicit user gesture (e.g. + // clicking a link) or false (0) if the popup opened automatically (e.g. via + // the DomContentLoaded event). The |popupFeatures| structure contains + // additional information about the requested popup window. To allow creation + // of the popup browser optionally modify |windowInfo|, |client|, |settings| + // and |no_javascript_access| and return false (0). To cancel creation of the + // popup browser return true (1). The |client| and |settings| values will + // default to the source browser's values. If the |no_javascript_access| value + // is set to false (0) the new browser will not be scriptable and may not be + // hosted in the same renderer process as the source browser. pub on_before_popup: Option libc::c_int>, // - // Called when a browser has received a request to close. This may result + // Called when a browser has recieved a request to close. This may result // directly from a call to cef_browser_host_t::close_browser() or indirectly // if the browser is a top-level OS window created by CEF and the user // attempts to close the window. This function will be called after the @@ -248,20 +255,27 @@ impl CefLifeSpanHandler { } // - // Called on the IO thread before a new popup window is created. The |browser| - // and |frame| parameters represent the source of the popup request. The - // |target_url| and |target_frame_name| values may be NULL if none were - // specified with the request. The |popupFeatures| structure contains - // information about the requested popup window. To allow creation of the - // popup window optionally modify |windowInfo|, |client|, |settings| and - // |no_javascript_access| and return false (0). To cancel creation of the - // popup window return true (1). The |client| and |settings| values will - // default to the source browser's values. The |no_javascript_access| value - // indicates whether the new browser window should be scriptable and in the - // same process as the source browser. + // Called on the IO thread before a new popup browser is created. The + // |browser| and |frame| values represent the source of the popup request. The + // |target_url| and |target_frame_name| values indicate where the popup + // browser should navigate and may be NULL if not specified with the request. + // The |target_disposition| value indicates where the user intended to open + // the popup (e.g. current tab, new tab, etc). The |user_gesture| value will + // be true (1) if the popup was opened via explicit user gesture (e.g. + // clicking a link) or false (0) if the popup opened automatically (e.g. via + // the DomContentLoaded event). The |popupFeatures| structure contains + // additional information about the requested popup window. To allow creation + // of the popup browser optionally modify |windowInfo|, |client|, |settings| + // and |no_javascript_access| and return false (0). To cancel creation of the + // popup browser return true (1). The |client| and |settings| values will + // default to the source browser's values. If the |no_javascript_access| value + // is set to false (0) the new browser will not be scriptable and may not be + // hosted in the same renderer process as the source browser. pub fn on_before_popup(&self, browser: interfaces::CefBrowser, frame: interfaces::CefFrame, target_url: &[u16], - target_frame_name: &[u16], popupFeatures: &interfaces::CefPopupFeatures, + target_frame_name: &[u16], + target_disposition: types::cef_window_open_disposition_t, + user_gesture: libc::c_int, popupFeatures: &interfaces::CefPopupFeatures, windowInfo: &mut interfaces::CefWindowInfo, client: interfaces::CefClient, settings: &mut interfaces::CefBrowserSettings, @@ -277,6 +291,8 @@ impl CefLifeSpanHandler { CefWrap::to_c(frame), CefWrap::to_c(target_url), CefWrap::to_c(target_frame_name), + CefWrap::to_c(target_disposition), + CefWrap::to_c(user_gesture), CefWrap::to_c(popupFeatures), CefWrap::to_c(windowInfo), CefWrap::to_c(client), @@ -318,7 +334,7 @@ impl CefLifeSpanHandler { } // - // Called when a browser has received a request to close. This may result + // Called when a browser has recieved a request to close. This may result // directly from a call to cef_browser_host_t::close_browser() or indirectly // if the browser is a top-level OS window created by CEF and the user // attempts to close the window. This function will be called after the diff --git a/ports/cef/interfaces/cef_load_handler.rs b/ports/cef/interfaces/cef_load_handler.rs index e242dc23fa3..074e07f77f1 100644 --- a/ports/cef/interfaces/cef_load_handler.rs +++ b/ports/cef/interfaces/cef_load_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_menu_model.rs b/ports/cef/interfaces/cef_menu_model.rs index 6f3df5a486c..367137e04a7 100644 --- a/ports/cef/interfaces/cef_menu_model.rs +++ b/ports/cef/interfaces/cef_menu_model.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_navigation_entry.rs b/ports/cef/interfaces/cef_navigation_entry.rs new file mode 100644 index 00000000000..464f6139b29 --- /dev/null +++ b/ports/cef/interfaces/cef_navigation_entry.rs @@ -0,0 +1,388 @@ +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not be edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#![allow(non_snake_case, unused_imports)] + +use eutil; +use interfaces; +use types; +use wrappers::CefWrap; + +use libc; +use std::collections::HashMap; +use std::ptr; + +// +// Structure used to represent an entry in navigation history. +// +#[repr(C)] +pub struct _cef_navigation_entry_t { + // + // Base structure. + // + pub base: types::cef_base_t, + + // + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + // + pub is_valid: Option libc::c_int>, + + // + // Returns the actual URL of the page. For some pages this may be data: URL or + // similar. Use get_display_url() to return a display-friendly version. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub get_url: Option types::cef_string_userfree_t>, + + // + // Returns a display-friendly version of the URL. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub get_display_url: Option types::cef_string_userfree_t>, + + // + // Returns the original URL that was entered by the user before any redirects. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub get_original_url: Option types::cef_string_userfree_t>, + + // + // Returns the title set by the page. This value may be NULL. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub get_title: Option types::cef_string_userfree_t>, + + // + // Returns the transition type which indicates what the user did to move to + // this page from the previous page. + // + pub get_transition_type: Option types::cef_transition_type_t>, + + // + // Returns true (1) if this navigation includes post data. + // + pub has_post_data: Option libc::c_int>, + + // + // Returns the name of the sub-frame that navigated or an NULL value if the + // main frame navigated. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub get_frame_name: Option types::cef_string_userfree_t>, + + // + // Returns the time for the last known successful navigation completion. A + // navigation may be completed more than once if the page is reloaded. May be + // 0 if the navigation has not yet completed. + // + pub get_completion_time: Option types::cef_time_t>, + + // + // Returns the HTTP status code for the last known successful navigation + // response. May be 0 if the response has not yet been received or if the + // navigation has not yet completed. + // + pub get_http_status_code: Option libc::c_int>, + + // + // The reference count. This will only be present for Rust instances! + // + pub ref_count: usize, + + // + // Extra data. This will only be present for Rust instances! + // + pub extra: u8, +} + +pub type cef_navigation_entry_t = _cef_navigation_entry_t; + + +// +// Structure used to represent an entry in navigation history. +// +pub struct CefNavigationEntry { + c_object: *mut cef_navigation_entry_t, +} + +impl Clone for CefNavigationEntry { + fn clone(&self) -> CefNavigationEntry{ + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base); + } + CefNavigationEntry { + c_object: self.c_object, + } + } + } +} + +impl Drop for CefNavigationEntry { + fn drop(&mut self) { + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base); + } + } + } +} + +impl CefNavigationEntry { + pub unsafe fn from_c_object(c_object: *mut cef_navigation_entry_t) -> CefNavigationEntry { + CefNavigationEntry { + c_object: c_object, + } + } + + pub unsafe fn from_c_object_addref(c_object: *mut cef_navigation_entry_t) -> CefNavigationEntry { + if !c_object.is_null() { + ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base); + } + CefNavigationEntry { + c_object: c_object, + } + } + + pub fn c_object(&self) -> *mut cef_navigation_entry_t { + self.c_object + } + + pub fn c_object_addrefed(&self) -> *mut cef_navigation_entry_t { + unsafe { + if !self.c_object.is_null() { + eutil::add_ref(self.c_object as *mut types::cef_base_t); + } + self.c_object + } + } + + pub fn is_null_cef_object(&self) -> bool { + self.c_object.is_null() + } + pub fn is_not_null_cef_object(&self) -> bool { + !self.c_object.is_null() + } + + // + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + // + pub fn is_valid(&self) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).is_valid.unwrap())( + self.c_object)) + } + } + + // + // Returns the actual URL of the page. For some pages this may be data: URL or + // similar. Use get_display_url() to return a display-friendly version. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub fn get_url(&self) -> String { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_url.unwrap())( + self.c_object)) + } + } + + // + // Returns a display-friendly version of the URL. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub fn get_display_url(&self) -> String { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_display_url.unwrap())( + self.c_object)) + } + } + + // + // Returns the original URL that was entered by the user before any redirects. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub fn get_original_url(&self) -> String { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_original_url.unwrap())( + self.c_object)) + } + } + + // + // Returns the title set by the page. This value may be NULL. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub fn get_title(&self) -> String { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_title.unwrap())( + self.c_object)) + } + } + + // + // Returns the transition type which indicates what the user did to move to + // this page from the previous page. + // + pub fn get_transition_type(&self) -> types::cef_transition_type_t { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_transition_type.unwrap())( + self.c_object)) + } + } + + // + // Returns true (1) if this navigation includes post data. + // + pub fn has_post_data(&self) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).has_post_data.unwrap())( + self.c_object)) + } + } + + // + // Returns the name of the sub-frame that navigated or an NULL value if the + // main frame navigated. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub fn get_frame_name(&self) -> String { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_frame_name.unwrap())( + self.c_object)) + } + } + + // + // Returns the time for the last known successful navigation completion. A + // navigation may be completed more than once if the page is reloaded. May be + // 0 if the navigation has not yet completed. + // + pub fn get_completion_time(&self) -> types::cef_time_t { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_completion_time.unwrap())( + self.c_object)) + } + } + + // + // Returns the HTTP status code for the last known successful navigation + // response. May be 0 if the response has not yet been received or if the + // navigation has not yet completed. + // + pub fn get_http_status_code(&self) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_http_status_code.unwrap())( + self.c_object)) + } + } +} + +impl CefWrap<*mut cef_navigation_entry_t> for CefNavigationEntry { + fn to_c(rust_object: CefNavigationEntry) -> *mut cef_navigation_entry_t { + rust_object.c_object_addrefed() + } + unsafe fn to_rust(c_object: *mut cef_navigation_entry_t) -> CefNavigationEntry { + CefNavigationEntry::from_c_object_addref(c_object) + } +} +impl CefWrap<*mut cef_navigation_entry_t> for Option { + fn to_c(rust_object: Option) -> *mut cef_navigation_entry_t { + match rust_object { + None => ptr::null_mut(), + Some(rust_object) => rust_object.c_object_addrefed(), + } + } + unsafe fn to_rust(c_object: *mut cef_navigation_entry_t) -> Option { + if c_object.is_null() { + None + } else { + Some(CefNavigationEntry::from_c_object_addref(c_object)) + } + } +} + diff --git a/ports/cef/interfaces/cef_origin_whitelist.rs b/ports/cef/interfaces/cef_origin_whitelist.rs index c8622bc9cc9..061f2797a3e 100644 --- a/ports/cef/interfaces/cef_origin_whitelist.rs +++ b/ports/cef/interfaces/cef_origin_whitelist.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_parser.rs b/ports/cef/interfaces/cef_parser.rs new file mode 100644 index 00000000000..061f2797a3e --- /dev/null +++ b/ports/cef/interfaces/cef_parser.rs @@ -0,0 +1,46 @@ +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not be edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#![allow(non_snake_case, unused_imports)] + +use eutil; +use interfaces; +use types; +use wrappers::CefWrap; + +use libc; +use std::collections::HashMap; +use std::ptr; diff --git a/ports/cef/interfaces/cef_path_util.rs b/ports/cef/interfaces/cef_path_util.rs index c8622bc9cc9..061f2797a3e 100644 --- a/ports/cef/interfaces/cef_path_util.rs +++ b/ports/cef/interfaces/cef_path_util.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_print_handler.rs b/ports/cef/interfaces/cef_print_handler.rs index d5cabeae8df..c00717c88e0 100644 --- a/ports/cef/interfaces/cef_print_handler.rs +++ b/ports/cef/interfaces/cef_print_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_print_settings.rs b/ports/cef/interfaces/cef_print_settings.rs index 1a79e25bcc5..6af6381f506 100644 --- a/ports/cef/interfaces/cef_print_settings.rs +++ b/ports/cef/interfaces/cef_print_settings.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_process_message.rs b/ports/cef/interfaces/cef_process_message.rs index ef6d896f227..da6e840e78c 100644 --- a/ports/cef/interfaces/cef_process_message.rs +++ b/ports/cef/interfaces/cef_process_message.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_process_util.rs b/ports/cef/interfaces/cef_process_util.rs index c8622bc9cc9..061f2797a3e 100644 --- a/ports/cef/interfaces/cef_process_util.rs +++ b/ports/cef/interfaces/cef_process_util.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_render_handler.rs b/ports/cef/interfaces/cef_render_handler.rs index 9f982c90865..384a2b14b40 100644 --- a/ports/cef/interfaces/cef_render_handler.rs +++ b/ports/cef/interfaces/cef_render_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -103,18 +103,21 @@ pub struct _cef_render_handler_t { // // Called when the browser wants to move or resize the popup widget. |rect| - // contains the new location and size. + // contains the new location and size in view coordinates. // pub on_popup_size: Option ()>, // - // Called when an element should be painted. |type| indicates whether the - // element is the view or the popup widget. |buffer| contains the pixel data - // for the whole image. |dirtyRects| contains the set of rectangles that need - // to be repainted. On Windows |buffer| will be |width|*|height|*4 bytes in - // size and represents a BGRA image with an upper-left origin. + // Called when an element should be painted. Pixel values passed to this + // function are scaled relative to view coordinates based on the value of + // CefScreenInfo.device_scale_factor returned from GetScreenInfo. |type| + // indicates whether the element is the view or the popup widget. |buffer| + // contains the pixel data for the whole image. |dirtyRects| contains the set + // of rectangles in pixel coordinates that need to be repainted. |buffer| will + // be |width|*|height|*4 bytes in size and represents a BGRA image with an + // upper-left origin. // pub on_paint: Option ()>, // - // Called when the browser window's cursor has changed. + // Called when the browser's cursor has changed. If |type| is CT_CUSTOM then + // |custom_cursor_info| will be populated with the custom cursor information. // pub on_cursor_change: Option ()>, + cursor: types::cef_cursor_handle_t, ty: types::cef_cursor_type_t, + custom_cursor_info: *const interfaces::cef_cursor_info_t) -> ()>, // // Called when the user starts dragging content in the web view. Contextual - // information about the dragged content is supplied by |drag_data|. OS APIs - // that run a system message loop may be used within the StartDragging call. + // information about the dragged content is supplied by |drag_data|. (|x|, + // |y|) is the drag start location in screen coordinates. OS APIs that run a + // system message loop may be used within the StartDragging call. // // Return false (0) to abort the drag operation. Don't call any of // cef_browser_host_t::DragSource*Ended* functions after returning false (0). @@ -161,8 +167,8 @@ pub struct _cef_render_handler_t { // Called when the scroll offset has changed. // pub on_scroll_offset_changed: Option ()>, + this: *mut cef_render_handler_t, browser: *mut interfaces::cef_browser_t, + x: libc::c_double, y: libc::c_double) -> ()>, // // Called to retrieve the backing size of the view rectangle which is relative @@ -363,7 +369,7 @@ impl CefRenderHandler { // // Called when the browser wants to move or resize the popup widget. |rect| - // contains the new location and size. + // contains the new location and size in view coordinates. // pub fn on_popup_size(&self, browser: interfaces::CefBrowser, rect: &types::cef_rect_t) -> () { @@ -380,11 +386,14 @@ impl CefRenderHandler { } // - // Called when an element should be painted. |type| indicates whether the - // element is the view or the popup widget. |buffer| contains the pixel data - // for the whole image. |dirtyRects| contains the set of rectangles that need - // to be repainted. On Windows |buffer| will be |width|*|height|*4 bytes in - // size and represents a BGRA image with an upper-left origin. + // Called when an element should be painted. Pixel values passed to this + // function are scaled relative to view coordinates based on the value of + // CefScreenInfo.device_scale_factor returned from GetScreenInfo. |type| + // indicates whether the element is the view or the popup widget. |buffer| + // contains the pixel data for the whole image. |dirtyRects| contains the set + // of rectangles in pixel coordinates that need to be repainted. |buffer| will + // be |width|*|height|*4 bytes in size and represents a BGRA image with an + // upper-left origin. // pub fn on_paint(&self, browser: interfaces::CefBrowser, ty: types::cef_paint_element_type_t, dirtyRects_count: libc::size_t, @@ -408,10 +417,12 @@ impl CefRenderHandler { } // - // Called when the browser window's cursor has changed. + // Called when the browser's cursor has changed. If |type| is CT_CUSTOM then + // |custom_cursor_info| will be populated with the custom cursor information. // pub fn on_cursor_change(&self, browser: interfaces::CefBrowser, - cursor: types::cef_cursor_handle_t) -> () { + cursor: types::cef_cursor_handle_t, ty: types::cef_cursor_type_t, + custom_cursor_info: &interfaces::CefCursorInfo) -> () { if self.c_object.is_null() { panic!("called a CEF method on a null object") } @@ -420,14 +431,17 @@ impl CefRenderHandler { ((*self.c_object).on_cursor_change.unwrap())( self.c_object, CefWrap::to_c(browser), - CefWrap::to_c(cursor))) + CefWrap::to_c(cursor), + CefWrap::to_c(ty), + CefWrap::to_c(custom_cursor_info))) } } // // Called when the user starts dragging content in the web view. Contextual - // information about the dragged content is supplied by |drag_data|. OS APIs - // that run a system message loop may be used within the StartDragging call. + // information about the dragged content is supplied by |drag_data|. (|x|, + // |y|) is the drag start location in screen coordinates. OS APIs that run a + // system message loop may be used within the StartDragging call. // // Return false (0) to abort the drag operation. Don't call any of // cef_browser_host_t::DragSource*Ended* functions after returning false (0). @@ -478,8 +492,8 @@ impl CefRenderHandler { // // Called when the scroll offset has changed. // - pub fn on_scroll_offset_changed(&self, browser: interfaces::CefBrowser) -> ( - ) { + pub fn on_scroll_offset_changed(&self, browser: interfaces::CefBrowser, + x: libc::c_double, y: libc::c_double) -> () { if self.c_object.is_null() { panic!("called a CEF method on a null object") } @@ -487,7 +501,9 @@ impl CefRenderHandler { CefWrap::to_rust( ((*self.c_object).on_scroll_offset_changed.unwrap())( self.c_object, - CefWrap::to_c(browser))) + CefWrap::to_c(browser), + CefWrap::to_c(x), + CefWrap::to_c(y))) } } diff --git a/ports/cef/interfaces/cef_render_process_handler.rs b/ports/cef/interfaces/cef_render_process_handler.rs index da4a513371a..4c9bbc67dc6 100644 --- a/ports/cef/interfaces/cef_render_process_handler.rs +++ b/ports/cef/interfaces/cef_render_process_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_request.rs b/ports/cef/interfaces/cef_request.rs index 097065efa8d..574f59bb3db 100644 --- a/ports/cef/interfaces/cef_request.rs +++ b/ports/cef/interfaces/cef_request.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -164,6 +164,13 @@ pub struct _cef_request_t { pub get_transition_type: Option types::cef_transition_type_t>, + // + // Returns the globally unique identifier for this request or 0 if not + // specified. Can be used by cef_request_tHandler implementations in the + // browser process to track a single request across multiple callbacks. + // + pub get_identifier: Option u64>, + // // The reference count. This will only be present for Rust instances! // @@ -493,6 +500,22 @@ impl CefRequest { } } + // + // Returns the globally unique identifier for this request or 0 if not + // specified. Can be used by cef_request_tHandler implementations in the + // browser process to track a single request across multiple callbacks. + // + pub fn get_identifier(&self) -> u64 { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_identifier.unwrap())( + self.c_object)) + } + } + // // Create a new cef_request_t object. // diff --git a/ports/cef/interfaces/cef_request_context.rs b/ports/cef/interfaces/cef_request_context.rs index e5de378a71e..29bfa3a52c0 100644 --- a/ports/cef/interfaces/cef_request_context.rs +++ b/ports/cef/interfaces/cef_request_context.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -46,19 +46,20 @@ use std::collections::HashMap; use std::ptr; // -// A request context provides request handling for a set of related browser -// objects. A request context is specified when creating a new browser object -// via the cef_browser_host_t static factory functions. Browser objects with -// different request contexts will never be hosted in the same render process. -// Browser objects with the same request context may or may not be hosted in the -// same render process depending on the process model. Browser objects created -// indirectly via the JavaScript window.open function or targeted links will -// share the same render process and the same request context as the source -// browser. When running in single-process mode there is only a single render -// process (the main process) and so all browsers created in single-process mode -// will share the same request context. This will be the first request context -// passed into a cef_browser_host_t static factory function and all other -// request context objects will be ignored. +// A request context provides request handling for a set of related browser or +// URL request objects. A request context can be specified when creating a new +// browser via the cef_browser_host_t static factory functions or when creating +// a new URL request via the cef_urlrequest_t static factory functions. Browser +// objects with different request contexts will never be hosted in the same +// render process. Browser objects with the same request context may or may not +// be hosted in the same render process depending on the process model. Browser +// objects created indirectly via the JavaScript window.open function or +// targeted links will share the same render process and the same request +// context as the source browser. When running in single-process mode there is +// only a single render process (the main process) and so all browsers created +// in single-process mode will share the same request context. This will be the +// first request context passed into a cef_browser_host_t static factory +// function and all other request context objects will be ignored. // #[repr(C)] pub struct _cef_request_context_t { @@ -75,7 +76,16 @@ pub struct _cef_request_context_t { other: *mut interfaces::cef_request_context_t) -> libc::c_int>, // - // Returns true (1) if this object is the global context. + // Returns true (1) if this object is sharing the same storage as |that| + // object. + // + pub is_sharing_with: Option libc::c_int>, + + // + // Returns true (1) if this object is the global context. The global context + // is used by default when creating a browser or URL request with a NULL + // context argument. // pub is_global: Option libc::c_int>, @@ -86,6 +96,51 @@ pub struct _cef_request_context_t { pub get_handler: Option *mut interfaces::cef_request_context_handler_t>, + // + // Returns the cache path for this object. If NULL an "incognito mode" in- + // memory cache is being used. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub get_cache_path: Option types::cef_string_userfree_t>, + + // + // Returns the default cookie manager for this object. This will be the global + // cookie manager if this object is the global request context. Otherwise, + // this will be the default cookie manager used when this request context does + // not receive a value via cef_request_tContextHandler::get_cookie_manager(). + // If |callback| is non-NULL it will be executed asnychronously on the IO + // thread after the manager's storage has been initialized. + // + pub get_default_cookie_manager: Option *mut interfaces::cef_cookie_manager_t>, + + // + // Register a scheme handler factory for the specified |scheme_name| and + // optional |domain_name|. An NULL |domain_name| value for a standard scheme + // will cause the factory to match all domain names. The |domain_name| value + // will be ignored for non-standard schemes. If |scheme_name| is a built-in + // scheme and no handler is returned by |factory| then the built-in scheme + // handler factory will be called. If |scheme_name| is a custom scheme then + // you must also implement the cef_app_t::on_register_custom_schemes() + // function in all processes. This function may be called multiple times to + // change or remove the factory that matches the specified |scheme_name| and + // optional |domain_name|. Returns false (0) if an error occurs. This function + // may be called on any thread in the browser process. + // + pub register_scheme_handler_factory: Option libc::c_int>, + + // + // Clear all registered scheme handler factories. Returns false (0) on error. + // This function may be called on any thread in the browser process. + // + pub clear_scheme_handler_factories: Option libc::c_int>, + // // The reference count. This will only be present for Rust instances! // @@ -101,19 +156,20 @@ pub type cef_request_context_t = _cef_request_context_t; // -// A request context provides request handling for a set of related browser -// objects. A request context is specified when creating a new browser object -// via the cef_browser_host_t static factory functions. Browser objects with -// different request contexts will never be hosted in the same render process. -// Browser objects with the same request context may or may not be hosted in the -// same render process depending on the process model. Browser objects created -// indirectly via the JavaScript window.open function or targeted links will -// share the same render process and the same request context as the source -// browser. When running in single-process mode there is only a single render -// process (the main process) and so all browsers created in single-process mode -// will share the same request context. This will be the first request context -// passed into a cef_browser_host_t static factory function and all other -// request context objects will be ignored. +// A request context provides request handling for a set of related browser or +// URL request objects. A request context can be specified when creating a new +// browser via the cef_browser_host_t static factory functions or when creating +// a new URL request via the cef_urlrequest_t static factory functions. Browser +// objects with different request contexts will never be hosted in the same +// render process. Browser objects with the same request context may or may not +// be hosted in the same render process depending on the process model. Browser +// objects created indirectly via the JavaScript window.open function or +// targeted links will share the same render process and the same request +// context as the source browser. When running in single-process mode there is +// only a single render process (the main process) and so all browsers created +// in single-process mode will share the same request context. This will be the +// first request context passed into a cef_browser_host_t static factory +// function and all other request context objects will be ignored. // pub struct CefRequestContext { c_object: *mut cef_request_context_t, @@ -195,7 +251,26 @@ impl CefRequestContext { } // - // Returns true (1) if this object is the global context. + // Returns true (1) if this object is sharing the same storage as |that| + // object. + // + pub fn is_sharing_with(&self, + other: interfaces::CefRequestContext) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).is_sharing_with.unwrap())( + self.c_object, + CefWrap::to_c(other))) + } + } + + // + // Returns true (1) if this object is the global context. The global context + // is used by default when creating a browser or URL request with a NULL + // context argument. // pub fn is_global(&self) -> libc::c_int { if self.c_object.is_null() { @@ -222,6 +297,87 @@ impl CefRequestContext { } } + // + // Returns the cache path for this object. If NULL an "incognito mode" in- + // memory cache is being used. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub fn get_cache_path(&self) -> String { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_cache_path.unwrap())( + self.c_object)) + } + } + + // + // Returns the default cookie manager for this object. This will be the global + // cookie manager if this object is the global request context. Otherwise, + // this will be the default cookie manager used when this request context does + // not receive a value via cef_request_tContextHandler::get_cookie_manager(). + // If |callback| is non-NULL it will be executed asnychronously on the IO + // thread after the manager's storage has been initialized. + // + pub fn get_default_cookie_manager(&self, + callback: interfaces::CefCompletionCallback) -> interfaces::CefCookieManager { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_default_cookie_manager.unwrap())( + self.c_object, + CefWrap::to_c(callback))) + } + } + + // + // Register a scheme handler factory for the specified |scheme_name| and + // optional |domain_name|. An NULL |domain_name| value for a standard scheme + // will cause the factory to match all domain names. The |domain_name| value + // will be ignored for non-standard schemes. If |scheme_name| is a built-in + // scheme and no handler is returned by |factory| then the built-in scheme + // handler factory will be called. If |scheme_name| is a custom scheme then + // you must also implement the cef_app_t::on_register_custom_schemes() + // function in all processes. This function may be called multiple times to + // change or remove the factory that matches the specified |scheme_name| and + // optional |domain_name|. Returns false (0) if an error occurs. This function + // may be called on any thread in the browser process. + // + pub fn register_scheme_handler_factory(&self, scheme_name: &[u16], + domain_name: &[u16], + factory: interfaces::CefSchemeHandlerFactory) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).register_scheme_handler_factory.unwrap())( + self.c_object, + CefWrap::to_c(scheme_name), + CefWrap::to_c(domain_name), + CefWrap::to_c(factory))) + } + } + + // + // Clear all registered scheme handler factories. Returns false (0) on error. + // This function may be called on any thread in the browser process. + // + pub fn clear_scheme_handler_factories(&self) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).clear_scheme_handler_factories.unwrap())( + self.c_object)) + } + } + // // Returns the global context object. // @@ -234,13 +390,29 @@ impl CefRequestContext { } // - // Creates a new context object with the specified handler. + // Creates a new context object with the specified |settings| and optional + // |handler|. // - pub fn create_context( + pub fn create_context(settings: &interfaces::CefRequestContextSettings, handler: interfaces::CefRequestContextHandler) -> interfaces::CefRequestContext { unsafe { CefWrap::to_rust( ::request_context::cef_request_context_create_context( + CefWrap::to_c(settings), + CefWrap::to_c(handler))) + } + } + + // + // Creates a new context object that shares storage with |other| and uses an + // optional |handler|. + // + pub fn create_context_shared(other: interfaces::CefRequestContext, + handler: interfaces::CefRequestContextHandler) -> interfaces::CefRequestContext { + unsafe { + CefWrap::to_rust( + ::request_context::cef_request_context_create_context_shared( + CefWrap::to_c(other), CefWrap::to_c(handler))) } } diff --git a/ports/cef/interfaces/cef_request_context_handler.rs b/ports/cef/interfaces/cef_request_context_handler.rs index a331d984709..30a325bfe9d 100644 --- a/ports/cef/interfaces/cef_request_context_handler.rs +++ b/ports/cef/interfaces/cef_request_context_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -46,7 +46,9 @@ use std::collections::HashMap; use std::ptr; // -// Implement this structure to provide handler implementations. +// Implement this structure to provide handler implementations. The handler +// instance will not be released until all objects related to the context have +// been destroyed. // #[repr(C)] pub struct _cef_request_context_handler_t { @@ -56,8 +58,9 @@ pub struct _cef_request_context_handler_t { pub base: types::cef_base_t, // - // Called on the IO thread to retrieve the cookie manager. The global cookie - // manager will be used if this function returns NULL. + // Called on the IO thread to retrieve the cookie manager. If this function + // returns NULL the default cookie manager retrievable via + // cef_request_tContext::get_default_cookie_manager() will be used. // pub get_cookie_manager: Option *mut interfaces::cef_cookie_manager_t>, @@ -77,7 +80,9 @@ pub type cef_request_context_handler_t = _cef_request_context_handler_t; // -// Implement this structure to provide handler implementations. +// Implement this structure to provide handler implementations. The handler +// instance will not be released until all objects related to the context have +// been destroyed. // pub struct CefRequestContextHandler { c_object: *mut cef_request_context_handler_t, @@ -143,8 +148,9 @@ impl CefRequestContextHandler { } // - // Called on the IO thread to retrieve the cookie manager. The global cookie - // manager will be used if this function returns NULL. + // Called on the IO thread to retrieve the cookie manager. If this function + // returns NULL the default cookie manager retrievable via + // cef_request_tContext::get_default_cookie_manager() will be used. // pub fn get_cookie_manager(&self) -> interfaces::CefCookieManager { if self.c_object.is_null() { diff --git a/ports/cef/interfaces/cef_request_handler.rs b/ports/cef/interfaces/cef_request_handler.rs index b0aed69c0a7..c17a9015181 100644 --- a/ports/cef/interfaces/cef_request_handler.rs +++ b/ports/cef/interfaces/cef_request_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -46,26 +46,26 @@ use std::collections::HashMap; use std::ptr; // -// Callback structure used for asynchronous continuation of quota requests. +// Callback structure used for asynchronous continuation of url requests. // #[repr(C)] -pub struct _cef_quota_callback_t { +pub struct _cef_request_callback_t { // // Base structure. // pub base: types::cef_base_t, // - // Continue the quota request. If |allow| is true (1) the request will be - // allowed. Otherwise, the request will be denied. + // Continue the url request. If |allow| is true (1) the request will be + // continued. Otherwise, the request will be canceled. // - pub cont: Option ()>, // - // Cancel the quota request. + // Cancel the url request. // - pub cancel: Option ()>, + pub cancel: Option ()>, // // The reference count. This will only be present for Rust instances! @@ -78,30 +78,30 @@ pub struct _cef_quota_callback_t { pub extra: u8, } -pub type cef_quota_callback_t = _cef_quota_callback_t; +pub type cef_request_callback_t = _cef_request_callback_t; // -// Callback structure used for asynchronous continuation of quota requests. +// Callback structure used for asynchronous continuation of url requests. // -pub struct CefQuotaCallback { - c_object: *mut cef_quota_callback_t, +pub struct CefRequestCallback { + c_object: *mut cef_request_callback_t, } -impl Clone for CefQuotaCallback { - fn clone(&self) -> CefQuotaCallback{ +impl Clone for CefRequestCallback { + fn clone(&self) -> CefRequestCallback{ unsafe { if !self.c_object.is_null() { ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base); } - CefQuotaCallback { + CefRequestCallback { c_object: self.c_object, } } } } -impl Drop for CefQuotaCallback { +impl Drop for CefRequestCallback { fn drop(&mut self) { unsafe { if !self.c_object.is_null() { @@ -111,27 +111,27 @@ impl Drop for CefQuotaCallback { } } -impl CefQuotaCallback { - pub unsafe fn from_c_object(c_object: *mut cef_quota_callback_t) -> CefQuotaCallback { - CefQuotaCallback { +impl CefRequestCallback { + pub unsafe fn from_c_object(c_object: *mut cef_request_callback_t) -> CefRequestCallback { + CefRequestCallback { c_object: c_object, } } - pub unsafe fn from_c_object_addref(c_object: *mut cef_quota_callback_t) -> CefQuotaCallback { + pub unsafe fn from_c_object_addref(c_object: *mut cef_request_callback_t) -> CefRequestCallback { if !c_object.is_null() { ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base); } - CefQuotaCallback { + CefRequestCallback { c_object: c_object, } } - pub fn c_object(&self) -> *mut cef_quota_callback_t { + pub fn c_object(&self) -> *mut cef_request_callback_t { self.c_object } - pub fn c_object_addrefed(&self) -> *mut cef_quota_callback_t { + pub fn c_object_addrefed(&self) -> *mut cef_request_callback_t { unsafe { if !self.c_object.is_null() { eutil::add_ref(self.c_object as *mut types::cef_base_t); @@ -148,8 +148,8 @@ impl CefQuotaCallback { } // - // Continue the quota request. If |allow| is true (1) the request will be - // allowed. Otherwise, the request will be denied. + // Continue the url request. If |allow| is true (1) the request will be + // continued. Otherwise, the request will be canceled. // pub fn cont(&self, allow: libc::c_int) -> () { if self.c_object.is_null() { @@ -164,7 +164,7 @@ impl CefQuotaCallback { } // - // Cancel the quota request. + // Cancel the url request. // pub fn cancel(&self) -> () { if self.c_object.is_null() { @@ -178,168 +178,26 @@ impl CefQuotaCallback { } } -impl CefWrap<*mut cef_quota_callback_t> for CefQuotaCallback { - fn to_c(rust_object: CefQuotaCallback) -> *mut cef_quota_callback_t { +impl CefWrap<*mut cef_request_callback_t> for CefRequestCallback { + fn to_c(rust_object: CefRequestCallback) -> *mut cef_request_callback_t { rust_object.c_object_addrefed() } - unsafe fn to_rust(c_object: *mut cef_quota_callback_t) -> CefQuotaCallback { - CefQuotaCallback::from_c_object_addref(c_object) + unsafe fn to_rust(c_object: *mut cef_request_callback_t) -> CefRequestCallback { + CefRequestCallback::from_c_object_addref(c_object) } } -impl CefWrap<*mut cef_quota_callback_t> for Option { - fn to_c(rust_object: Option) -> *mut cef_quota_callback_t { +impl CefWrap<*mut cef_request_callback_t> for Option { + fn to_c(rust_object: Option) -> *mut cef_request_callback_t { match rust_object { None => ptr::null_mut(), Some(rust_object) => rust_object.c_object_addrefed(), } } - unsafe fn to_rust(c_object: *mut cef_quota_callback_t) -> Option { + unsafe fn to_rust(c_object: *mut cef_request_callback_t) -> Option { if c_object.is_null() { None } else { - Some(CefQuotaCallback::from_c_object_addref(c_object)) - } - } -} - - -// -// Callback structure used for asynchronous continuation of url requests when -// invalid SSL certificates are encountered. -// -#[repr(C)] -pub struct _cef_allow_certificate_error_callback_t { - // - // Base structure. - // - pub base: types::cef_base_t, - - // - // Continue the url request. If |allow| is true (1) the request will be - // continued. Otherwise, the request will be canceled. - // - pub cont: Option ()>, - - // - // The reference count. This will only be present for Rust instances! - // - pub ref_count: usize, - - // - // Extra data. This will only be present for Rust instances! - // - pub extra: u8, -} - -pub type cef_allow_certificate_error_callback_t = _cef_allow_certificate_error_callback_t; - - -// -// Callback structure used for asynchronous continuation of url requests when -// invalid SSL certificates are encountered. -// -pub struct CefAllowCertificateErrorCallback { - c_object: *mut cef_allow_certificate_error_callback_t, -} - -impl Clone for CefAllowCertificateErrorCallback { - fn clone(&self) -> CefAllowCertificateErrorCallback{ - unsafe { - if !self.c_object.is_null() { - ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base); - } - CefAllowCertificateErrorCallback { - c_object: self.c_object, - } - } - } -} - -impl Drop for CefAllowCertificateErrorCallback { - fn drop(&mut self) { - unsafe { - if !self.c_object.is_null() { - ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base); - } - } - } -} - -impl CefAllowCertificateErrorCallback { - pub unsafe fn from_c_object(c_object: *mut cef_allow_certificate_error_callback_t) -> CefAllowCertificateErrorCallback { - CefAllowCertificateErrorCallback { - c_object: c_object, - } - } - - pub unsafe fn from_c_object_addref(c_object: *mut cef_allow_certificate_error_callback_t) -> CefAllowCertificateErrorCallback { - if !c_object.is_null() { - ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base); - } - CefAllowCertificateErrorCallback { - c_object: c_object, - } - } - - pub fn c_object(&self) -> *mut cef_allow_certificate_error_callback_t { - self.c_object - } - - pub fn c_object_addrefed(&self) -> *mut cef_allow_certificate_error_callback_t { - unsafe { - if !self.c_object.is_null() { - eutil::add_ref(self.c_object as *mut types::cef_base_t); - } - self.c_object - } - } - - pub fn is_null_cef_object(&self) -> bool { - self.c_object.is_null() - } - pub fn is_not_null_cef_object(&self) -> bool { - !self.c_object.is_null() - } - - // - // Continue the url request. If |allow| is true (1) the request will be - // continued. Otherwise, the request will be canceled. - // - pub fn cont(&self, allow: libc::c_int) -> () { - if self.c_object.is_null() { - panic!("called a CEF method on a null object") - } - unsafe { - CefWrap::to_rust( - ((*self.c_object).cont.unwrap())( - self.c_object, - CefWrap::to_c(allow))) - } - } -} - -impl CefWrap<*mut cef_allow_certificate_error_callback_t> for CefAllowCertificateErrorCallback { - fn to_c(rust_object: CefAllowCertificateErrorCallback) -> *mut cef_allow_certificate_error_callback_t { - rust_object.c_object_addrefed() - } - unsafe fn to_rust(c_object: *mut cef_allow_certificate_error_callback_t) -> CefAllowCertificateErrorCallback { - CefAllowCertificateErrorCallback::from_c_object_addref(c_object) - } -} -impl CefWrap<*mut cef_allow_certificate_error_callback_t> for Option { - fn to_c(rust_object: Option) -> *mut cef_allow_certificate_error_callback_t { - match rust_object { - None => ptr::null_mut(), - Some(rust_object) => rust_object.c_object_addrefed(), - } - } - unsafe fn to_rust(c_object: *mut cef_allow_certificate_error_callback_t) -> Option { - if c_object.is_null() { - None - } else { - Some(CefAllowCertificateErrorCallback::from_c_object_addref(c_object)) + Some(CefRequestCallback::from_c_object_addref(c_object)) } } } @@ -372,15 +230,42 @@ pub struct _cef_request_handler_t { request: *mut interfaces::cef_request_t, is_redirect: libc::c_int) -> libc::c_int>, + // + // Called on the UI thread before OnBeforeBrowse in certain limited cases + // where navigating a new or different browser might be desirable. This + // includes user-initiated navigation that might open in a special way (e.g. + // links clicked via middle-click or ctrl + left-click) and certain types of + // cross-origin navigation initiated from the renderer process (e.g. + // navigating the top-level frame to/from a file URL). The |browser| and + // |frame| values represent the source of the navigation. The + // |target_disposition| value indicates where the user intended to navigate + // the browser based on standard Chromium behaviors (e.g. current tab, new + // tab, etc). The |user_gesture| value will be true (1) if the browser + // navigated via explicit user gesture (e.g. clicking a link) or false (0) if + // it navigated automatically (e.g. via the DomContentLoaded event). Return + // true (1) to cancel the navigation or false (0) to allow the navigation to + // proceed in the source browser's top-level frame. + // + pub on_open_urlfrom_tab: Option libc::c_int>, + // // Called on the IO thread before a resource request is loaded. The |request| - // object may be modified. To cancel the request return true (1) otherwise - // return false (0). + // object may be modified. Return RV_CONTINUE to continue the request + // immediately. Return RV_CONTINUE_ASYNC and call cef_request_tCallback:: + // cont() at a later time to continue or cancel the request asynchronously. + // Return RV_CANCEL to cancel the request immediately. + // // pub on_before_resource_load: Option libc::c_int>, + request: *mut interfaces::cef_request_t, + callback: *mut interfaces::cef_request_callback_t) -> types::cef_return_value_t>, // // Called on the IO thread before a resource is loaded. To allow the resource @@ -394,21 +279,36 @@ pub struct _cef_request_handler_t { request: *mut interfaces::cef_request_t) -> *mut interfaces::cef_resource_handler_t>, // - // Called on the IO thread when a resource load is redirected. The |old_url| - // parameter will contain the old URL. The |new_url| parameter will contain - // the new URL and can be changed if desired. + // Called on the IO thread when a resource load is redirected. The |request| + // parameter will contain the old URL and other request-related information. + // The |new_url| parameter will contain the new URL and can be changed if + // desired. The |request| object cannot be modified in this callback. // pub on_resource_redirect: Option ()>, + // + // Called on the IO thread when a resource response is received. To allow the + // resource to load normally return false (0). To redirect or retry the + // resource modify |request| (url, headers or post body) and return true (1). + // The |response| object cannot be modified in this callback. + // + pub on_resource_response: Option libc::c_int>, + // // Called on the IO thread when the browser needs credentials from the user. // |isProxy| indicates whether the host is a proxy server. |host| contains the // hostname and |port| contains the port number. Return true (1) to continue - // the request and call cef_auth_callback_t::cont() when the authentication - // information is available. Return false (0) to cancel the request. + // the request and call cef_auth_callback_t::cont() either in this function or + // at a later time when the authentication information is available. Return + // false (0) to cancel the request immediately. // pub get_auth_credentials: Option libc::c_int>, + callback: *mut interfaces::cef_request_callback_t) -> libc::c_int>, // // Called on the UI thread to handle requests for URLs with an unknown @@ -444,18 +345,19 @@ pub struct _cef_request_handler_t { // // Called on the UI thread to handle requests for URLs with an invalid SSL - // certificate. Return true (1) and call - // cef_allow_certificate_error_callback_t:: cont() either in this function or - // at a later time to continue or cancel the request. Return false (0) to - // cancel the request immediately. If |callback| is NULL the error cannot be - // recovered from and the request will be canceled automatically. If - // CefSettings.ignore_certificate_errors is set all invalid certificates will - // be accepted without calling this function. + // certificate. Return true (1) and call cef_request_tCallback::cont() either + // in this function or at a later time to continue or cancel the request. + // Return false (0) to cancel the request immediately. If |callback| is NULL + // the error cannot be recovered from and the request will be canceled + // automatically. If CefSettings.ignore_certificate_errors is set all invalid + // certificates will be accepted without calling this function. // pub on_certificate_error: Option libc::c_int>, + ssl_info: *mut interfaces::cef_sslinfo_t, + callback: *mut interfaces::cef_request_callback_t) -> libc::c_int>, // // Called on the browser process IO thread before a plugin is loaded. Return @@ -474,6 +376,15 @@ pub struct _cef_request_handler_t { browser: *mut interfaces::cef_browser_t, plugin_path: *const types::cef_string_t) -> ()>, + // + // Called on the browser process UI thread when the render view associated + // with |browser| is ready to receive/handle IPC messages in the render + // process. + // + pub on_render_view_ready: Option ()>, + // // Called on the browser process UI thread when the render process terminates // unexpectedly. |status| indicates how the process terminated. @@ -590,14 +501,52 @@ impl CefRequestHandler { } } + // + // Called on the UI thread before OnBeforeBrowse in certain limited cases + // where navigating a new or different browser might be desirable. This + // includes user-initiated navigation that might open in a special way (e.g. + // links clicked via middle-click or ctrl + left-click) and certain types of + // cross-origin navigation initiated from the renderer process (e.g. + // navigating the top-level frame to/from a file URL). The |browser| and + // |frame| values represent the source of the navigation. The + // |target_disposition| value indicates where the user intended to navigate + // the browser based on standard Chromium behaviors (e.g. current tab, new + // tab, etc). The |user_gesture| value will be true (1) if the browser + // navigated via explicit user gesture (e.g. clicking a link) or false (0) if + // it navigated automatically (e.g. via the DomContentLoaded event). Return + // true (1) to cancel the navigation or false (0) to allow the navigation to + // proceed in the source browser's top-level frame. + // + pub fn on_open_urlfrom_tab(&self, browser: interfaces::CefBrowser, + frame: interfaces::CefFrame, target_url: &[u16], + target_disposition: types::cef_window_open_disposition_t, + user_gesture: libc::c_int) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).on_open_urlfrom_tab.unwrap())( + self.c_object, + CefWrap::to_c(browser), + CefWrap::to_c(frame), + CefWrap::to_c(target_url), + CefWrap::to_c(target_disposition), + CefWrap::to_c(user_gesture))) + } + } + // // Called on the IO thread before a resource request is loaded. The |request| - // object may be modified. To cancel the request return true (1) otherwise - // return false (0). + // object may be modified. Return RV_CONTINUE to continue the request + // immediately. Return RV_CONTINUE_ASYNC and call cef_request_tCallback:: + // cont() at a later time to continue or cancel the request asynchronously. + // Return RV_CANCEL to cancel the request immediately. + // // pub fn on_before_resource_load(&self, browser: interfaces::CefBrowser, - frame: interfaces::CefFrame, - request: interfaces::CefRequest) -> libc::c_int { + frame: interfaces::CefFrame, request: interfaces::CefRequest, + callback: interfaces::CefRequestCallback) -> types::cef_return_value_t { if self.c_object.is_null() { panic!("called a CEF method on a null object") } @@ -607,7 +556,8 @@ impl CefRequestHandler { self.c_object, CefWrap::to_c(browser), CefWrap::to_c(frame), - CefWrap::to_c(request))) + CefWrap::to_c(request), + CefWrap::to_c(callback))) } } @@ -634,12 +584,13 @@ impl CefRequestHandler { } // - // Called on the IO thread when a resource load is redirected. The |old_url| - // parameter will contain the old URL. The |new_url| parameter will contain - // the new URL and can be changed if desired. + // Called on the IO thread when a resource load is redirected. The |request| + // parameter will contain the old URL and other request-related information. + // The |new_url| parameter will contain the new URL and can be changed if + // desired. The |request| object cannot be modified in this callback. // pub fn on_resource_redirect(&self, browser: interfaces::CefBrowser, - frame: interfaces::CefFrame, old_url: &[u16], + frame: interfaces::CefFrame, request: interfaces::CefRequest, new_url: *mut types::cef_string_t) -> () { if self.c_object.is_null() { panic!("called a CEF method on a null object") @@ -650,17 +601,41 @@ impl CefRequestHandler { self.c_object, CefWrap::to_c(browser), CefWrap::to_c(frame), - CefWrap::to_c(old_url), + CefWrap::to_c(request), CefWrap::to_c(new_url))) } } + // + // Called on the IO thread when a resource response is received. To allow the + // resource to load normally return false (0). To redirect or retry the + // resource modify |request| (url, headers or post body) and return true (1). + // The |response| object cannot be modified in this callback. + // + pub fn on_resource_response(&self, browser: interfaces::CefBrowser, + frame: interfaces::CefFrame, request: interfaces::CefRequest, + response: interfaces::CefResponse) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).on_resource_response.unwrap())( + self.c_object, + CefWrap::to_c(browser), + CefWrap::to_c(frame), + CefWrap::to_c(request), + CefWrap::to_c(response))) + } + } + // // Called on the IO thread when the browser needs credentials from the user. // |isProxy| indicates whether the host is a proxy server. |host| contains the // hostname and |port| contains the port number. Return true (1) to continue - // the request and call cef_auth_callback_t::cont() when the authentication - // information is available. Return false (0) to cancel the request. + // the request and call cef_auth_callback_t::cont() either in this function or + // at a later time when the authentication information is available. Return + // false (0) to cancel the request immediately. // pub fn get_auth_credentials(&self, browser: interfaces::CefBrowser, frame: interfaces::CefFrame, isProxy: libc::c_int, host: &[u16], @@ -688,13 +663,14 @@ impl CefRequestHandler { // Called on the IO thread when JavaScript requests a specific storage quota // size via the webkitStorageInfo.requestQuota function. |origin_url| is the // origin of the page making the request. |new_size| is the requested quota - // size in bytes. Return true (1) and call cef_quota_callback_t::cont() either - // in this function or at a later time to grant or deny the request. Return - // false (0) to cancel the request. + // size in bytes. Return true (1) to continue the request and call + // cef_request_tCallback::cont() either in this function or at a later time to + // grant or deny the request. Return false (0) to cancel the request + // immediately. // pub fn on_quota_request(&self, browser: interfaces::CefBrowser, origin_url: &[u16], new_size: i64, - callback: interfaces::CefQuotaCallback) -> libc::c_int { + callback: interfaces::CefRequestCallback) -> libc::c_int { if self.c_object.is_null() { panic!("called a CEF method on a null object") } @@ -733,17 +709,17 @@ impl CefRequestHandler { // // Called on the UI thread to handle requests for URLs with an invalid SSL - // certificate. Return true (1) and call - // cef_allow_certificate_error_callback_t:: cont() either in this function or - // at a later time to continue or cancel the request. Return false (0) to - // cancel the request immediately. If |callback| is NULL the error cannot be - // recovered from and the request will be canceled automatically. If - // CefSettings.ignore_certificate_errors is set all invalid certificates will - // be accepted without calling this function. + // certificate. Return true (1) and call cef_request_tCallback::cont() either + // in this function or at a later time to continue or cancel the request. + // Return false (0) to cancel the request immediately. If |callback| is NULL + // the error cannot be recovered from and the request will be canceled + // automatically. If CefSettings.ignore_certificate_errors is set all invalid + // certificates will be accepted without calling this function. // - pub fn on_certificate_error(&self, cert_error: types::cef_errorcode_t, - request_url: &[u16], - callback: interfaces::CefAllowCertificateErrorCallback) -> libc::c_int { + pub fn on_certificate_error(&self, browser: interfaces::CefBrowser, + cert_error: types::cef_errorcode_t, request_url: &[u16], + ssl_info: interfaces::CefSSLInfo, + callback: interfaces::CefRequestCallback) -> libc::c_int { if self.c_object.is_null() { panic!("called a CEF method on a null object") } @@ -751,8 +727,10 @@ impl CefRequestHandler { CefWrap::to_rust( ((*self.c_object).on_certificate_error.unwrap())( self.c_object, + CefWrap::to_c(browser), CefWrap::to_c(cert_error), CefWrap::to_c(request_url), + CefWrap::to_c(ssl_info), CefWrap::to_c(callback))) } } @@ -796,6 +774,23 @@ impl CefRequestHandler { } } + // + // Called on the browser process UI thread when the render view associated + // with |browser| is ready to receive/handle IPC messages in the render + // process. + // + pub fn on_render_view_ready(&self, browser: interfaces::CefBrowser) -> () { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).on_render_view_ready.unwrap())( + self.c_object, + CefWrap::to_c(browser))) + } + } + // // Called on the browser process UI thread when the render process terminates // unexpectedly. |status| indicates how the process terminated. diff --git a/ports/cef/interfaces/cef_resource_bundle_handler.rs b/ports/cef/interfaces/cef_resource_bundle_handler.rs index 680aa71eb69..a99c1946d9e 100644 --- a/ports/cef/interfaces/cef_resource_bundle_handler.rs +++ b/ports/cef/interfaces/cef_resource_bundle_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_resource_handler.rs b/ports/cef/interfaces/cef_resource_handler.rs index 7f72737a86e..a374210b591 100644 --- a/ports/cef/interfaces/cef_resource_handler.rs +++ b/ports/cef/interfaces/cef_resource_handler.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_response.rs b/ports/cef/interfaces/cef_response.rs index 86140890396..6c97d22c3c0 100644 --- a/ports/cef/interfaces/cef_response.rs +++ b/ports/cef/interfaces/cef_response.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_scheme.rs b/ports/cef/interfaces/cef_scheme.rs index ecbfaa70ebb..871173b083e 100644 --- a/ports/cef/interfaces/cef_scheme.rs +++ b/ports/cef/interfaces/cef_scheme.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_ssl_info.rs b/ports/cef/interfaces/cef_ssl_info.rs new file mode 100644 index 00000000000..77b434eb5dc --- /dev/null +++ b/ports/cef/interfaces/cef_ssl_info.rs @@ -0,0 +1,628 @@ +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not be edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#![allow(non_snake_case, unused_imports)] + +use eutil; +use interfaces; +use types; +use wrappers::CefWrap; + +use libc; +use std::collections::HashMap; +use std::ptr; + +// +// Structure representing the issuer or subject field of an X.509 certificate. +// +#[repr(C)] +pub struct _cef_sslcert_principal_t { + // + // Base structure. + // + pub base: types::cef_base_t, + + // + // Returns a name that can be used to represent the issuer. It tries in this + // order: CN, O and OU and returns the first non-NULL one found. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub get_display_name: Option types::cef_string_userfree_t>, + + // + // Returns the common name. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub get_common_name: Option types::cef_string_userfree_t>, + + // + // Returns the locality name. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub get_locality_name: Option types::cef_string_userfree_t>, + + // + // Returns the state or province name. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub get_state_or_province_name: Option types::cef_string_userfree_t>, + + // + // Returns the country name. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub get_country_name: Option types::cef_string_userfree_t>, + + // + // Retrieve the list of street addresses. + // + pub get_street_addresses: Option ()>, + + // + // Retrieve the list of organization names. + // + pub get_organization_names: Option ( + )>, + + // + // Retrieve the list of organization unit names. + // + pub get_organization_unit_names: Option ( + )>, + + // + // Retrieve the list of domain components. + // + pub get_domain_components: Option ()>, + + // + // The reference count. This will only be present for Rust instances! + // + pub ref_count: usize, + + // + // Extra data. This will only be present for Rust instances! + // + pub extra: u8, +} + +pub type cef_sslcert_principal_t = _cef_sslcert_principal_t; + + +// +// Structure representing the issuer or subject field of an X.509 certificate. +// +pub struct CefSSLCertPrincipal { + c_object: *mut cef_sslcert_principal_t, +} + +impl Clone for CefSSLCertPrincipal { + fn clone(&self) -> CefSSLCertPrincipal{ + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base); + } + CefSSLCertPrincipal { + c_object: self.c_object, + } + } + } +} + +impl Drop for CefSSLCertPrincipal { + fn drop(&mut self) { + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base); + } + } + } +} + +impl CefSSLCertPrincipal { + pub unsafe fn from_c_object(c_object: *mut cef_sslcert_principal_t) -> CefSSLCertPrincipal { + CefSSLCertPrincipal { + c_object: c_object, + } + } + + pub unsafe fn from_c_object_addref(c_object: *mut cef_sslcert_principal_t) -> CefSSLCertPrincipal { + if !c_object.is_null() { + ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base); + } + CefSSLCertPrincipal { + c_object: c_object, + } + } + + pub fn c_object(&self) -> *mut cef_sslcert_principal_t { + self.c_object + } + + pub fn c_object_addrefed(&self) -> *mut cef_sslcert_principal_t { + unsafe { + if !self.c_object.is_null() { + eutil::add_ref(self.c_object as *mut types::cef_base_t); + } + self.c_object + } + } + + pub fn is_null_cef_object(&self) -> bool { + self.c_object.is_null() + } + pub fn is_not_null_cef_object(&self) -> bool { + !self.c_object.is_null() + } + + // + // Returns a name that can be used to represent the issuer. It tries in this + // order: CN, O and OU and returns the first non-NULL one found. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub fn get_display_name(&self) -> String { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_display_name.unwrap())( + self.c_object)) + } + } + + // + // Returns the common name. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub fn get_common_name(&self) -> String { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_common_name.unwrap())( + self.c_object)) + } + } + + // + // Returns the locality name. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub fn get_locality_name(&self) -> String { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_locality_name.unwrap())( + self.c_object)) + } + } + + // + // Returns the state or province name. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub fn get_state_or_province_name(&self) -> String { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_state_or_province_name.unwrap())( + self.c_object)) + } + } + + // + // Returns the country name. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub fn get_country_name(&self) -> String { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_country_name.unwrap())( + self.c_object)) + } + } + + // + // Retrieve the list of street addresses. + // + pub fn get_street_addresses(&self, addresses: Vec) -> () { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_street_addresses.unwrap())( + self.c_object, + CefWrap::to_c(addresses))) + } + } + + // + // Retrieve the list of organization names. + // + pub fn get_organization_names(&self, names: Vec) -> () { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_organization_names.unwrap())( + self.c_object, + CefWrap::to_c(names))) + } + } + + // + // Retrieve the list of organization unit names. + // + pub fn get_organization_unit_names(&self, names: Vec) -> () { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_organization_unit_names.unwrap())( + self.c_object, + CefWrap::to_c(names))) + } + } + + // + // Retrieve the list of domain components. + // + pub fn get_domain_components(&self, components: Vec) -> () { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_domain_components.unwrap())( + self.c_object, + CefWrap::to_c(components))) + } + } +} + +impl CefWrap<*mut cef_sslcert_principal_t> for CefSSLCertPrincipal { + fn to_c(rust_object: CefSSLCertPrincipal) -> *mut cef_sslcert_principal_t { + rust_object.c_object_addrefed() + } + unsafe fn to_rust(c_object: *mut cef_sslcert_principal_t) -> CefSSLCertPrincipal { + CefSSLCertPrincipal::from_c_object_addref(c_object) + } +} +impl CefWrap<*mut cef_sslcert_principal_t> for Option { + fn to_c(rust_object: Option) -> *mut cef_sslcert_principal_t { + match rust_object { + None => ptr::null_mut(), + Some(rust_object) => rust_object.c_object_addrefed(), + } + } + unsafe fn to_rust(c_object: *mut cef_sslcert_principal_t) -> Option { + if c_object.is_null() { + None + } else { + Some(CefSSLCertPrincipal::from_c_object_addref(c_object)) + } + } +} + + +// +// Structure representing SSL information. +// +#[repr(C)] +pub struct _cef_sslinfo_t { + // + // Base structure. + // + pub base: types::cef_base_t, + + // + // Returns the subject of the X.509 certificate. For HTTPS server certificates + // this represents the web server. The common name of the subject should + // match the host name of the web server. + // + pub get_subject: Option *mut interfaces::cef_sslcert_principal_t>, + + // + // Returns the issuer of the X.509 certificate. + // + pub get_issuer: Option *mut interfaces::cef_sslcert_principal_t>, + + // + // Returns the DER encoded serial number for the X.509 certificate. The value + // possibly includes a leading 00 byte. + // + pub get_serial_number: Option *mut interfaces::cef_binary_value_t>, + + // + // Returns the date before which the X.509 certificate is invalid. + // CefTime.GetTimeT() will return 0 if no date was specified. + // + pub get_valid_start: Option types::cef_time_t>, + + // + // Returns the date after which the X.509 certificate is invalid. + // CefTime.GetTimeT() will return 0 if no date was specified. + // + pub get_valid_expiry: Option types::cef_time_t>, + + // + // Returns the DER encoded data for the X.509 certificate. + // + pub get_derencoded: Option *mut interfaces::cef_binary_value_t>, + + // + // Returns the PEM encoded data for the X.509 certificate. + // + pub get_pemencoded: Option *mut interfaces::cef_binary_value_t>, + + // + // The reference count. This will only be present for Rust instances! + // + pub ref_count: usize, + + // + // Extra data. This will only be present for Rust instances! + // + pub extra: u8, +} + +pub type cef_sslinfo_t = _cef_sslinfo_t; + + +// +// Structure representing SSL information. +// +pub struct CefSSLInfo { + c_object: *mut cef_sslinfo_t, +} + +impl Clone for CefSSLInfo { + fn clone(&self) -> CefSSLInfo{ + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base); + } + CefSSLInfo { + c_object: self.c_object, + } + } + } +} + +impl Drop for CefSSLInfo { + fn drop(&mut self) { + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base); + } + } + } +} + +impl CefSSLInfo { + pub unsafe fn from_c_object(c_object: *mut cef_sslinfo_t) -> CefSSLInfo { + CefSSLInfo { + c_object: c_object, + } + } + + pub unsafe fn from_c_object_addref(c_object: *mut cef_sslinfo_t) -> CefSSLInfo { + if !c_object.is_null() { + ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base); + } + CefSSLInfo { + c_object: c_object, + } + } + + pub fn c_object(&self) -> *mut cef_sslinfo_t { + self.c_object + } + + pub fn c_object_addrefed(&self) -> *mut cef_sslinfo_t { + unsafe { + if !self.c_object.is_null() { + eutil::add_ref(self.c_object as *mut types::cef_base_t); + } + self.c_object + } + } + + pub fn is_null_cef_object(&self) -> bool { + self.c_object.is_null() + } + pub fn is_not_null_cef_object(&self) -> bool { + !self.c_object.is_null() + } + + // + // Returns the subject of the X.509 certificate. For HTTPS server certificates + // this represents the web server. The common name of the subject should + // match the host name of the web server. + // + pub fn get_subject(&self) -> interfaces::CefSSLCertPrincipal { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_subject.unwrap())( + self.c_object)) + } + } + + // + // Returns the issuer of the X.509 certificate. + // + pub fn get_issuer(&self) -> interfaces::CefSSLCertPrincipal { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_issuer.unwrap())( + self.c_object)) + } + } + + // + // Returns the DER encoded serial number for the X.509 certificate. The value + // possibly includes a leading 00 byte. + // + pub fn get_serial_number(&self) -> interfaces::CefBinaryValue { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_serial_number.unwrap())( + self.c_object)) + } + } + + // + // Returns the date before which the X.509 certificate is invalid. + // CefTime.GetTimeT() will return 0 if no date was specified. + // + pub fn get_valid_start(&self) -> types::cef_time_t { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_valid_start.unwrap())( + self.c_object)) + } + } + + // + // Returns the date after which the X.509 certificate is invalid. + // CefTime.GetTimeT() will return 0 if no date was specified. + // + pub fn get_valid_expiry(&self) -> types::cef_time_t { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_valid_expiry.unwrap())( + self.c_object)) + } + } + + // + // Returns the DER encoded data for the X.509 certificate. + // + pub fn get_derencoded(&self) -> interfaces::CefBinaryValue { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_derencoded.unwrap())( + self.c_object)) + } + } + + // + // Returns the PEM encoded data for the X.509 certificate. + // + pub fn get_pemencoded(&self) -> interfaces::CefBinaryValue { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_pemencoded.unwrap())( + self.c_object)) + } + } +} + +impl CefWrap<*mut cef_sslinfo_t> for CefSSLInfo { + fn to_c(rust_object: CefSSLInfo) -> *mut cef_sslinfo_t { + rust_object.c_object_addrefed() + } + unsafe fn to_rust(c_object: *mut cef_sslinfo_t) -> CefSSLInfo { + CefSSLInfo::from_c_object_addref(c_object) + } +} +impl CefWrap<*mut cef_sslinfo_t> for Option { + fn to_c(rust_object: Option) -> *mut cef_sslinfo_t { + match rust_object { + None => ptr::null_mut(), + Some(rust_object) => rust_object.c_object_addrefed(), + } + } + unsafe fn to_rust(c_object: *mut cef_sslinfo_t) -> Option { + if c_object.is_null() { + None + } else { + Some(CefSSLInfo::from_c_object_addref(c_object)) + } + } +} + diff --git a/ports/cef/interfaces/cef_stream.rs b/ports/cef/interfaces/cef_stream.rs index 07dc90bdf3b..598436523ca 100644 --- a/ports/cef/interfaces/cef_stream.rs +++ b/ports/cef/interfaces/cef_stream.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_string_visitor.rs b/ports/cef/interfaces/cef_string_visitor.rs index 1e98a4f9627..e28c3f016d6 100644 --- a/ports/cef/interfaces/cef_string_visitor.rs +++ b/ports/cef/interfaces/cef_string_visitor.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_task.rs b/ports/cef/interfaces/cef_task.rs index 0f496a1cad5..aa94aebd23f 100644 --- a/ports/cef/interfaces/cef_task.rs +++ b/ports/cef/interfaces/cef_task.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_trace.rs b/ports/cef/interfaces/cef_trace.rs index e3e0ce524a2..b954cef0e50 100644 --- a/ports/cef/interfaces/cef_trace.rs +++ b/ports/cef/interfaces/cef_trace.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_urlrequest.rs b/ports/cef/interfaces/cef_urlrequest.rs index e08eacc55be..7bbd7f84e2f 100644 --- a/ports/cef/interfaces/cef_urlrequest.rs +++ b/ports/cef/interfaces/cef_urlrequest.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -280,15 +280,20 @@ impl CefURLRequest { // would not normally be rendered then the response may receive special // handling inside the browser (for example, via the file download code path // instead of the URL request code path). The |request| object will be marked - // as read-only after calling this function. + // as read-only after calling this function. In the browser process if + // |request_context| is NULL the global request context will be used. In the + // render process |request_context| must be NULL and the context associated + // with the current renderer process' browser will be used. // pub fn create(request: interfaces::CefRequest, - client: interfaces::CefURLRequestClient) -> interfaces::CefURLRequest { + client: interfaces::CefURLRequestClient, + request_context: interfaces::CefRequestContext) -> interfaces::CefURLRequest { unsafe { CefWrap::to_rust( ::urlrequest::cef_urlrequest_create( CefWrap::to_c(request), - CefWrap::to_c(client))) + CefWrap::to_c(client), + CefWrap::to_c(request_context))) } } } @@ -347,8 +352,8 @@ pub struct _cef_urlrequest_client_t { // pub on_upload_progress: Option ()>, + request: *mut interfaces::cef_urlrequest_t, current: i64, + total: i64) -> ()>, // // Notifies the client of download progress. |current| denotes the number of @@ -357,8 +362,8 @@ pub struct _cef_urlrequest_client_t { // pub on_download_progress: Option ()>, + request: *mut interfaces::cef_urlrequest_t, current: i64, + total: i64) -> ()>, // // Called when some part of the response is read. |data| contains the current @@ -490,7 +495,7 @@ impl CefURLRequestClient { // UR_FLAG_REPORT_UPLOAD_PROGRESS flag is set on the request. // pub fn on_upload_progress(&self, request: interfaces::CefURLRequest, - current: u64, total: u64) -> () { + current: i64, total: i64) -> () { if self.c_object.is_null() { panic!("called a CEF method on a null object") } @@ -510,7 +515,7 @@ impl CefURLRequestClient { // response (or -1 if not determined). // pub fn on_download_progress(&self, request: interfaces::CefURLRequest, - current: u64, total: u64) -> () { + current: i64, total: i64) -> () { if self.c_object.is_null() { 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 8d404afe0ee..8f8db1ae171 100644 --- a/ports/cef/interfaces/cef_v8.rs +++ b/ports/cef/interfaces/cef_v8.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -581,9 +581,9 @@ impl CefWrap<*mut cef_v8handler_t> for Option { // // Structure that should be implemented to handle V8 accessor calls. Accessor -// identifiers are registered by calling cef_v8value_t::set_value_byaccessor(). -// The functions of this structure will be called on the thread associated with -// the V8 accessor. +// identifiers are registered by calling cef_v8value_t::set_value(). The +// functions of this structure will be called on the thread associated with the +// V8 accessor. // #[repr(C)] pub struct _cef_v8accessor_t { @@ -632,9 +632,9 @@ pub type cef_v8accessor_t = _cef_v8accessor_t; // // Structure that should be implemented to handle V8 accessor calls. Accessor -// identifiers are registered by calling cef_v8value_t::set_value_byaccessor(). -// The functions of this structure will be called on the thread associated with -// the V8 accessor. +// identifiers are registered by calling cef_v8value_t::set_value(). The +// functions of this structure will be called on the thread associated with the +// V8 accessor. // pub struct CefV8Accessor { c_object: *mut cef_v8accessor_t, @@ -1168,7 +1168,7 @@ pub struct _cef_v8value_t { pub get_int_value: Option i32>, // - // Return an unsigned int value. The underlying data will be converted to if + // Return an unisgned int value. The underlying data will be converted to if // necessary. // pub get_uint_value: Option u32>, @@ -1714,7 +1714,7 @@ impl CefV8Value { } // - // Return an unsigned int value. The underlying data will be converted to if + // Return an unisgned int value. The underlying data will be converted to if // necessary. // pub fn get_uint_value(&self) -> u32 { @@ -2289,7 +2289,7 @@ impl CefV8Value { // // Create a new cef_v8value_t object of type Date. This function should only - // be called from within the scope of a cef_v8context_tHandler, + // be called from within the scope of a cef_render_process_handler_t, // cef_v8handler_t or cef_v8accessor_t callback, or in combination with // calling enter() and exit() on a stored cef_v8context_t reference. // @@ -2315,9 +2315,9 @@ impl CefV8Value { // // Create a new cef_v8value_t object of type object with optional accessor. // This function should only be called from within the scope of a - // cef_v8context_tHandler, cef_v8handler_t or cef_v8accessor_t callback, or in - // combination with calling enter() and exit() on a stored cef_v8context_t - // reference. + // cef_render_process_handler_t, cef_v8handler_t or cef_v8accessor_t callback, + // or in combination with calling enter() and exit() on a stored + // cef_v8context_t reference. // pub fn create_object( accessor: interfaces::CefV8Accessor) -> interfaces::CefV8Value { @@ -2332,9 +2332,9 @@ impl CefV8Value { // Create a new cef_v8value_t object of type array with the specified // |length|. If |length| is negative the returned array will have length 0. // This function should only be called from within the scope of a - // cef_v8context_tHandler, cef_v8handler_t or cef_v8accessor_t callback, or in - // combination with calling enter() and exit() on a stored cef_v8context_t - // reference. + // cef_render_process_handler_t, cef_v8handler_t or cef_v8accessor_t callback, + // or in combination with calling enter() and exit() on a stored + // cef_v8context_t reference. // pub fn create_array(length: libc::c_int) -> interfaces::CefV8Value { unsafe { @@ -2346,7 +2346,7 @@ impl CefV8Value { // // Create a new cef_v8value_t object of type function. This function should - // only be called from within the scope of a cef_v8context_tHandler, + // only be called from within the scope of a cef_render_process_handler_t, // cef_v8handler_t or cef_v8accessor_t callback, or in combination with // calling enter() and exit() on a stored cef_v8context_t reference. // diff --git a/ports/cef/interfaces/cef_values.rs b/ports/cef/interfaces/cef_values.rs index dc9838232cc..84e38403b5f 100644 --- a/ports/cef/interfaces/cef_values.rs +++ b/ports/cef/interfaces/cef_values.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -45,6 +45,654 @@ use libc; use std::collections::HashMap; use std::ptr; +// +// Structure that wraps other data value types. Complex types (binary, +// dictionary and list) will be referenced but not owned by this object. Can be +// used on any process and thread. +// +#[repr(C)] +pub struct _cef_value_t { + // + // Base structure. + // + pub base: types::cef_base_t, + + // + // Returns true (1) if the underlying data is valid. This will always be true + // (1) for simple types. For complex types (binary, dictionary and list) the + // underlying data may become invalid if owned by another object (e.g. list or + // dictionary) and that other object is then modified or destroyed. This value + // object can be re-used by calling Set*() even if the underlying data is + // invalid. + // + pub is_valid: Option libc::c_int>, + + // + // Returns true (1) if the underlying data is owned by another object. + // + pub is_owned: Option libc::c_int>, + + // + // Returns true (1) if the underlying data is read-only. Some APIs may expose + // read-only objects. + // + pub is_read_only: Option libc::c_int>, + + // + // Returns true (1) if this object and |that| object have the same underlying + // data. If true (1) modifications to this object will also affect |that| + // object and vice-versa. + // + pub is_same: Option libc::c_int>, + + // + // Returns true (1) if this object and |that| object have an equivalent + // underlying value but are not necessarily the same object. + // + pub is_equal: Option libc::c_int>, + + // + // Returns a copy of this object. The underlying data will also be copied. + // + pub copy: Option *mut interfaces::cef_value_t>, + + // + // Returns the underlying value type. + // + pub get_type: Option interfaces::cef_value_type_t>, + + // + // Returns the underlying value as type bool. + // + pub get_bool: Option libc::c_int>, + + // + // Returns the underlying value as type int. + // + pub get_int: Option libc::c_int>, + + // + // Returns the underlying value as type double. + // + pub get_double: Option libc::c_double>, + + // + // Returns the underlying value as type string. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub get_string: Option types::cef_string_userfree_t>, + + // + // Returns the underlying value as type binary. The returned reference may + // become invalid if the value is owned by another object or if ownership is + // transferred to another object in the future. To maintain a reference to the + // value after assigning ownership to a dictionary or list pass this object to + // the set_value() function instead of passing the returned reference to + // set_binary(). + // + pub get_binary: Option *mut interfaces::cef_binary_value_t>, + + // + // Returns the underlying value as type dictionary. The returned reference may + // become invalid if the value is owned by another object or if ownership is + // transferred to another object in the future. To maintain a reference to the + // value after assigning ownership to a dictionary or list pass this object to + // the set_value() function instead of passing the returned reference to + // set_dictionary(). + // + pub get_dictionary: Option *mut interfaces::cef_dictionary_value_t>, + + // + // Returns the underlying value as type list. The returned reference may + // become invalid if the value is owned by another object or if ownership is + // transferred to another object in the future. To maintain a reference to the + // value after assigning ownership to a dictionary or list pass this object to + // the set_value() function instead of passing the returned reference to + // set_list(). + // + pub get_list: Option *mut interfaces::cef_list_value_t>, + + // + // Sets the underlying value as type null. Returns true (1) if the value was + // set successfully. + // + pub set_null: Option libc::c_int>, + + // + // Sets the underlying value as type bool. Returns true (1) if the value was + // set successfully. + // + pub set_bool: Option libc::c_int>, + + // + // Sets the underlying value as type int. Returns true (1) if the value was + // set successfully. + // + pub set_int: Option libc::c_int>, + + // + // Sets the underlying value as type double. Returns true (1) if the value was + // set successfully. + // + pub set_double: Option libc::c_int>, + + // + // Sets the underlying value as type string. Returns true (1) if the value was + // set successfully. + // + pub set_string: Option libc::c_int>, + + // + // Sets the underlying value as type binary. Returns true (1) if the value was + // set successfully. This object keeps a reference to |value| and ownership of + // the underlying data remains unchanged. + // + pub set_binary: Option libc::c_int>, + + // + // Sets the underlying value as type dict. Returns true (1) if the value was + // set successfully. This object keeps a reference to |value| and ownership of + // the underlying data remains unchanged. + // + pub set_dictionary: Option libc::c_int>, + + // + // Sets the underlying value as type list. Returns true (1) if the value was + // set successfully. This object keeps a reference to |value| and ownership of + // the underlying data remains unchanged. + // + pub set_list: Option libc::c_int>, + + // + // The reference count. This will only be present for Rust instances! + // + pub ref_count: usize, + + // + // Extra data. This will only be present for Rust instances! + // + pub extra: u8, +} + +pub type cef_value_t = _cef_value_t; + + +// +// Structure that wraps other data value types. Complex types (binary, +// dictionary and list) will be referenced but not owned by this object. Can be +// used on any process and thread. +// +pub struct CefValue { + c_object: *mut cef_value_t, +} + +impl Clone for CefValue { + fn clone(&self) -> CefValue{ + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base); + } + CefValue { + c_object: self.c_object, + } + } + } +} + +impl Drop for CefValue { + fn drop(&mut self) { + unsafe { + if !self.c_object.is_null() { + ((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base); + } + } + } +} + +impl CefValue { + pub unsafe fn from_c_object(c_object: *mut cef_value_t) -> CefValue { + CefValue { + c_object: c_object, + } + } + + pub unsafe fn from_c_object_addref(c_object: *mut cef_value_t) -> CefValue { + if !c_object.is_null() { + ((*c_object).base.add_ref.unwrap())(&mut (*c_object).base); + } + CefValue { + c_object: c_object, + } + } + + pub fn c_object(&self) -> *mut cef_value_t { + self.c_object + } + + pub fn c_object_addrefed(&self) -> *mut cef_value_t { + unsafe { + if !self.c_object.is_null() { + eutil::add_ref(self.c_object as *mut types::cef_base_t); + } + self.c_object + } + } + + pub fn is_null_cef_object(&self) -> bool { + self.c_object.is_null() + } + pub fn is_not_null_cef_object(&self) -> bool { + !self.c_object.is_null() + } + + // + // Returns true (1) if the underlying data is valid. This will always be true + // (1) for simple types. For complex types (binary, dictionary and list) the + // underlying data may become invalid if owned by another object (e.g. list or + // dictionary) and that other object is then modified or destroyed. This value + // object can be re-used by calling Set*() even if the underlying data is + // invalid. + // + pub fn is_valid(&self) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).is_valid.unwrap())( + self.c_object)) + } + } + + // + // Returns true (1) if the underlying data is owned by another object. + // + pub fn is_owned(&self) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).is_owned.unwrap())( + self.c_object)) + } + } + + // + // Returns true (1) if the underlying data is read-only. Some APIs may expose + // read-only objects. + // + pub fn is_read_only(&self) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).is_read_only.unwrap())( + self.c_object)) + } + } + + // + // Returns true (1) if this object and |that| object have the same underlying + // data. If true (1) modifications to this object will also affect |that| + // object and vice-versa. + // + pub fn is_same(&self, that: interfaces::CefValue) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).is_same.unwrap())( + self.c_object, + CefWrap::to_c(that))) + } + } + + // + // Returns true (1) if this object and |that| object have an equivalent + // underlying value but are not necessarily the same object. + // + pub fn is_equal(&self, that: interfaces::CefValue) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).is_equal.unwrap())( + self.c_object, + CefWrap::to_c(that))) + } + } + + // + // Returns a copy of this object. The underlying data will also be copied. + // + pub fn copy(&self) -> interfaces::CefValue { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).copy.unwrap())( + self.c_object)) + } + } + + // + // Returns the underlying value type. + // + pub fn get_type(&self) -> interfaces::CefValueType { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_type.unwrap())( + self.c_object)) + } + } + + // + // Returns the underlying value as type bool. + // + pub fn get_bool(&self) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_bool.unwrap())( + self.c_object)) + } + } + + // + // Returns the underlying value as type int. + // + pub fn get_int(&self) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_int.unwrap())( + self.c_object)) + } + } + + // + // Returns the underlying value as type double. + // + pub fn get_double(&self) -> libc::c_double { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_double.unwrap())( + self.c_object)) + } + } + + // + // Returns the underlying value as type string. + // + // The resulting string must be freed by calling cef_string_userfree_free(). + pub fn get_string(&self) -> String { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_string.unwrap())( + self.c_object)) + } + } + + // + // Returns the underlying value as type binary. The returned reference may + // become invalid if the value is owned by another object or if ownership is + // transferred to another object in the future. To maintain a reference to the + // value after assigning ownership to a dictionary or list pass this object to + // the set_value() function instead of passing the returned reference to + // set_binary(). + // + pub fn get_binary(&self) -> interfaces::CefBinaryValue { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_binary.unwrap())( + self.c_object)) + } + } + + // + // Returns the underlying value as type dictionary. The returned reference may + // become invalid if the value is owned by another object or if ownership is + // transferred to another object in the future. To maintain a reference to the + // value after assigning ownership to a dictionary or list pass this object to + // the set_value() function instead of passing the returned reference to + // set_dictionary(). + // + pub fn get_dictionary(&self) -> interfaces::CefDictionaryValue { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_dictionary.unwrap())( + self.c_object)) + } + } + + // + // Returns the underlying value as type list. The returned reference may + // become invalid if the value is owned by another object or if ownership is + // transferred to another object in the future. To maintain a reference to the + // value after assigning ownership to a dictionary or list pass this object to + // the set_value() function instead of passing the returned reference to + // set_list(). + // + pub fn get_list(&self) -> interfaces::CefListValue { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_list.unwrap())( + self.c_object)) + } + } + + // + // Sets the underlying value as type null. Returns true (1) if the value was + // set successfully. + // + pub fn set_null(&self) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).set_null.unwrap())( + self.c_object)) + } + } + + // + // Sets the underlying value as type bool. Returns true (1) if the value was + // set successfully. + // + pub fn set_bool(&self, value: libc::c_int) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).set_bool.unwrap())( + self.c_object, + CefWrap::to_c(value))) + } + } + + // + // Sets the underlying value as type int. Returns true (1) if the value was + // set successfully. + // + pub fn set_int(&self, value: libc::c_int) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).set_int.unwrap())( + self.c_object, + CefWrap::to_c(value))) + } + } + + // + // Sets the underlying value as type double. Returns true (1) if the value was + // set successfully. + // + pub fn set_double(&self, value: libc::c_double) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).set_double.unwrap())( + self.c_object, + CefWrap::to_c(value))) + } + } + + // + // Sets the underlying value as type string. Returns true (1) if the value was + // set successfully. + // + pub fn set_string(&self, value: &[u16]) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).set_string.unwrap())( + self.c_object, + CefWrap::to_c(value))) + } + } + + // + // Sets the underlying value as type binary. Returns true (1) if the value was + // set successfully. This object keeps a reference to |value| and ownership of + // the underlying data remains unchanged. + // + pub fn set_binary(&self, value: interfaces::CefBinaryValue) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).set_binary.unwrap())( + self.c_object, + CefWrap::to_c(value))) + } + } + + // + // Sets the underlying value as type dict. Returns true (1) if the value was + // set successfully. This object keeps a reference to |value| and ownership of + // the underlying data remains unchanged. + // + pub fn set_dictionary(&self, + value: interfaces::CefDictionaryValue) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).set_dictionary.unwrap())( + self.c_object, + CefWrap::to_c(value))) + } + } + + // + // Sets the underlying value as type list. Returns true (1) if the value was + // set successfully. This object keeps a reference to |value| and ownership of + // the underlying data remains unchanged. + // + pub fn set_list(&self, value: interfaces::CefListValue) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).set_list.unwrap())( + self.c_object, + CefWrap::to_c(value))) + } + } + + // + // Creates a new object. + // + pub fn create() -> interfaces::CefValue { + unsafe { + CefWrap::to_rust( + ::values::cef_value_create( +)) + } + } +} + +impl CefWrap<*mut cef_value_t> for CefValue { + fn to_c(rust_object: CefValue) -> *mut cef_value_t { + rust_object.c_object_addrefed() + } + unsafe fn to_rust(c_object: *mut cef_value_t) -> CefValue { + CefValue::from_c_object_addref(c_object) + } +} +impl CefWrap<*mut cef_value_t> for Option { + fn to_c(rust_object: Option) -> *mut cef_value_t { + match rust_object { + None => ptr::null_mut(), + Some(rust_object) => rust_object.c_object_addrefed(), + } + } + unsafe fn to_rust(c_object: *mut cef_value_t) -> Option { + if c_object.is_null() { + None + } else { + Some(CefValue::from_c_object_addref(c_object)) + } + } +} + + // // Structure representing a binary value. Can be used on any process and thread. // @@ -56,8 +704,10 @@ pub struct _cef_binary_value_t { pub base: types::cef_base_t, // - // Returns true (1) if this object is valid. Do not call any other functions - // if this function returns false (0). + // Returns true (1) if this object is valid. This object may become invalid if + // the underlying data is owned by another object (e.g. list or dictionary) + // and that other object is then modified or destroyed. Do not call any other + // functions if this function returns false (0). // pub is_valid: Option libc::c_int>, @@ -68,6 +718,20 @@ pub struct _cef_binary_value_t { pub is_owned: Option libc::c_int>, + // + // Returns true (1) if this object and |that| object have the same underlying + // data. + // + pub is_same: Option libc::c_int>, + + // + // Returns true (1) if this object and |that| object have an equivalent + // underlying value but are not necessarily the same object. + // + pub is_equal: Option libc::c_int>, + // // Returns a copy of this object. The data in this object will also be copied. // @@ -169,8 +833,10 @@ impl CefBinaryValue { } // - // Returns true (1) if this object is valid. Do not call any other functions - // if this function returns false (0). + // Returns true (1) if this object is valid. This object may become invalid if + // the underlying data is owned by another object (e.g. list or dictionary) + // and that other object is then modified or destroyed. Do not call any other + // functions if this function returns false (0). // pub fn is_valid(&self) -> libc::c_int { if self.c_object.is_null() { @@ -197,6 +863,38 @@ impl CefBinaryValue { } } + // + // Returns true (1) if this object and |that| object have the same underlying + // data. + // + pub fn is_same(&self, that: interfaces::CefBinaryValue) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).is_same.unwrap())( + self.c_object, + CefWrap::to_c(that))) + } + } + + // + // Returns true (1) if this object and |that| object have an equivalent + // underlying value but are not necessarily the same object. + // + pub fn is_equal(&self, that: interfaces::CefBinaryValue) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).is_equal.unwrap())( + self.c_object, + CefWrap::to_c(that))) + } + } + // // Returns a copy of this object. The data in this object will also be copied. // @@ -296,8 +994,10 @@ pub struct _cef_dictionary_value_t { pub base: types::cef_base_t, // - // Returns true (1) if this object is valid. Do not call any other functions - // if this function returns false (0). + // Returns true (1) if this object is valid. This object may become invalid if + // the underlying data is owned by another object (e.g. list or dictionary) + // and that other object is then modified or destroyed. Do not call any other + // functions if this function returns false (0). // pub is_valid: Option libc::c_int>, @@ -315,6 +1015,21 @@ pub struct _cef_dictionary_value_t { pub is_read_only: Option libc::c_int>, + // + // Returns true (1) if this object and |that| object have the same underlying + // data. If true (1) modifications to this object will also affect |that| + // object and vice-versa. + // + pub is_same: Option libc::c_int>, + + // + // Returns true (1) if this object and |that| object have an equivalent + // underlying value but are not necessarily the same object. + // + pub is_equal: Option libc::c_int>, + // // Returns a writable copy of this object. If |exclude_NULL_children| is true // (1) any NULL dictionaries or lists will be excluded from the copy. @@ -359,6 +1074,16 @@ pub struct _cef_dictionary_value_t { pub get_type: Option interfaces::cef_value_type_t>, + // + // Returns the value at the specified key. For simple types the returned value + // will copy existing data and modifications to the value will not modify this + // object. For complex types (binary, dictionary and list) the returned value + // will reference existing data and modifications to the value will modify + // this object. + // + pub get_value: Option *mut interfaces::cef_value_t>, + // // Returns the value at the specified key as type bool. // @@ -385,23 +1110,40 @@ pub struct _cef_dictionary_value_t { key: *const types::cef_string_t) -> types::cef_string_userfree_t>, // - // Returns the value at the specified key as type binary. + // Returns the value at the specified key as type binary. The returned value + // will reference existing data. // pub get_binary: Option *mut interfaces::cef_binary_value_t>, // - // Returns the value at the specified key as type dictionary. + // Returns the value at the specified key as type dictionary. The returned + // value will reference existing data and modifications to the value will + // modify this object. // pub get_dictionary: Option *mut interfaces::cef_dictionary_value_t>, // - // Returns the value at the specified key as type list. + // Returns the value at the specified key as type list. The returned value + // will reference existing data and modifications to the value will modify + // this object. // pub get_list: Option *mut interfaces::cef_list_value_t>, + // + // Sets the value at the specified key. Returns true (1) if the value was set + // successfully. If |value| represents simple data then the underlying data + // will be copied and modifications to |value| will not modify this object. If + // |value| represents complex data (binary, dictionary or list) then the + // underlying data will be referenced and modifications to |value| will modify + // this object. + // + pub set_value: Option libc::c_int>, + // // Sets the value at the specified key as type null. Returns true (1) if the // value was set successfully. @@ -451,8 +1193,7 @@ pub struct _cef_dictionary_value_t { // // Sets the value at the specified key as type dict. Returns true (1) if the - // value was set successfully. After calling this function the |value| object - // will no longer be valid. If |value| is currently owned by another object + // value was set successfully. If |value| is currently owned by another object // then the value will be copied and the |value| reference will not change. // Otherwise, ownership will be transferred to this object and the |value| // reference will be invalidated. @@ -463,8 +1204,7 @@ pub struct _cef_dictionary_value_t { // // Sets the value at the specified key as type list. Returns true (1) if the - // value was set successfully. After calling this function the |value| object - // will no longer be valid. If |value| is currently owned by another object + // value was set successfully. If |value| is currently owned by another object // then the value will be copied and the |value| reference will not change. // Otherwise, ownership will be transferred to this object and the |value| // reference will be invalidated. @@ -555,8 +1295,10 @@ impl CefDictionaryValue { } // - // Returns true (1) if this object is valid. Do not call any other functions - // if this function returns false (0). + // Returns true (1) if this object is valid. This object may become invalid if + // the underlying data is owned by another object (e.g. list or dictionary) + // and that other object is then modified or destroyed. Do not call any other + // functions if this function returns false (0). // pub fn is_valid(&self) -> libc::c_int { if self.c_object.is_null() { @@ -598,6 +1340,39 @@ impl CefDictionaryValue { } } + // + // Returns true (1) if this object and |that| object have the same underlying + // data. If true (1) modifications to this object will also affect |that| + // object and vice-versa. + // + pub fn is_same(&self, that: interfaces::CefDictionaryValue) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).is_same.unwrap())( + self.c_object, + CefWrap::to_c(that))) + } + } + + // + // Returns true (1) if this object and |that| object have an equivalent + // underlying value but are not necessarily the same object. + // + pub fn is_equal(&self, that: interfaces::CefDictionaryValue) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).is_equal.unwrap())( + self.c_object, + CefWrap::to_c(that))) + } + } + // // Returns a writable copy of this object. If |exclude_NULL_children| is true // (1) any NULL dictionaries or lists will be excluded from the copy. @@ -704,6 +1479,25 @@ impl CefDictionaryValue { } } + // + // Returns the value at the specified key. For simple types the returned value + // will copy existing data and modifications to the value will not modify this + // object. For complex types (binary, dictionary and list) the returned value + // will reference existing data and modifications to the value will modify + // this object. + // + pub fn get_value(&self, key: &[u16]) -> interfaces::CefValue { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_value.unwrap())( + self.c_object, + CefWrap::to_c(key))) + } + } + // // Returns the value at the specified key as type bool. // @@ -766,7 +1560,8 @@ impl CefDictionaryValue { } // - // Returns the value at the specified key as type binary. + // Returns the value at the specified key as type binary. The returned value + // will reference existing data. // pub fn get_binary(&self, key: &[u16]) -> interfaces::CefBinaryValue { if self.c_object.is_null() { @@ -781,7 +1576,9 @@ impl CefDictionaryValue { } // - // Returns the value at the specified key as type dictionary. + // Returns the value at the specified key as type dictionary. The returned + // value will reference existing data and modifications to the value will + // modify this object. // pub fn get_dictionary(&self, key: &[u16]) -> interfaces::CefDictionaryValue { if self.c_object.is_null() { @@ -796,7 +1593,9 @@ impl CefDictionaryValue { } // - // Returns the value at the specified key as type list. + // Returns the value at the specified key as type list. The returned value + // will reference existing data and modifications to the value will modify + // this object. // pub fn get_list(&self, key: &[u16]) -> interfaces::CefListValue { if self.c_object.is_null() { @@ -810,6 +1609,28 @@ impl CefDictionaryValue { } } + // + // Sets the value at the specified key. Returns true (1) if the value was set + // successfully. If |value| represents simple data then the underlying data + // will be copied and modifications to |value| will not modify this object. If + // |value| represents complex data (binary, dictionary or list) then the + // underlying data will be referenced and modifications to |value| will modify + // this object. + // + pub fn set_value(&self, key: &[u16], + value: interfaces::CefValue) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).set_value.unwrap())( + self.c_object, + CefWrap::to_c(key), + CefWrap::to_c(value))) + } + } + // // Sets the value at the specified key as type null. Returns true (1) if the // value was set successfully. @@ -917,8 +1738,7 @@ impl CefDictionaryValue { // // Sets the value at the specified key as type dict. Returns true (1) if the - // value was set successfully. After calling this function the |value| object - // will no longer be valid. If |value| is currently owned by another object + // value was set successfully. If |value| is currently owned by another object // then the value will be copied and the |value| reference will not change. // Otherwise, ownership will be transferred to this object and the |value| // reference will be invalidated. @@ -939,8 +1759,7 @@ impl CefDictionaryValue { // // Sets the value at the specified key as type list. Returns true (1) if the - // value was set successfully. After calling this function the |value| object - // will no longer be valid. If |value| is currently owned by another object + // value was set successfully. If |value| is currently owned by another object // then the value will be copied and the |value| reference will not change. // Otherwise, ownership will be transferred to this object and the |value| // reference will be invalidated. @@ -1007,8 +1826,10 @@ pub struct _cef_list_value_t { pub base: types::cef_base_t, // - // Returns true (1) if this object is valid. Do not call any other functions - // if this function returns false (0). + // Returns true (1) if this object is valid. This object may become invalid if + // the underlying data is owned by another object (e.g. list or dictionary) + // and that other object is then modified or destroyed. Do not call any other + // functions if this function returns false (0). // pub is_valid: Option libc::c_int>, @@ -1026,6 +1847,21 @@ pub struct _cef_list_value_t { pub is_read_only: Option libc::c_int>, + // + // Returns true (1) if this object and |that| object have the same underlying + // data. If true (1) modifications to this object will also affect |that| + // object and vice-versa. + // + pub is_same: Option libc::c_int>, + + // + // Returns true (1) if this object and |that| object have an equivalent + // underlying value but are not necessarily the same object. + // + pub is_equal: Option libc::c_int>, + // // Returns a writable copy of this object. // @@ -1062,6 +1898,16 @@ pub struct _cef_list_value_t { pub get_type: Option interfaces::cef_value_type_t>, + // + // Returns the value at the specified index. For simple types the returned + // value will copy existing data and modifications to the value will not + // modify this object. For complex types (binary, dictionary and list) the + // returned value will reference existing data and modifications to the value + // will modify this object. + // + pub get_value: Option *mut interfaces::cef_value_t>, + // // Returns the value at the specified index as type bool. // @@ -1088,23 +1934,39 @@ pub struct _cef_list_value_t { index: libc::c_int) -> types::cef_string_userfree_t>, // - // Returns the value at the specified index as type binary. + // Returns the value at the specified index as type binary. The returned value + // will reference existing data. // pub get_binary: Option *mut interfaces::cef_binary_value_t>, // - // Returns the value at the specified index as type dictionary. + // Returns the value at the specified index as type dictionary. The returned + // value will reference existing data and modifications to the value will + // modify this object. // pub get_dictionary: Option *mut interfaces::cef_dictionary_value_t>, // - // Returns the value at the specified index as type list. + // Returns the value at the specified index as type list. The returned value + // will reference existing data and modifications to the value will modify + // this object. // pub get_list: Option *mut interfaces::cef_list_value_t>, + // + // Sets the value at the specified index. Returns true (1) if the value was + // set successfully. If |value| represents simple data then the underlying + // data will be copied and modifications to |value| will not modify this + // object. If |value| represents complex data (binary, dictionary or list) + // then the underlying data will be referenced and modifications to |value| + // will modify this object. + // + pub set_value: Option libc::c_int>, + // // Sets the value at the specified index as type null. Returns true (1) if the // value was set successfully. @@ -1142,8 +2004,7 @@ pub struct _cef_list_value_t { // // Sets the value at the specified index as type binary. Returns true (1) if - // the value was set successfully. After calling this function the |value| - // object will no longer be valid. If |value| is currently owned by another + // the value was set successfully. If |value| is currently owned by another // object then the value will be copied and the |value| reference will not // change. Otherwise, ownership will be transferred to this object and the // |value| reference will be invalidated. @@ -1154,8 +2015,7 @@ pub struct _cef_list_value_t { // // Sets the value at the specified index as type dict. Returns true (1) if the - // value was set successfully. After calling this function the |value| object - // will no longer be valid. If |value| is currently owned by another object + // value was set successfully. If |value| is currently owned by another object // then the value will be copied and the |value| reference will not change. // Otherwise, ownership will be transferred to this object and the |value| // reference will be invalidated. @@ -1166,8 +2026,7 @@ pub struct _cef_list_value_t { // // Sets the value at the specified index as type list. Returns true (1) if the - // value was set successfully. After calling this function the |value| object - // will no longer be valid. If |value| is currently owned by another object + // value was set successfully. If |value| is currently owned by another object // then the value will be copied and the |value| reference will not change. // Otherwise, ownership will be transferred to this object and the |value| // reference will be invalidated. @@ -1257,8 +2116,10 @@ impl CefListValue { } // - // Returns true (1) if this object is valid. Do not call any other functions - // if this function returns false (0). + // Returns true (1) if this object is valid. This object may become invalid if + // the underlying data is owned by another object (e.g. list or dictionary) + // and that other object is then modified or destroyed. Do not call any other + // functions if this function returns false (0). // pub fn is_valid(&self) -> libc::c_int { if self.c_object.is_null() { @@ -1300,6 +2161,39 @@ impl CefListValue { } } + // + // Returns true (1) if this object and |that| object have the same underlying + // data. If true (1) modifications to this object will also affect |that| + // object and vice-versa. + // + pub fn is_same(&self, that: interfaces::CefListValue) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).is_same.unwrap())( + self.c_object, + CefWrap::to_c(that))) + } + } + + // + // Returns true (1) if this object and |that| object have an equivalent + // underlying value but are not necessarily the same object. + // + pub fn is_equal(&self, that: interfaces::CefListValue) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).is_equal.unwrap())( + self.c_object, + CefWrap::to_c(that))) + } + } + // // Returns a writable copy of this object. // @@ -1388,6 +2282,25 @@ impl CefListValue { } } + // + // Returns the value at the specified index. For simple types the returned + // value will copy existing data and modifications to the value will not + // modify this object. For complex types (binary, dictionary and list) the + // returned value will reference existing data and modifications to the value + // will modify this object. + // + pub fn get_value(&self, index: libc::c_int) -> interfaces::CefValue { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).get_value.unwrap())( + self.c_object, + CefWrap::to_c(index))) + } + } + // // Returns the value at the specified index as type bool. // @@ -1450,7 +2363,8 @@ impl CefListValue { } // - // Returns the value at the specified index as type binary. + // Returns the value at the specified index as type binary. The returned value + // will reference existing data. // pub fn get_binary(&self, index: libc::c_int) -> interfaces::CefBinaryValue { if self.c_object.is_null() { @@ -1465,7 +2379,9 @@ impl CefListValue { } // - // Returns the value at the specified index as type dictionary. + // Returns the value at the specified index as type dictionary. The returned + // value will reference existing data and modifications to the value will + // modify this object. // pub fn get_dictionary(&self, index: libc::c_int) -> interfaces::CefDictionaryValue { @@ -1481,7 +2397,9 @@ impl CefListValue { } // - // Returns the value at the specified index as type list. + // Returns the value at the specified index as type list. The returned value + // will reference existing data and modifications to the value will modify + // this object. // pub fn get_list(&self, index: libc::c_int) -> interfaces::CefListValue { if self.c_object.is_null() { @@ -1495,6 +2413,28 @@ impl CefListValue { } } + // + // Sets the value at the specified index. Returns true (1) if the value was + // set successfully. If |value| represents simple data then the underlying + // data will be copied and modifications to |value| will not modify this + // object. If |value| represents complex data (binary, dictionary or list) + // then the underlying data will be referenced and modifications to |value| + // will modify this object. + // + pub fn set_value(&self, index: libc::c_int, + value: interfaces::CefValue) -> libc::c_int { + if self.c_object.is_null() { + panic!("called a CEF method on a null object") + } + unsafe { + CefWrap::to_rust( + ((*self.c_object).set_value.unwrap())( + self.c_object, + CefWrap::to_c(index), + CefWrap::to_c(value))) + } + } + // // Sets the value at the specified index as type null. Returns true (1) if the // value was set successfully. @@ -1583,8 +2523,7 @@ impl CefListValue { // // Sets the value at the specified index as type binary. Returns true (1) if - // the value was set successfully. After calling this function the |value| - // object will no longer be valid. If |value| is currently owned by another + // the value was set successfully. If |value| is currently owned by another // object then the value will be copied and the |value| reference will not // change. Otherwise, ownership will be transferred to this object and the // |value| reference will be invalidated. @@ -1605,8 +2544,7 @@ impl CefListValue { // // Sets the value at the specified index as type dict. Returns true (1) if the - // value was set successfully. After calling this function the |value| object - // will no longer be valid. If |value| is currently owned by another object + // value was set successfully. If |value| is currently owned by another object // then the value will be copied and the |value| reference will not change. // Otherwise, ownership will be transferred to this object and the |value| // reference will be invalidated. @@ -1627,8 +2565,7 @@ impl CefListValue { // // Sets the value at the specified index as type list. Returns true (1) if the - // value was set successfully. After calling this function the |value| object - // will no longer be valid. If |value| is currently owned by another object + // value was set successfully. If |value| is currently owned by another object // then the value will be copied and the |value| reference will not change. // Otherwise, ownership will be transferred to this object and the |value| // reference will be invalidated. diff --git a/ports/cef/interfaces/cef_web_plugin.rs b/ports/cef/interfaces/cef_web_plugin.rs index ff13a130624..6d6bd805246 100644 --- a/ports/cef/interfaces/cef_web_plugin.rs +++ b/ports/cef/interfaces/cef_web_plugin.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_xml_reader.rs b/ports/cef/interfaces/cef_xml_reader.rs index ed79167e928..02c85f408e3 100644 --- a/ports/cef/interfaces/cef_xml_reader.rs +++ b/ports/cef/interfaces/cef_xml_reader.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/cef_zip_reader.rs b/ports/cef/interfaces/cef_zip_reader.rs index 15c0527a001..6eb4cd45d8b 100644 --- a/ports/cef/interfaces/cef_zip_reader.rs +++ b/ports/cef/interfaces/cef_zip_reader.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/ports/cef/interfaces/mod.rs b/ports/cef/interfaces/mod.rs index 7080eed9fdd..b4e44335a6a 100644 --- a/ports/cef/interfaces/mod.rs +++ b/ports/cef/interfaces/mod.rs @@ -1,105 +1,71 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +pub use interfaces::cef_app::{CefApp,cef_app_t,}; +pub use interfaces::cef_auth_callback::{CefAuthCallback,cef_auth_callback_t,}; +pub use interfaces::cef_browser_process_handler::{CefBrowserProcessHandler,cef_browser_process_handler_t,}; +pub use interfaces::cef_browser::{CefBrowser,CefRunFileDialogCallback,CefNavigationEntryVisitor,CefBrowserHost,cef_browser_t,cef_run_file_dialog_callback_t,cef_navigation_entry_visitor_t,cef_browser_host_t,}; +pub use interfaces::cef_callback::{CefCallback,CefCompletionCallback,cef_callback_t,cef_completion_callback_t,}; +pub use interfaces::cef_client::{CefClient,cef_client_t,}; +pub use interfaces::cef_command_line::{CefCommandLine,cef_command_line_t,}; +pub use interfaces::cef_context_menu_handler::{CefContextMenuHandler,CefContextMenuParams,cef_context_menu_handler_t,cef_context_menu_params_t,}; +pub use interfaces::cef_cookie::{CefCookieManager,CefCookieVisitor,CefSetCookieCallback,CefDeleteCookiesCallback,cef_cookie_manager_t,cef_cookie_visitor_t,cef_set_cookie_callback_t,cef_delete_cookies_callback_t,}; +pub use interfaces::cef_dialog_handler::{CefFileDialogCallback,CefDialogHandler,cef_file_dialog_callback_t,cef_dialog_handler_t,}; +pub use interfaces::cef_display_handler::{CefDisplayHandler,cef_display_handler_t,}; +pub use interfaces::cef_dom::{CefDOMVisitor,CefDOMDocument,CefDOMNode,cef_domvisitor_t,cef_domdocument_t,cef_domnode_t,}; +pub use interfaces::cef_download_handler::{CefBeforeDownloadCallback,CefDownloadItemCallback,CefDownloadHandler,cef_before_download_callback_t,cef_download_item_callback_t,cef_download_handler_t,}; +pub use interfaces::cef_download_item::{CefDownloadItem,cef_download_item_t,}; +pub use interfaces::cef_drag_data::{CefDragData,cef_drag_data_t,}; +pub use interfaces::cef_drag_handler::{CefDragHandler,cef_drag_handler_t,}; +pub use interfaces::cef_find_handler::{CefFindHandler,cef_find_handler_t,}; +pub use interfaces::cef_focus_handler::{CefFocusHandler,cef_focus_handler_t,}; +pub use interfaces::cef_frame::{CefFrame,cef_frame_t,}; +pub use interfaces::cef_geolocation_handler::{CefGeolocationCallback,CefGeolocationHandler,cef_geolocation_callback_t,cef_geolocation_handler_t,}; +pub use interfaces::cef_geolocation::{CefGetGeolocationCallback,cef_get_geolocation_callback_t,}; +pub use interfaces::cef_jsdialog_handler::{CefJSDialogCallback,CefJSDialogHandler,cef_jsdialog_callback_t,cef_jsdialog_handler_t,}; +pub use interfaces::cef_keyboard_handler::{CefKeyboardHandler,cef_keyboard_handler_t,}; +pub use interfaces::cef_life_span_handler::{CefLifeSpanHandler,cef_life_span_handler_t,}; +pub use interfaces::cef_load_handler::{CefLoadHandler,cef_load_handler_t,}; +pub use interfaces::cef_menu_model::{CefMenuModel,cef_menu_model_t,}; +pub use interfaces::cef_navigation_entry::{CefNavigationEntry,cef_navigation_entry_t,}; +pub use interfaces::cef_origin_whitelist::{}; +pub use interfaces::cef_parser::{}; +pub use interfaces::cef_path_util::{}; +pub use interfaces::cef_print_handler::{CefPrintDialogCallback,CefPrintJobCallback,CefPrintHandler,cef_print_dialog_callback_t,cef_print_job_callback_t,cef_print_handler_t,}; +pub use interfaces::cef_print_settings::{CefPrintSettings,cef_print_settings_t,}; +pub use interfaces::cef_process_message::{CefProcessMessage,cef_process_message_t,}; +pub use interfaces::cef_process_util::{}; +pub use interfaces::cef_render_handler::{CefRenderHandler,cef_render_handler_t,}; +pub use interfaces::cef_render_process_handler::{CefRenderProcessHandler,cef_render_process_handler_t,}; +pub use interfaces::cef_request_context_handler::{CefRequestContextHandler,cef_request_context_handler_t,}; +pub use interfaces::cef_request_context::{CefRequestContext,cef_request_context_t,}; +pub use interfaces::cef_request_handler::{CefRequestCallback,CefRequestHandler,cef_request_callback_t,cef_request_handler_t,}; +pub use interfaces::cef_request::{CefRequest,CefPostData,CefPostDataElement,cef_request_t,cef_post_data_t,cef_post_data_element_t,}; +pub use interfaces::cef_resource_bundle_handler::{CefResourceBundleHandler,cef_resource_bundle_handler_t,}; +pub use interfaces::cef_resource_handler::{CefResourceHandler,cef_resource_handler_t,}; +pub use interfaces::cef_response::{CefResponse,cef_response_t,}; +pub use interfaces::cef_scheme::{CefSchemeRegistrar,CefSchemeHandlerFactory,cef_scheme_registrar_t,cef_scheme_handler_factory_t,}; +pub use interfaces::cef_ssl_info::{CefSSLCertPrincipal,CefSSLInfo,cef_sslcert_principal_t,cef_sslinfo_t,}; +pub use interfaces::cef_stream::{CefReadHandler,CefStreamReader,CefWriteHandler,CefStreamWriter,cef_read_handler_t,cef_stream_reader_t,cef_write_handler_t,cef_stream_writer_t,}; +pub use interfaces::cef_string_visitor::{CefStringVisitor,cef_string_visitor_t,}; +pub use interfaces::cef_task::{CefTask,CefTaskRunner,cef_task_t,cef_task_runner_t,}; +pub use interfaces::cef_trace::{CefEndTracingCallback,cef_end_tracing_callback_t,}; +pub use interfaces::cef_urlrequest::{CefURLRequest,CefURLRequestClient,cef_urlrequest_t,cef_urlrequest_client_t,}; +pub use interfaces::cef_url::{}; +pub use interfaces::cef_v8::{CefV8Context,CefV8Handler,CefV8Accessor,CefV8Exception,CefV8Value,CefV8StackTrace,CefV8StackFrame,cef_v8context_t,cef_v8handler_t,cef_v8accessor_t,cef_v8exception_t,cef_v8value_t,cef_v8stack_trace_t,cef_v8stack_frame_t,}; +pub use interfaces::cef_values::{CefValue,CefBinaryValue,CefDictionaryValue,CefListValue,cef_value_t,cef_binary_value_t,cef_dictionary_value_t,cef_list_value_t,}; +pub use interfaces::cef_web_plugin::{CefWebPluginInfo,CefWebPluginInfoVisitor,CefWebPluginUnstableCallback,cef_web_plugin_info_t,cef_web_plugin_info_visitor_t,cef_web_plugin_unstable_callback_t,}; +pub use interfaces::cef_xml_reader::{CefXmlReader,cef_xml_reader_t,}; +pub use interfaces::cef_zip_reader::{CefZipReader,cef_zip_reader_t,}; +pub use types::{cef_rect_t,cef_window_handle_t,cef_cursor_handle_t,cef_string_t,cef_string_userfree_t,cef_string_utf8_t,cef_string_userfree_utf8_t,cef_string_utf16_t,cef_string_userfree_utf16_t,cef_string_wide_t,cef_string_userfree_wide_t,cef_main_args_t,cef_color_t,cef_mouse_event_t,CefMouseEvent,cef_key_event_t,CefKeyEvent,cef_point_t,CefValueType,CefProcessId,cef_settings_t,cef_base_t,CefBase,cef_window_info_t,CefWindowInfo,cef_time_t,cef_size_t,cef_page_range_t,cef_geoposition_t,CefGeoposition,cef_cookie_t,CefCookie,cef_popup_features_t,CefPopupFeatures,cef_screen_info_t,cef_browser_settings_t,cef_cursor_info_t,cef_request_context_settings_t,cef_string_map_t,cef_string_multimap_t,cef_string_list_t,cef_text_input_context_t,cef_event_handle_t,cef_state_t,cef_thread_id_t,cef_navigation_type_t,cef_mouse_button_type_t,cef_postdataelement_type_t,cef_urlrequest_flags_t,cef_urlrequest_status_t,cef_errorcode_t,cef_key_event_type_t,cef_paint_element_type_t,cef_dom_document_type_t,cef_file_dialog_mode_t,cef_value_type_t,cef_process_id_t,cef_log_severity_t,cef_menu_item_type_t,cef_context_menu_type_flags_t,cef_context_menu_media_type_t,cef_context_menu_media_state_flags_t,cef_context_menu_edit_state_flags_t,cef_event_flags_t,cef_dom_event_phase_t,cef_dom_node_type_t,cef_focus_source_t,cef_jsdialog_type_t,cef_duplex_mode_t,cef_color_model_t,cef_resource_type_t,cef_transition_type_t,cef_termination_status_t,cef_v8_accesscontrol_t,cef_v8_propertyattribute_t,cef_xml_node_type_t,cef_geoposition_error_code_t,cef_drag_operations_mask_t,cef_xml_encoding_type_t,cef_window_open_disposition_t,cef_cursor_type_t,cef_return_value_t,}; +pub use types::CefScreenInfo as CefScreenInfo; +pub use types::CefBrowserSettings as CefBrowserSettings; +pub use types::CefCursorInfo as CefCursorInfo; +pub use types::CefRequestContextSettings as CefRequestContextSettings; -//! This file is currently *not* autogenerated, but maybe it should be. (It's a little complicated -//! because we need to reexport a bunch of types in `types.rs`.) -pub use interfaces::cef_app::{CefApp, cef_app_t}; -pub use interfaces::cef_auth_callback::{CefAuthCallback, cef_auth_callback_t}; -pub use interfaces::cef_browser::{CefBrowser, CefBrowserHost, CefRunFileDialogCallback}; -pub use interfaces::cef_browser::{cef_browser_host_t, cef_browser_t}; -pub use interfaces::cef_browser::{cef_run_file_dialog_callback_t}; -pub use interfaces::cef_browser_process_handler::{CefBrowserProcessHandler}; -pub use interfaces::cef_browser_process_handler::{cef_browser_process_handler_t}; -pub use interfaces::cef_callback::{CefCallback, CefCompletionCallback, cef_callback_t}; -pub use interfaces::cef_callback::{cef_completion_callback_t}; -pub use interfaces::cef_client::{CefClient, cef_client_t}; -pub use interfaces::cef_command_line::{CefCommandLine, cef_command_line_t}; -pub use interfaces::cef_context_menu_handler::{CefContextMenuHandler, CefContextMenuParams}; -pub use interfaces::cef_context_menu_handler::{cef_context_menu_handler_t}; -pub use interfaces::cef_context_menu_handler::{cef_context_menu_params_t}; -pub use interfaces::cef_cookie::{CefCookieManager, CefCookieVisitor, cef_cookie_manager_t}; -pub use interfaces::cef_cookie::{cef_cookie_visitor_t}; -pub use interfaces::cef_dialog_handler::{CefDialogHandler, CefFileDialogCallback}; -pub use interfaces::cef_dialog_handler::{cef_dialog_handler_t, cef_file_dialog_callback_t}; -pub use interfaces::cef_display_handler::{CefDisplayHandler, cef_display_handler_t}; -pub use interfaces::cef_dom::{CefDOMDocument, CefDOMNode, CefDOMVisitor, cef_domdocument_t}; -pub use interfaces::cef_dom::{cef_domnode_t, cef_domvisitor_t}; -pub use interfaces::cef_download_handler::{CefBeforeDownloadCallback, CefDownloadHandler}; -pub use interfaces::cef_download_handler::{CefDownloadItemCallback}; -pub use interfaces::cef_download_handler::{cef_before_download_callback_t}; -pub use interfaces::cef_download_handler::{cef_download_handler_t, cef_download_item_callback_t}; -pub use interfaces::cef_download_item::{CefDownloadItem, cef_download_item_t}; -pub use interfaces::cef_drag_data::{CefDragData, cef_drag_data_t}; -pub use interfaces::cef_drag_handler::{CefDragHandler, cef_drag_handler_t}; -pub use interfaces::cef_focus_handler::{CefFocusHandler, cef_focus_handler_t}; -pub use interfaces::cef_frame::{CefFrame, cef_frame_t}; -pub use interfaces::cef_geolocation::{CefGetGeolocationCallback, cef_get_geolocation_callback_t}; -pub use interfaces::cef_geolocation_handler::{CefGeolocationCallback, CefGeolocationHandler}; -pub use interfaces::cef_geolocation_handler::{cef_geolocation_callback_t}; -pub use interfaces::cef_geolocation_handler::{cef_geolocation_handler_t}; -pub use interfaces::cef_jsdialog_handler::{CefJSDialogCallback, CefJSDialogHandler}; -pub use interfaces::cef_jsdialog_handler::{cef_jsdialog_callback_t, cef_jsdialog_handler_t}; -pub use interfaces::cef_keyboard_handler::{CefKeyboardHandler, cef_keyboard_handler_t}; -pub use interfaces::cef_life_span_handler::{CefLifeSpanHandler, cef_life_span_handler_t}; -pub use interfaces::cef_load_handler::{CefLoadHandler, cef_load_handler_t}; -pub use interfaces::cef_menu_model::{CefMenuModel, cef_menu_model_t}; -pub use interfaces::cef_print_handler::{CefPrintDialogCallback, CefPrintHandler}; -pub use interfaces::cef_print_handler::{CefPrintJobCallback, cef_print_dialog_callback_t}; -pub use interfaces::cef_print_handler::{cef_print_handler_t, cef_print_job_callback_t}; -pub use interfaces::cef_print_settings::{CefPrintSettings, cef_print_settings_t}; -pub use interfaces::cef_process_message::{CefProcessMessage, cef_process_message_t}; -pub use interfaces::cef_render_handler::{CefRenderHandler, cef_render_handler_t}; -pub use interfaces::cef_render_process_handler::{CefRenderProcessHandler}; -pub use interfaces::cef_render_process_handler::{cef_render_process_handler_t}; -pub use interfaces::cef_request::{CefPostData, CefPostDataElement, CefRequest}; -pub use interfaces::cef_request::{cef_post_data_element_t, cef_post_data_t, cef_request_t}; -pub use interfaces::cef_request_context::{CefRequestContext, cef_request_context_t}; -pub use interfaces::cef_request_context_handler::{CefRequestContextHandler}; -pub use interfaces::cef_request_context_handler::{cef_request_context_handler_t}; -pub use interfaces::cef_request_handler::{CefAllowCertificateErrorCallback, CefQuotaCallback}; -pub use interfaces::cef_request_handler::{CefRequestHandler}; -pub use interfaces::cef_request_handler::{cef_allow_certificate_error_callback_t}; -pub use interfaces::cef_request_handler::{cef_quota_callback_t, cef_request_handler_t}; -pub use interfaces::cef_resource_bundle_handler::{CefResourceBundleHandler}; -pub use interfaces::cef_resource_bundle_handler::{cef_resource_bundle_handler_t}; -pub use interfaces::cef_resource_handler::{CefResourceHandler, cef_resource_handler_t}; -pub use interfaces::cef_response::{CefResponse, cef_response_t}; -pub use interfaces::cef_scheme::{CefSchemeHandlerFactory, CefSchemeRegistrar}; -pub use interfaces::cef_scheme::{cef_scheme_handler_factory_t, cef_scheme_registrar_t}; -pub use interfaces::cef_stream::{CefReadHandler, CefStreamReader, CefStreamWriter}; -pub use interfaces::cef_stream::{CefWriteHandler, cef_read_handler_t, cef_stream_reader_t}; -pub use interfaces::cef_stream::{cef_stream_writer_t, cef_write_handler_t}; -pub use interfaces::cef_string_visitor::{CefStringVisitor, cef_string_visitor_t}; -pub use interfaces::cef_task::{CefTask, CefTaskRunner, cef_task_runner_t, cef_task_t}; -pub use interfaces::cef_trace::{CefEndTracingCallback, cef_end_tracing_callback_t}; -pub use interfaces::cef_urlrequest::{CefURLRequest, CefURLRequestClient, cef_urlrequest_client_t}; -pub use interfaces::cef_urlrequest::{cef_urlrequest_t}; -pub use interfaces::cef_v8::{CefV8Accessor, CefV8Context, CefV8Exception, CefV8Handler}; -pub use interfaces::cef_v8::{CefV8StackFrame, CefV8StackTrace, CefV8Value, cef_v8accessor_t}; -pub use interfaces::cef_v8::{cef_v8context_t, cef_v8exception_t, cef_v8handler_t}; -pub use interfaces::cef_v8::{cef_v8stack_frame_t, cef_v8stack_trace_t, cef_v8value_t}; -pub use interfaces::cef_values::{CefBinaryValue, CefDictionaryValue, CefListValue}; -pub use interfaces::cef_values::{cef_binary_value_t, cef_dictionary_value_t, cef_list_value_t}; -pub use interfaces::cef_web_plugin::{CefWebPluginInfo, CefWebPluginInfoVisitor}; -pub use interfaces::cef_web_plugin::{CefWebPluginUnstableCallback, cef_web_plugin_info_t}; -pub use interfaces::cef_web_plugin::{cef_web_plugin_info_visitor_t}; -pub use interfaces::cef_web_plugin::{cef_web_plugin_unstable_callback_t}; -pub use interfaces::cef_xml_reader::{CefXmlReader, cef_xml_reader_t}; -pub use interfaces::cef_zip_reader::{CefZipReader, cef_zip_reader_t}; -pub use types::{CefBase, CefBrowserSettings, CefCookie, CefGeoposition, CefKeyEvent}; -pub use types::{CefMouseEvent, CefPopupFeatures, CefProcessId, CefScreenInfo}; -pub use types::{CefValueType, CefWindowInfo, cef_base_t}; -pub use types::{cef_browser_settings_t, cef_cookie_t, cef_geoposition_t, cef_key_event_t}; -pub use types::{cef_mouse_event_t, cef_point_t, cef_popup_features_t}; -pub use types::{cef_process_id_t, cef_screen_info_t, cef_string_map_t}; -pub use types::{cef_time_t, cef_value_type_t, cef_window_info_t}; pub mod cef_app; pub mod cef_auth_callback; -pub mod cef_browser; pub mod cef_browser_process_handler; +pub mod cef_browser; pub mod cef_callback; pub mod cef_client; pub mod cef_command_line; @@ -112,37 +78,43 @@ pub mod cef_download_handler; pub mod cef_download_item; pub mod cef_drag_data; pub mod cef_drag_handler; +pub mod cef_find_handler; pub mod cef_focus_handler; pub mod cef_frame; -pub mod cef_geolocation; pub mod cef_geolocation_handler; +pub mod cef_geolocation; pub mod cef_jsdialog_handler; pub mod cef_keyboard_handler; pub mod cef_life_span_handler; pub mod cef_load_handler; pub mod cef_menu_model; +pub mod cef_navigation_entry; +pub mod cef_origin_whitelist; +pub mod cef_parser; +pub mod cef_path_util; pub mod cef_print_handler; pub mod cef_print_settings; pub mod cef_process_message; +pub mod cef_process_util; pub mod cef_render_handler; pub mod cef_render_process_handler; -pub mod cef_request; -pub mod cef_request_context; pub mod cef_request_context_handler; +pub mod cef_request_context; pub mod cef_request_handler; +pub mod cef_request; pub mod cef_resource_bundle_handler; pub mod cef_resource_handler; pub mod cef_response; pub mod cef_scheme; +pub mod cef_ssl_info; pub mod cef_stream; pub mod cef_string_visitor; pub mod cef_task; pub mod cef_trace; pub mod cef_urlrequest; +pub mod cef_url; pub mod cef_v8; pub mod cef_values; pub mod cef_web_plugin; pub mod cef_xml_reader; pub mod cef_zip_reader; - - diff --git a/ports/cef/wrappers.rs b/ports/cef/wrappers.rs index 0ac8b5f668b..edeb664e2e5 100644 --- a/ports/cef/wrappers.rs +++ b/ports/cef/wrappers.rs @@ -4,32 +4,34 @@ use interfaces::{cef_drag_data_t, cef_post_data_element_t, cef_v8value_t, CefPostDataElement}; use interfaces::{CefV8Value}; +use interfaces::{cef_download_handler_t, cef_drag_handler_t, cef_context_menu_handler_t}; +use interfaces::{cef_dialog_handler_t, cef_focus_handler_t}; +use interfaces::{cef_load_handler_t, cef_request_handler_t}; +use interfaces::{cef_geolocation_handler_t, cef_jsdialog_handler_t, cef_keyboard_handler_t}; use rustc_unicode::str::Utf16Encoder; -use types::{cef_base_t, cef_browser_settings_t, cef_color_model_t}; -use types::{cef_context_menu_edit_state_flags_t, cef_context_menu_handler_t}; +use types::{cef_base_t, cef_browser_settings_t, CefBrowserSettings, cef_color_model_t}; +use types::{cef_context_menu_edit_state_flags_t}; use types::{cef_context_menu_media_state_flags_t}; -use types::{cef_context_menu_media_type_t, cef_context_menu_type_flags_t, cef_cookie_t}; -use types::{cef_dialog_handler_t}; +use types::{cef_context_menu_media_type_t, cef_context_menu_type_flags_t, cef_cookie_t, cef_cursor_info_t, CefCursorInfo, cef_cursor_type_t}; use types::{cef_dom_document_type_t, cef_dom_node_type_t}; -use types::{cef_download_handler_t, cef_drag_handler_t}; use types::{cef_drag_operations_mask_t, cef_duplex_mode_t}; use types::{cef_errorcode_t, cef_event_flags_t, cef_event_handle_t}; -use types::{cef_file_dialog_mode_t, cef_focus_handler_t, cef_focus_source_t}; -use types::{cef_geolocation_handler_t, cef_geoposition_t}; -use types::{cef_jsdialog_handler_t, cef_jsdialog_type_t}; -use types::{cef_key_event, cef_keyboard_handler_t}; -use types::{cef_load_handler_t, cef_menu_item_type_t, cef_mouse_button_type_t}; +use types::{cef_file_dialog_mode_t, cef_focus_source_t}; +use types::{cef_geoposition_t}; +use types::{cef_jsdialog_type_t}; +use types::{cef_key_event}; +use types::{cef_menu_item_type_t, cef_mouse_button_type_t}; use types::{cef_mouse_event, cef_navigation_type_t}; use types::{cef_page_range_t, cef_paint_element_type_t, cef_point_t, cef_postdataelement_type_t}; use types::{cef_popup_features_t, cef_process_id_t}; -use types::{cef_rect_t, cef_request_handler_t}; -use types::{cef_resource_type_t}; -use types::{cef_screen_info_t, cef_size_t, cef_string_t, cef_string_userfree_t}; +use types::{cef_rect_t, cef_request_context_settings_t, CefRequestContextSettings}; +use types::{cef_resource_type_t, cef_return_value_t}; +use types::{cef_screen_info_t, CefScreenInfo, cef_size_t, cef_string_t, cef_string_userfree_t}; use types::{cef_string_list_t, cef_string_map_t, cef_string_multimap_t, cef_string_utf16}; use types::{cef_termination_status_t, cef_text_input_context_t, cef_thread_id_t}; use types::{cef_time_t, cef_transition_type_t, cef_urlrequest_status_t}; use types::{cef_v8_accesscontrol_t, cef_v8_propertyattribute_t, cef_value_type_t}; -use types::{cef_window_info_t, cef_xml_encoding_type_t, cef_xml_node_type_t}; +use types::{cef_window_info_t, cef_window_open_disposition_t, cef_xml_encoding_type_t, cef_xml_node_type_t}; use libc::{self, c_char, c_int, c_ushort, c_void}; use std::boxed; @@ -99,6 +101,7 @@ cef_pointer_wrapper!(c_void); cef_pointer_wrapper!(cef_base_t); cef_pointer_wrapper!(cef_browser_settings_t); cef_pointer_wrapper!(cef_cookie_t); +cef_pointer_wrapper!(cef_cursor_info_t); cef_pointer_wrapper!(cef_geoposition_t); cef_pointer_wrapper!(cef_key_event); cef_pointer_wrapper!(cef_mouse_event); @@ -106,6 +109,7 @@ cef_pointer_wrapper!(cef_page_range_t); cef_pointer_wrapper!(cef_point_t); cef_pointer_wrapper!(cef_popup_features_t); cef_pointer_wrapper!(cef_rect_t); +cef_pointer_wrapper!(cef_request_context_settings_t); cef_pointer_wrapper!(cef_screen_info_t); cef_pointer_wrapper!(cef_size_t); cef_pointer_wrapper!(cef_time_t); @@ -133,11 +137,16 @@ 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!(CefBrowserSettings); +cef_noop_wrapper!(CefScreenInfo); +cef_noop_wrapper!(CefRequestContextSettings); +cef_noop_wrapper!(CefCursorInfo); cef_noop_wrapper!(cef_color_model_t); cef_noop_wrapper!(cef_context_menu_edit_state_flags_t); cef_noop_wrapper!(cef_context_menu_media_state_flags_t); cef_noop_wrapper!(cef_context_menu_media_type_t); cef_noop_wrapper!(cef_context_menu_type_flags_t); +cef_noop_wrapper!(cef_cursor_type_t); cef_noop_wrapper!(cef_dom_document_type_t); cef_noop_wrapper!(cef_dom_node_type_t); cef_noop_wrapper!(cef_drag_operations_mask_t); @@ -157,6 +166,7 @@ cef_noop_wrapper!(cef_paint_element_type_t); cef_noop_wrapper!(cef_postdataelement_type_t); cef_noop_wrapper!(cef_process_id_t); cef_noop_wrapper!(cef_resource_type_t); +cef_noop_wrapper!(cef_return_value_t); cef_noop_wrapper!(cef_termination_status_t); cef_noop_wrapper!(cef_text_input_context_t); cef_noop_wrapper!(cef_thread_id_t); @@ -166,6 +176,7 @@ cef_noop_wrapper!(cef_urlrequest_status_t); cef_noop_wrapper!(cef_v8_accesscontrol_t); cef_noop_wrapper!(cef_v8_propertyattribute_t); cef_noop_wrapper!(cef_value_type_t); +cef_noop_wrapper!(cef_window_open_disposition_t); cef_noop_wrapper!(cef_xml_encoding_type_t); cef_noop_wrapper!(cef_xml_node_type_t); cef_noop_wrapper!(f64);