mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
update cef embedding interfaces to latest cef
This commit is contained in:
parent
49aed6555d
commit
4679fc77b0
57 changed files with 3731 additions and 738 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<extern "C" fn(this: *mut cef_run_file_dialog_callback_t,
|
||||
browser_host: *mut interfaces::cef_browser_host_t,
|
||||
pub on_file_dialog_dismissed: Option<extern "C" fn(
|
||||
this: *mut cef_run_file_dialog_callback_t,
|
||||
selected_accept_filter: libc::c_int,
|
||||
file_paths: types::cef_string_list_t) -> ()>,
|
||||
|
||||
//
|
||||
|
@ -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<String>) -> () {
|
||||
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<CefRunFileDialogCal
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// Callback structure for cef_browser_host_t::GetNavigationEntries. The
|
||||
// functions of this structure will be called on the browser process UI thread.
|
||||
//
|
||||
#[repr(C)]
|
||||
pub struct _cef_navigation_entry_visitor_t {
|
||||
//
|
||||
// Base structure.
|
||||
//
|
||||
pub base: types::cef_base_t,
|
||||
|
||||
//
|
||||
// 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 visit: Option<extern "C" fn(this: *mut cef_navigation_entry_visitor_t,
|
||||
entry: *mut interfaces::cef_navigation_entry_t, current: libc::c_int,
|
||||
index: libc::c_int, total: libc::c_int) -> 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<CefNavigationEntryVisitor> {
|
||||
fn to_c(rust_object: Option<CefNavigationEntryVisitor>) -> *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<CefNavigationEntryVisitor> {
|
||||
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<extern "C" fn(this: *mut cef_browser_host_t,
|
||||
mode: types::cef_file_dialog_mode_t, title: *const types::cef_string_t,
|
||||
default_file_name: *const types::cef_string_t,
|
||||
accept_types: types::cef_string_list_t,
|
||||
default_file_path: *const types::cef_string_t,
|
||||
accept_filters: types::cef_string_list_t,
|
||||
selected_accept_filter: libc::c_int,
|
||||
callback: *mut interfaces::cef_run_file_dialog_callback_t) -> ()>,
|
||||
|
||||
//
|
||||
|
@ -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<extern "C" fn(this: *mut cef_browser_host_t,
|
||||
identifier: libc::c_int, searchText: *const types::cef_string_t,
|
||||
|
@ -897,6 +1059,18 @@ pub struct _cef_browser_host_t {
|
|||
pub close_dev_tools: Option<extern "C" fn(this: *mut cef_browser_host_t) -> (
|
||||
)>,
|
||||
|
||||
//
|
||||
// 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<extern "C" fn(
|
||||
this: *mut cef_browser_host_t,
|
||||
visitor: *mut interfaces::cef_navigation_entry_visitor_t,
|
||||
current_only: libc::c_int) -> ()>,
|
||||
|
||||
//
|
||||
// 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<extern "C" fn(this: *mut cef_browser_host_t,
|
||||
|
@ -1101,7 +1275,7 @@ pub struct _cef_browser_host_t {
|
|||
// 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 drag_source_system_drag_ended: Option<extern "C" fn(
|
||||
|
@ -1359,16 +1533,21 @@ impl CefBrowserHost {
|
|||
// 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 fn run_file_dialog(&self, mode: types::cef_file_dialog_mode_t,
|
||||
title: &[u16], default_file_name: &[u16], accept_types: Vec<String>,
|
||||
title: &[u16], default_file_path: &[u16], accept_filters: Vec<String>,
|
||||
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) -> () {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<extern "C" fn(
|
||||
this: *mut cef_client_t) -> *mut interfaces::cef_drag_handler_t>,
|
||||
|
||||
//
|
||||
// Return the handler for find result events.
|
||||
//
|
||||
pub get_find_handler: Option<extern "C" fn(
|
||||
this: *mut cef_client_t) -> *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.
|
||||
//
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<CefContextMenuHandler>
|
|||
|
||||
|
||||
//
|
||||
// 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<extern "C" fn(
|
||||
this: *mut cef_context_menu_params_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_context_menu_params_t) -> 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
|
||||
|
|
|
@ -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<extern "C" fn(
|
||||
this: *mut cef_cookie_manager_t, schemes: types::cef_string_list_t) -> (
|
||||
)>,
|
||||
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<extern "C" fn(this: *mut cef_cookie_manager_t,
|
||||
visitor: *mut interfaces::cef_cookie_visitor_t) -> 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<extern "C" fn(this: *mut cef_cookie_manager_t,
|
||||
url: *const types::cef_string_t, includeHttpOnly: libc::c_int,
|
||||
|
@ -87,26 +89,29 @@ pub struct _cef_cookie_manager_t {
|
|||
// 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 set_cookie: Option<extern "C" fn(this: *mut cef_cookie_manager_t,
|
||||
url: *const types::cef_string_t,
|
||||
cookie: *const interfaces::cef_cookie_t) -> 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<extern "C" fn(this: *mut cef_cookie_manager_t,
|
||||
url: *const types::cef_string_t,
|
||||
cookie_name: *const types::cef_string_t) -> 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<extern "C" fn(this: *mut cef_cookie_manager_t,
|
||||
path: *const types::cef_string_t,
|
||||
persist_session_cookies: libc::c_int) -> 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<extern "C" fn(this: *mut cef_cookie_manager_t,
|
||||
callback: *mut interfaces::cef_completion_callback_t) -> 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<String>) -> () {
|
||||
pub fn set_supported_schemes(&self, schemes: Vec<String>,
|
||||
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<CefCookieVisitor> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 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<extern "C" fn(this: *mut cef_set_cookie_callback_t,
|
||||
success: 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_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<CefSetCookieCallback> {
|
||||
fn to_c(rust_object: Option<CefSetCookieCallback>) -> *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<CefSetCookieCallback> {
|
||||
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<extern "C" fn(
|
||||
this: *mut cef_delete_cookies_callback_t, num_deleted: 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_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<CefDeleteCookiesCallback> {
|
||||
fn to_c(rust_object: Option<CefDeleteCookiesCallback>) -> *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<CefDeleteCookiesCallback> {
|
||||
if c_object.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(CefDeleteCookiesCallback::from_c_object_addref(c_object))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<extern "C" fn(this: *mut cef_file_dialog_callback_t,
|
||||
selected_accept_filter: libc::c_int,
|
||||
file_paths: types::cef_string_list_t) -> ()>,
|
||||
|
||||
//
|
||||
|
@ -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<String>) -> () {
|
||||
pub fn cont(&self, selected_accept_filter: libc::c_int,
|
||||
file_paths: Vec<String>) -> () {
|
||||
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<extern "C" fn(this: *mut cef_dialog_handler_t,
|
||||
browser: *mut interfaces::cef_browser_t,
|
||||
mode: types::cef_file_dialog_mode_t, title: *const types::cef_string_t,
|
||||
default_file_name: *const types::cef_string_t,
|
||||
accept_types: types::cef_string_list_t,
|
||||
default_file_path: *const types::cef_string_t,
|
||||
accept_filters: types::cef_string_list_t,
|
||||
selected_accept_filter: libc::c_int,
|
||||
callback: *mut interfaces::cef_file_dialog_callback_t) -> libc::c_int>,
|
||||
|
||||
//
|
||||
|
@ -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<String>,
|
||||
default_file_path: &[u16], accept_filters: Vec<String>,
|
||||
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)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<extern "C" fn(
|
||||
this: *mut cef_display_handler_t, browser: *mut interfaces::cef_browser_t,
|
||||
icon_urls: types::cef_string_list_t) -> ()>,
|
||||
|
||||
//
|
||||
// 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<String>) -> () {
|
||||
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
|
||||
|
|
|
@ -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<extern "C" fn(
|
||||
this: *mut cef_domdocument_t) -> libc::c_int>,
|
||||
|
||||
//
|
||||
// Returns the selection start node.
|
||||
//
|
||||
pub get_selection_start_node: Option<extern "C" fn(
|
||||
this: *mut cef_domdocument_t) -> *mut interfaces::cef_domnode_t>,
|
||||
|
||||
//
|
||||
// Returns the selection offset within the start node.
|
||||
//
|
||||
pub get_selection_start_offset: Option<extern "C" fn(
|
||||
this: *mut cef_domdocument_t) -> libc::c_int>,
|
||||
|
||||
//
|
||||
// Returns the selection end node.
|
||||
//
|
||||
pub get_selection_end_node: Option<extern "C" fn(
|
||||
this: *mut cef_domdocument_t) -> *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.
|
||||
//
|
||||
|
|
|
@ -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<extern "C" fn(this: *mut cef_download_item_callback_t) -> (
|
||||
)>,
|
||||
|
||||
//
|
||||
// Call to pause the download.
|
||||
//
|
||||
pub pause: Option<extern "C" fn(this: *mut cef_download_item_callback_t) -> (
|
||||
)>,
|
||||
|
||||
//
|
||||
// Call to resume the download.
|
||||
//
|
||||
pub resume: Option<extern "C" fn(this: *mut cef_download_item_callback_t) -> (
|
||||
)>,
|
||||
|
||||
//
|
||||
// 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 {
|
||||
|
|
|
@ -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<extern "C" fn(
|
||||
this: *mut cef_download_item_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_download_item_t) -> 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.
|
||||
//
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
205
ports/cef/interfaces/cef_find_handler.rs
Normal file
205
ports/cef/interfaces/cef_find_handler.rs
Normal file
|
@ -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<extern "C" fn(this: *mut cef_find_handler_t,
|
||||
browser: *mut interfaces::cef_browser_t, identifier: libc::c_int,
|
||||
count: libc::c_int, selectionRect: *const types::cef_rect_t,
|
||||
activeMatchOrdinal: libc::c_int, finalUpdate: 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_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<CefFindHandler> {
|
||||
fn to_c(rust_object: Option<CefFindHandler>) -> *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<CefFindHandler> {
|
||||
if c_object.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(CefFindHandler::from_c_object_addref(c_object))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<extern "C" fn(this: *mut cef_life_span_handler_t,
|
||||
browser: *mut interfaces::cef_browser_t,
|
||||
frame: *mut interfaces::cef_frame_t,
|
||||
target_url: *const types::cef_string_t,
|
||||
target_frame_name: *const types::cef_string_t,
|
||||
target_disposition: types::cef_window_open_disposition_t,
|
||||
user_gesture: libc::c_int,
|
||||
popupFeatures: *const interfaces::cef_popup_features_t,
|
||||
windowInfo: *mut interfaces::cef_window_info_t,
|
||||
client: *mut interfaces::cef_client_t,
|
||||
|
@ -95,7 +102,7 @@ pub struct _cef_life_span_handler_t {
|
|||
browser: *mut interfaces::cef_browser_t) -> 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
388
ports/cef/interfaces/cef_navigation_entry.rs
Normal file
388
ports/cef/interfaces/cef_navigation_entry.rs
Normal file
|
@ -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<extern "C" fn(
|
||||
this: *mut cef_navigation_entry_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_navigation_entry_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_navigation_entry_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_navigation_entry_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_navigation_entry_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_navigation_entry_t) -> types::cef_transition_type_t>,
|
||||
|
||||
//
|
||||
// Returns true (1) if this navigation includes post data.
|
||||
//
|
||||
pub has_post_data: Option<extern "C" fn(
|
||||
this: *mut cef_navigation_entry_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_navigation_entry_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_navigation_entry_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_navigation_entry_t) -> 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<CefNavigationEntry> {
|
||||
fn to_c(rust_object: Option<CefNavigationEntry>) -> *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<CefNavigationEntry> {
|
||||
if c_object.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(CefNavigationEntry::from_c_object_addref(c_object))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
ports/cef/interfaces/cef_parser.rs
Normal file
46
ports/cef/interfaces/cef_parser.rs
Normal file
|
@ -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;
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<extern "C" fn(this: *mut cef_render_handler_t,
|
||||
browser: *mut interfaces::cef_browser_t,
|
||||
rect: *const types::cef_rect_t) -> ()>,
|
||||
|
||||
//
|
||||
// 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<extern "C" fn(this: *mut cef_render_handler_t,
|
||||
browser: *mut interfaces::cef_browser_t,
|
||||
|
@ -123,16 +126,19 @@ pub struct _cef_render_handler_t {
|
|||
width: libc::c_int, height: libc::c_int) -> ()>,
|
||||
|
||||
//
|
||||
// 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<extern "C" fn(this: *mut cef_render_handler_t,
|
||||
browser: *mut interfaces::cef_browser_t,
|
||||
cursor: types::cef_cursor_handle_t) -> ()>,
|
||||
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<extern "C" fn(
|
||||
this: *mut cef_render_handler_t,
|
||||
browser: *mut interfaces::cef_browser_t) -> ()>,
|
||||
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)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<extern "C" fn(
|
||||
this: *mut cef_request_t) -> 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<extern "C" fn(this: *mut cef_request_t) -> 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.
|
||||
//
|
||||
|
|
|
@ -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<extern "C" fn(this: *mut cef_request_context_t,
|
||||
other: *mut interfaces::cef_request_context_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_request_context_t) -> libc::c_int>,
|
||||
|
@ -86,6 +96,51 @@ pub struct _cef_request_context_t {
|
|||
pub get_handler: Option<extern "C" fn(
|
||||
this: *mut cef_request_context_t) -> *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<extern "C" fn(
|
||||
this: *mut cef_request_context_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_request_context_t,
|
||||
callback: *mut interfaces::cef_completion_callback_t) -> *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<extern "C" fn(
|
||||
this: *mut cef_request_context_t, scheme_name: *const types::cef_string_t,
|
||||
domain_name: *const types::cef_string_t,
|
||||
factory: *mut interfaces::cef_scheme_handler_factory_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_request_context_t) -> 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)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<extern "C" fn(
|
||||
this: *mut cef_request_context_handler_t) -> *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() {
|
||||
|
|
|
@ -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<extern "C" fn(this: *mut cef_quota_callback_t,
|
||||
pub cont: Option<extern "C" fn(this: *mut cef_request_callback_t,
|
||||
allow: libc::c_int) -> ()>,
|
||||
|
||||
//
|
||||
// Cancel the quota request.
|
||||
// Cancel the url request.
|
||||
//
|
||||
pub cancel: Option<extern "C" fn(this: *mut cef_quota_callback_t) -> ()>,
|
||||
pub cancel: Option<extern "C" fn(this: *mut cef_request_callback_t) -> ()>,
|
||||
|
||||
//
|
||||
// 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<CefQuotaCallback> {
|
||||
fn to_c(rust_object: Option<CefQuotaCallback>) -> *mut cef_quota_callback_t {
|
||||
impl CefWrap<*mut cef_request_callback_t> for Option<CefRequestCallback> {
|
||||
fn to_c(rust_object: Option<CefRequestCallback>) -> *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<CefQuotaCallback> {
|
||||
unsafe fn to_rust(c_object: *mut cef_request_callback_t) -> Option<CefRequestCallback> {
|
||||
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<extern "C" fn(
|
||||
this: *mut cef_allow_certificate_error_callback_t,
|
||||
allow: 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_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<CefAllowCertificateErrorCallback> {
|
||||
fn to_c(rust_object: Option<CefAllowCertificateErrorCallback>) -> *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<CefAllowCertificateErrorCallback> {
|
||||
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<extern "C" fn(
|
||||
this: *mut cef_request_handler_t, browser: *mut interfaces::cef_browser_t,
|
||||
frame: *mut interfaces::cef_frame_t,
|
||||
target_url: *const types::cef_string_t,
|
||||
target_disposition: types::cef_window_open_disposition_t,
|
||||
user_gesture: libc::c_int) -> 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<extern "C" fn(
|
||||
this: *mut cef_request_handler_t, browser: *mut interfaces::cef_browser_t,
|
||||
frame: *mut interfaces::cef_frame_t,
|
||||
request: *mut interfaces::cef_request_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_request_handler_t, browser: *mut interfaces::cef_browser_t,
|
||||
frame: *mut interfaces::cef_frame_t, old_url: *const types::cef_string_t,
|
||||
frame: *mut interfaces::cef_frame_t,
|
||||
request: *mut interfaces::cef_request_t,
|
||||
new_url: *mut types::cef_string_t) -> ()>,
|
||||
|
||||
//
|
||||
// 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<extern "C" fn(
|
||||
this: *mut cef_request_handler_t, browser: *mut interfaces::cef_browser_t,
|
||||
frame: *mut interfaces::cef_frame_t,
|
||||
request: *mut interfaces::cef_request_t,
|
||||
response: *mut interfaces::cef_response_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_request_handler_t, browser: *mut interfaces::cef_browser_t,
|
||||
|
@ -421,14 +321,15 @@ pub struct _cef_request_handler_t {
|
|||
// 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 on_quota_request: Option<extern "C" fn(this: *mut cef_request_handler_t,
|
||||
browser: *mut interfaces::cef_browser_t,
|
||||
origin_url: *const types::cef_string_t, new_size: i64,
|
||||
callback: *mut interfaces::cef_quota_callback_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_request_handler_t, cert_error: types::cef_errorcode_t,
|
||||
this: *mut cef_request_handler_t, browser: *mut interfaces::cef_browser_t,
|
||||
cert_error: types::cef_errorcode_t,
|
||||
request_url: *const types::cef_string_t,
|
||||
callback: *mut interfaces::cef_allow_certificate_error_callback_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_request_handler_t,
|
||||
browser: *mut interfaces::cef_browser_t) -> ()>,
|
||||
|
||||
//
|
||||
// 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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
628
ports/cef/interfaces/cef_ssl_info.rs
Normal file
628
ports/cef/interfaces/cef_ssl_info.rs
Normal file
|
@ -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<extern "C" fn(
|
||||
this: *mut cef_sslcert_principal_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_sslcert_principal_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_sslcert_principal_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_sslcert_principal_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_sslcert_principal_t) -> types::cef_string_userfree_t>,
|
||||
|
||||
//
|
||||
// Retrieve the list of street addresses.
|
||||
//
|
||||
pub get_street_addresses: Option<extern "C" fn(
|
||||
this: *mut cef_sslcert_principal_t,
|
||||
addresses: types::cef_string_list_t) -> ()>,
|
||||
|
||||
//
|
||||
// Retrieve the list of organization names.
|
||||
//
|
||||
pub get_organization_names: Option<extern "C" fn(
|
||||
this: *mut cef_sslcert_principal_t, names: types::cef_string_list_t) -> (
|
||||
)>,
|
||||
|
||||
//
|
||||
// Retrieve the list of organization unit names.
|
||||
//
|
||||
pub get_organization_unit_names: Option<extern "C" fn(
|
||||
this: *mut cef_sslcert_principal_t, names: types::cef_string_list_t) -> (
|
||||
)>,
|
||||
|
||||
//
|
||||
// Retrieve the list of domain components.
|
||||
//
|
||||
pub get_domain_components: Option<extern "C" fn(
|
||||
this: *mut cef_sslcert_principal_t,
|
||||
components: types::cef_string_list_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_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<String>) -> () {
|
||||
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<String>) -> () {
|
||||
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<String>) -> () {
|
||||
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<String>) -> () {
|
||||
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<CefSSLCertPrincipal> {
|
||||
fn to_c(rust_object: Option<CefSSLCertPrincipal>) -> *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<CefSSLCertPrincipal> {
|
||||
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<extern "C" fn(
|
||||
this: *mut cef_sslinfo_t) -> *mut interfaces::cef_sslcert_principal_t>,
|
||||
|
||||
//
|
||||
// Returns the issuer of the X.509 certificate.
|
||||
//
|
||||
pub get_issuer: Option<extern "C" fn(
|
||||
this: *mut cef_sslinfo_t) -> *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<extern "C" fn(
|
||||
this: *mut cef_sslinfo_t) -> *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<extern "C" fn(
|
||||
this: *mut cef_sslinfo_t) -> 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<extern "C" fn(
|
||||
this: *mut cef_sslinfo_t) -> types::cef_time_t>,
|
||||
|
||||
//
|
||||
// Returns the DER encoded data for the X.509 certificate.
|
||||
//
|
||||
pub get_derencoded: Option<extern "C" fn(
|
||||
this: *mut cef_sslinfo_t) -> *mut interfaces::cef_binary_value_t>,
|
||||
|
||||
//
|
||||
// Returns the PEM encoded data for the X.509 certificate.
|
||||
//
|
||||
pub get_pemencoded: Option<extern "C" fn(
|
||||
this: *mut cef_sslinfo_t) -> *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<CefSSLInfo> {
|
||||
fn to_c(rust_object: Option<CefSSLInfo>) -> *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<CefSSLInfo> {
|
||||
if c_object.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(CefSSLInfo::from_c_object_addref(c_object))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<extern "C" fn(
|
||||
this: *mut cef_urlrequest_client_t,
|
||||
request: *mut interfaces::cef_urlrequest_t, current: u64,
|
||||
total: u64) -> ()>,
|
||||
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<extern "C" fn(
|
||||
this: *mut cef_urlrequest_client_t,
|
||||
request: *mut interfaces::cef_urlrequest_t, current: u64,
|
||||
total: u64) -> ()>,
|
||||
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")
|
||||
}
|
||||
|
|
|
@ -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<CefV8Handler> {
|
|||
|
||||
//
|
||||
// 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<extern "C" fn(this: *mut cef_v8value_t) -> 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<extern "C" fn(this: *mut cef_v8value_t) -> 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.
|
||||
//
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue