aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ports/cef/command_line.rs4
-rw-r--r--ports/cef/core.rs16
-rw-r--r--ports/cef/eutil.rs4
-rw-r--r--ports/cef/string.rs23
-rw-r--r--ports/cef/string_list.rs13
-rw-r--r--ports/cef/string_map.rs16
-rw-r--r--ports/cef/types.rs360
7 files changed, 208 insertions, 228 deletions
diff --git a/ports/cef/command_line.rs b/ports/cef/command_line.rs
index 755e2669624..f8116f762ed 100644
--- a/ports/cef/command_line.rs
+++ b/ports/cef/command_line.rs
@@ -35,7 +35,7 @@ pub fn command_line_init(argc: c_int, argv: *const *const u8) {
let cl = command_line_new();
(*cl).argc = argc;
(*cl).argv = a;
- (*cl).cl.get_switch_value = command_line_get_switch_value;
+ (*cl).cl.get_switch_value = Some(command_line_get_switch_value);
GLOBAL_CMDLINE = Some(cl);
}
}
@@ -72,7 +72,7 @@ pub extern "C" fn command_line_get_switch_value(cmd: *mut cef_command_line_t, na
pub extern "C" fn cef_command_line_create() -> *mut cef_command_line_t {
unsafe {
let cl = command_line_new();
- (*cl).cl.get_switch_value = command_line_get_switch_value;
+ (*cl).cl.get_switch_value = Some(command_line_get_switch_value);
mem::transmute(cl)
}
}
diff --git a/ports/cef/core.rs b/ports/cef/core.rs
index fc94574cb12..16558b43bd8 100644
--- a/ports/cef/core.rs
+++ b/ports/cef/core.rs
@@ -4,14 +4,12 @@
use command_line::command_line_init;
-use eutil::fptr_is_null;
use geom::size::TypedSize2D;
use glfw_app;
use libc::{c_int, c_void};
use native;
use servo::Browser;
use servo_util::opts;
-use std::mem;
use types::{cef_app_t, cef_main_args_t, cef_settings_t};
#[no_mangle]
@@ -25,16 +23,12 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
}
unsafe {
command_line_init((*args).argc, (*args).argv);
- let cb = (*application).get_browser_process_handler;
- if !fptr_is_null(mem::transmute(cb)) {
- let handler = cb(application);
- if handler.is_not_null() {
- let hcb = (*handler).on_context_initialized;
- if !fptr_is_null(mem::transmute(hcb)) {
- hcb(handler);
+ (*application).get_browser_process_handler.map(|cb| {
+ let handler = cb(application);
+ if handler.is_not_null() {
+ (*handler).on_context_initialized.map(|hcb| hcb(handler));
}
- }
- }
+ });
}
return 1
}
diff --git a/ports/cef/eutil.rs b/ports/cef/eutil.rs
index d5f9760f6bb..be0052bdfef 100644
--- a/ports/cef/eutil.rs
+++ b/ports/cef/eutil.rs
@@ -6,10 +6,6 @@ use libc::c_int;
use std::slice;
use std::str;
-pub fn fptr_is_null(fptr: *const u8) -> bool {
- fptr.is_null()
-}
-
pub fn slice_to_str(s: *const u8, l: uint, f: |&str| -> c_int) -> c_int {
unsafe {
slice::raw::buf_as_slice(s, l, |result| {
diff --git a/ports/cef/string.rs b/ports/cef/string.rs
index c9f74af624f..9f3baac8f10 100644
--- a/ports/cef/string.rs
+++ b/ports/cef/string.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use eutil::{fptr_is_null, slice_to_str};
+use eutil::slice_to_str;
use libc::{size_t, c_int, c_ushort,c_void};
use libc::types::os::arch::c95::wchar_t;
use mem::{new0,newarray0,delete,deletearray};
@@ -52,10 +52,7 @@ pub extern "C" fn cef_string_userfree_utf16_free(cs: *mut cef_string_userfree_ut
#[no_mangle]
pub extern "C" fn cef_string_utf8_clear(cs: *mut cef_string_utf8_t) {
unsafe {
- if !fptr_is_null(mem::transmute((*cs).dtor)) {
- let dtor = (*cs).dtor;
- dtor((*cs).str);
- }
+ (*cs).dtor.map(|dtor| dtor((*cs).str));
(*cs).length = 0;
(*cs).str = 0 as *mut u8;
(*cs).dtor = mem::transmute(0 as *const u8);
@@ -81,7 +78,7 @@ pub extern "C" fn cef_string_utf8_set(src: *const u8, src_len: size_t, output: *
ptr::copy_memory((*output).str, src, src_len as uint);
(*output).length = src_len;
- (*output).dtor = string_utf8_dtor;
+ (*output).dtor = Some(string_utf8_dtor);
}
} else {
(*output).str = mem::transmute(src);
@@ -134,10 +131,7 @@ pub extern "C" fn cef_string_utf16_to_utf8(src: *const u16, src_len: size_t, out
#[no_mangle]
pub extern "C" fn cef_string_utf16_clear(cs: *mut cef_string_utf16_t) {
unsafe {
- if !fptr_is_null(mem::transmute((*cs).dtor)) {
- let dtor = (*cs).dtor;
- dtor((*cs).str);
- }
+ (*cs).dtor.map(|dtor| dtor((*cs).str));
(*cs).length = 0;
(*cs).str = 0 as *mut c_ushort;
(*cs).dtor = mem::transmute(0 as *const u8);
@@ -163,7 +157,7 @@ pub extern "C" fn cef_string_utf16_set(src: *const c_ushort, src_len: size_t, ou
ptr::copy_memory((*output).str, src, src_len as uint);
(*output).length = src_len;
- (*output).dtor = string_utf16_dtor;
+ (*output).dtor = Some(string_utf16_dtor);
}
} else {
(*output).str = mem::transmute(src);
@@ -192,10 +186,7 @@ pub extern "C" fn cef_string_utf16_cmp(a: *const cef_string_utf16_t, b: *const c
#[no_mangle]
pub extern "C" fn cef_string_wide_clear(cs: *mut cef_string_wide_t) {
unsafe {
- if !fptr_is_null(mem::transmute((*cs).dtor)) {
- let dtor = (*cs).dtor;
- dtor((*cs).str);
- }
+ (*cs).dtor.map(|dtor| dtor((*cs).str));
(*cs).length = 0;
(*cs).str = 0 as *mut wchar_t;
(*cs).dtor = mem::transmute(0 as *const u8);
@@ -221,7 +212,7 @@ pub extern "C" fn cef_string_wide_set(src: *const wchar_t, src_len: size_t, outp
ptr::copy_memory((*output).str, src, src_len as uint);
(*output).length = src_len;
- (*output).dtor = string_wide_dtor;
+ (*output).dtor = Some(string_wide_dtor);
}
} else {
(*output).str = mem::transmute(src);
diff --git a/ports/cef/string_list.rs b/ports/cef/string_list.rs
index 3a202e82d42..fde447ed94d 100644
--- a/ports/cef/string_list.rs
+++ b/ports/cef/string_list.rs
@@ -2,7 +2,6 @@
* 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/. */
-use eutil::fptr_is_null;
use libc::{c_int};
use std::mem;
use string::{cef_string_userfree_utf8_alloc,cef_string_userfree_utf8_free,cef_string_utf8_set};
@@ -26,7 +25,7 @@ pub extern "C" fn cef_string_list_alloc() -> *mut cef_string_list_t {
#[no_mangle]
pub extern "C" fn cef_string_list_size(lt: *mut cef_string_list_t) -> c_int {
unsafe {
- if fptr_is_null(mem::transmute(lt)) { return 0; }
+ if lt.is_null() { return 0; }
let v = string_list_to_vec(lt);
(*v).len() as c_int
}
@@ -35,7 +34,7 @@ pub extern "C" fn cef_string_list_size(lt: *mut cef_string_list_t) -> c_int {
#[no_mangle]
pub extern "C" fn cef_string_list_append(lt: *mut cef_string_list_t, value: *const cef_string_t) {
unsafe {
- if fptr_is_null(mem::transmute(lt)) { return; }
+ if lt.is_null() { return; }
let v = string_list_to_vec(lt);
let cs = cef_string_userfree_utf8_alloc();
cef_string_utf8_set(mem::transmute((*value).str), (*value).length, cs, 1);
@@ -46,7 +45,7 @@ pub extern "C" fn cef_string_list_append(lt: *mut cef_string_list_t, value: *con
#[no_mangle]
pub extern "C" fn cef_string_list_value(lt: *mut cef_string_list_t, index: c_int, value: *mut cef_string_t) -> c_int {
unsafe {
- if index < 0 || fptr_is_null(mem::transmute(lt)) { return 0; }
+ if index < 0 || lt.is_null() { return 0; }
let v = string_list_to_vec(lt);
if index as uint > (*v).len() - 1 { return 0; }
let cs = (*v)[index as uint];
@@ -57,7 +56,7 @@ pub extern "C" fn cef_string_list_value(lt: *mut cef_string_list_t, index: c_int
#[no_mangle]
pub extern "C" fn cef_string_list_clear(lt: *mut cef_string_list_t) {
unsafe {
- if fptr_is_null(mem::transmute(lt)) { return; }
+ if lt.is_null() { return; }
let v = string_list_to_vec(lt);
if (*v).len() == 0 { return; }
let mut cs;
@@ -71,7 +70,7 @@ pub extern "C" fn cef_string_list_clear(lt: *mut cef_string_list_t) {
#[no_mangle]
pub extern "C" fn cef_string_list_free(lt: *mut cef_string_list_t) {
unsafe {
- if fptr_is_null(mem::transmute(lt)) { return; }
+ if lt.is_null() { return; }
let v: Box<Vec<*mut cef_string_t>> = mem::transmute(lt);
cef_string_list_clear(lt);
drop(v);
@@ -81,7 +80,7 @@ pub extern "C" fn cef_string_list_free(lt: *mut cef_string_list_t) {
#[no_mangle]
pub extern "C" fn cef_string_list_copy(lt: *mut cef_string_list_t) -> *mut cef_string_list_t {
unsafe {
- if fptr_is_null(mem::transmute(lt)) { return 0 as *mut cef_string_list_t; }
+ if lt.is_null() { return 0 as *mut cef_string_list_t; }
let v = string_list_to_vec(lt);
let lt2 = cef_string_list_alloc();
for cs in (*v).iter() {
diff --git a/ports/cef/string_map.rs b/ports/cef/string_map.rs
index 67753b3c5dc..2ca2e4e0f9c 100644
--- a/ports/cef/string_map.rs
+++ b/ports/cef/string_map.rs
@@ -2,7 +2,7 @@
* 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/. */
-use eutil::{fptr_is_null, slice_to_str};
+use eutil::slice_to_str;
use libc::{c_int};
use std::collections::TreeMap;
use std::mem;
@@ -27,7 +27,7 @@ pub extern "C" fn cef_string_map_alloc() -> *mut cef_string_map_t {
#[no_mangle]
pub extern "C" fn cef_string_map_size(sm: *mut cef_string_map_t) -> c_int {
unsafe {
- if fptr_is_null(mem::transmute(sm)) { return 0; }
+ if sm.is_null() { return 0; }
let v = string_map_to_treemap(sm);
(*v).len() as c_int
}
@@ -36,7 +36,7 @@ pub extern "C" fn cef_string_map_size(sm: *mut cef_string_map_t) -> c_int {
#[no_mangle]
pub extern "C" fn cef_string_map_append(sm: *mut cef_string_map_t, key: *const cef_string_t, value: *const cef_string_t) -> c_int {
unsafe {
- if fptr_is_null(mem::transmute(sm)) { return 0; }
+ if sm.is_null() { return 0; }
let v = string_map_to_treemap(sm);
slice_to_str((*key).str as *const u8, (*key).length as uint, |result| {
let s = String::from_str(result);
@@ -51,7 +51,7 @@ pub extern "C" fn cef_string_map_append(sm: *mut cef_string_map_t, key: *const c
#[no_mangle]
pub extern "C" fn cef_string_map_find(sm: *mut cef_string_map_t, key: *const cef_string_t, value: *mut cef_string_t) -> c_int {
unsafe {
- if fptr_is_null(mem::transmute(sm)) { return 0; }
+ if sm.is_null() { return 0; }
let v = string_map_to_treemap(sm);
slice_to_str((*key).str as *const u8, (*key).length as uint, |result| {
match (*v).find(&String::from_str(result)) {
@@ -68,7 +68,7 @@ pub extern "C" fn cef_string_map_find(sm: *mut cef_string_map_t, key: *const cef
#[no_mangle]
pub extern "C" fn cef_string_map_key(sm: *mut cef_string_map_t, index: c_int, value: *mut cef_string_t) -> c_int {
unsafe {
- if index < 0 || fptr_is_null(mem::transmute(sm)) { return 0; }
+ if index < 0 || sm.is_null() { return 0; }
let v = string_map_to_treemap(sm);
if index as uint > (*v).len() - 1 { return 0; }
@@ -85,7 +85,7 @@ pub extern "C" fn cef_string_map_key(sm: *mut cef_string_map_t, index: c_int, va
#[no_mangle]
pub extern "C" fn cef_string_map_value(sm: *mut cef_string_map_t, index: c_int, value: *mut cef_string_t) -> c_int {
unsafe {
- if index < 0 || fptr_is_null(mem::transmute(sm)) { return 0; }
+ if index < 0 || sm.is_null() { return 0; }
let v = string_map_to_treemap(sm);
if index as uint > (*v).len() - 1 { return 0; }
@@ -102,7 +102,7 @@ pub extern "C" fn cef_string_map_value(sm: *mut cef_string_map_t, index: c_int,
#[no_mangle]
pub extern "C" fn cef_string_map_clear(sm: *mut cef_string_map_t) {
unsafe {
- if fptr_is_null(mem::transmute(sm)) { return; }
+ if sm.is_null() { return; }
let v = string_map_to_treemap(sm);
for val in (*v).values() {
cef_string_userfree_utf8_free(*val);
@@ -114,7 +114,7 @@ pub extern "C" fn cef_string_map_clear(sm: *mut cef_string_map_t) {
#[no_mangle]
pub extern "C" fn cef_string_map_free(sm: *mut cef_string_map_t) {
unsafe {
- if fptr_is_null(mem::transmute(sm)) { return; }
+ if sm.is_null() { return; }
let _v: Box<TreeMap<String, *mut cef_string_t>> = mem::transmute(sm);
cef_string_map_clear(sm);
}
diff --git a/ports/cef/types.rs b/ports/cef/types.rs
index d9964336b44..4484ffe7787 100644
--- a/ports/cef/types.rs
+++ b/ports/cef/types.rs
@@ -48,7 +48,7 @@ pub type cef_string_userfree_utf8_t = cef_string_utf8;
pub struct cef_string_utf8 {
pub str: *mut u8,
pub length: size_t,
- pub dtor: extern "C" fn(str: *mut u8),
+ pub dtor: Option<extern "C" fn(str: *mut u8)>,
}
pub type cef_string_utf16_t = cef_string_utf16;
@@ -56,7 +56,7 @@ pub type cef_string_userfree_utf16_t = cef_string_utf16;
pub struct cef_string_utf16 {
pub str: *mut c_ushort,
pub length: size_t,
- pub dtor: extern "C" fn(str: *mut c_ushort),
+ pub dtor: Option<extern "C" fn(str: *mut c_ushort)>,
}
pub type cef_string_wide_t = cef_string_wide;
@@ -64,7 +64,7 @@ pub type cef_string_userfree_wide_t = cef_string_wide;
pub struct cef_string_wide {
pub str: *mut wchar_t,
pub length: size_t,
- pub dtor: extern "C" fn(str: *mut wchar_t),
+ pub dtor: Option<extern "C" fn(str: *mut wchar_t)>,
}
pub type cef_main_args_t = cef_main_args;
@@ -511,29 +511,29 @@ pub struct cef_process_message {
// Returns true (1) if this object is valid. Do not call any other functions
// if this function returns false (0).
///
- pub is_valid: extern "C" fn(process_message: *mut cef_process_message) -> c_int,
+ pub is_valid: Option<extern "C" fn(process_message: *mut cef_process_message) -> c_int>,
///
// Returns true (1) if the values of this object are read-only. Some APIs may
// expose read-only objects.
///
- pub is_read_only: extern "C" fn(process_message: *mut cef_process_message) -> c_int,
+ pub is_read_only: Option<extern "C" fn(process_message: *mut cef_process_message) -> c_int>,
///
// Returns a writable copy of this object.
///
- pub copy: extern "C" fn(process_message: *mut cef_process_message) -> *mut cef_process_message,
+ pub copy: Option<extern "C" fn(process_message: *mut cef_process_message) -> *mut cef_process_message>,
///
// Returns the message name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
- pub get_name: extern "C" fn(process_message: *mut cef_process_message) -> *mut cef_string_userfree_t,
+ pub get_name: Option<extern "C" fn(process_message: *mut cef_process_message) -> *mut cef_string_userfree_t>,
///
// Returns the list of arguments.
///
- pub get_argument_list: extern "C" fn(process_message: *mut cef_process_message) -> *mut cef_list_value,
+ pub get_argument_list: Option<extern "C" fn(process_message: *mut cef_process_message) -> *mut cef_list_value>,
}
///
@@ -756,18 +756,18 @@ pub struct cef_base {
///
// Increment the reference count.
///
- pub add_ref: extern "C" fn(base: *mut cef_base) -> c_int,
+ pub add_ref: Option<extern "C" fn(base: *mut cef_base) -> c_int>,
///
// Decrement the reference count. Delete this object when no references
// remain.
///
- pub release: extern "C" fn(base: *mut cef_base) -> c_int,
+ pub release: Option<extern "C" fn(base: *mut cef_base) -> c_int>,
///
// Returns the current number of references.
///
- pub get_refct: extern "C" fn(base: *mut cef_base) -> c_int,
+ pub get_refct: Option<extern "C" fn(base: *mut cef_base) -> c_int>,
}
///
@@ -791,116 +791,116 @@ pub struct cef_command_line {
// Returns true (1) if this object is valid. Do not call any other functions
// if this function returns false (0).
///
- pub is_valid: extern "C" fn(cmd: *mut cef_command_line),
+ pub is_valid: Option<extern "C" fn(cmd: *mut cef_command_line)>,
///
// Returns true (1) if the values of this object are read-only. Some APIs may
// expose read-only objects.
///
- pub is_read_only: extern "C" fn(cmd: *mut cef_command_line),
+ pub is_read_only: Option<extern "C" fn(cmd: *mut cef_command_line)>,
///
// Returns a writable copy of this object.
///
- pub copy: extern "C" fn(cmd: *mut cef_command_line) -> *mut cef_command_line,
+ pub copy: Option<extern "C" fn(cmd: *mut cef_command_line) -> *mut cef_command_line>,
///
// Initialize the command line with the specified |argc| and |argv| values.
// The first argument must be the name of the program. This function is only
// supported on non-Windows platforms.
///
- pub init_from_argv: extern "C" fn(cmd: *mut cef_command_line, argc: c_int, argv: *const u8),
+ pub init_from_argv: Option<extern "C" fn(cmd: *mut cef_command_line, argc: c_int, argv: *const u8)>,
///
// Initialize the command line with the string returned by calling
// GetCommandLineW(). This function is only supported on Windows.
///
- pub init_from_string: extern "C" fn(cmd: *mut cef_command_line, command_line: *const cef_string_t),
+ pub init_from_string: Option<extern "C" fn(cmd: *mut cef_command_line, command_line: *const cef_string_t)>,
///
// Reset the command-line switches and arguments but leave the program
// component unchanged.
///
- pub reset: extern "C" fn(cmd: *mut cef_command_line),
+ pub reset: Option<extern "C" fn(cmd: *mut cef_command_line)>,
///
// Retrieve the original command line string as a vector of strings. The argv
// array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* }
///
- pub get_argv: extern "C" fn(cmd: *mut cef_command_line, argv: *mut cef_string_list_t),
+ pub get_argv: Option<extern "C" fn(cmd: *mut cef_command_line, argv: *mut cef_string_list_t)>,
///
// Constructs and returns the represented command line string. Use this
// function cautiously because quoting behavior is unclear.
///
// The resulting string must be freed by calling cef_string_userfree_free().
- pub get_command_line_string: extern "C" fn(cmd: *mut cef_command_line) -> *mut cef_string_userfree_t,
+ pub get_command_line_string: Option<extern "C" fn(cmd: *mut cef_command_line) -> *mut cef_string_userfree_t>,
///
// Get the program part of the command line string (the first item).
///
// The resulting string must be freed by calling cef_string_userfree_free().
- pub get_program: extern "C" fn(cmd: *mut cef_command_line) -> *mut cef_string_userfree_t,
+ pub get_program: Option<extern "C" fn(cmd: *mut cef_command_line) -> *mut cef_string_userfree_t>,
///
// Set the program part of the command line string (the first item).
///
- pub set_program: extern "C" fn(cmd: *mut cef_command_line, name: *const cef_string_t),
+ pub set_program: Option<extern "C" fn(cmd: *mut cef_command_line, name: *const cef_string_t)>,
///
// Returns true (1) if the command line has switches.
///
- pub has_switches: extern "C" fn(cmd: *mut cef_command_line) -> c_int,
+ pub has_switches: Option<extern "C" fn(cmd: *mut cef_command_line) -> c_int>,
///
// Returns true (1) if the command line contains the given switch.
///
- pub has_switch: extern "C" fn(cmd: *mut cef_command_line, name: *const cef_string_t) -> c_int,
+ pub has_switch: Option<extern "C" fn(cmd: *mut cef_command_line, name: *const cef_string_t) -> c_int>,
///
// Returns the value associated with the given switch. If the switch has no
// value or isn't present this function returns the NULL string.
///
// The resulting string must be freed by calling cef_string_userfree_free().
- pub get_switch_value: extern "C" fn(cmd: *mut cef_command_line, name: *const cef_string_t) -> *mut cef_string_userfree_t,
+ pub get_switch_value: Option<extern "C" fn(cmd: *mut cef_command_line, name: *const cef_string_t) -> *mut cef_string_userfree_t>,
///
// Returns the map of switch names and values. If a switch has no value an
// NULL string is returned.
///
- pub get_switches: extern "C" fn(cmd: *mut cef_command_line, switches: cef_string_map_t),
+ pub get_switches: Option<extern "C" fn(cmd: *mut cef_command_line, switches: cef_string_map_t)>,
///
// Add a switch to the end of the command line. If the switch has no value
// pass an NULL value string.
///
- pub append_switch: extern "C" fn(cmd: *mut cef_command_line, name: *const cef_string_t),
+ pub append_switch: Option<extern "C" fn(cmd: *mut cef_command_line, name: *const cef_string_t)>,
///
// Add a switch with the specified value to the end of the command line.
///
- pub append_switch_with_value: extern "C" fn(cmd: *mut cef_command_line, name: *const cef_string_t, value: *const cef_string_t),
+ pub append_switch_with_value: Option<extern "C" fn(cmd: *mut cef_command_line, name: *const cef_string_t, value: *const cef_string_t)>,
///
// True if there are remaining command line arguments.
///
- pub has_arguments: extern "C" fn(cmd: *mut cef_command_line) -> c_int,
+ pub has_arguments: Option<extern "C" fn(cmd: *mut cef_command_line) -> c_int>,
///
// Get the remaining command line arguments.
///
- pub get_arguments: extern "C" fn(cmd: *mut cef_command_line, arguments: *mut cef_string_list_t),
+ pub get_arguments: Option<extern "C" fn(cmd: *mut cef_command_line, arguments: *mut cef_string_list_t)>,
///
// Add an argument to the end of the command line.
///
- pub append_argument: extern "C" fn(cmd: *mut cef_command_line, argument: *const cef_string_t),
+ pub append_argument: Option<extern "C" fn(cmd: *mut cef_command_line, argument: *const cef_string_t)>,
///
// Insert a command before the current command. Common for debuggers, like
// "valgrind" or "gdb --args".
///
- pub prepend_wrapper: extern "C" fn(cmd: *mut cef_command_line, wrapper: *const cef_string_t),
+ pub prepend_wrapper: Option<extern "C" fn(cmd: *mut cef_command_line, wrapper: *const cef_string_t)>,
}
@@ -960,10 +960,10 @@ pub struct cef_scheme_registrar {
// per unique |scheme_name| value. If |scheme_name| is already registered or
// if an error occurs this function will return false (0).
///
- _add_custom_scheme: extern "C" fn(registrar: *mut cef_scheme_registrar,
+ pub add_custom_scheme: Option<extern "C" fn(registrar: *mut cef_scheme_registrar,
scheme_name: *const cef_string_t,
is_standard: c_int, is_local: c_int,
- is_display_isolated: c_int),
+ is_display_isolated: c_int)>,
}
///
@@ -983,8 +983,8 @@ pub struct cef_resource_bundle_handler {
// string and return true (1). To use the default translation return false
// (0). Supported message IDs are listed in cef_pack_strings.h.
///
- pub get_localized_string: extern "C" fn(bundle_handler: *mut cef_resource_bundle_handler,
- message_id: c_int, string: *mut cef_string_t) -> c_int,
+ pub get_localized_string: Option<extern "C" fn(bundle_handler: *mut cef_resource_bundle_handler,
+ message_id: c_int, string: *mut cef_string_t) -> c_int>,
///
// Called to retrieve data for the resource specified by |resource_id|. To
@@ -994,8 +994,8 @@ pub struct cef_resource_bundle_handler {
// resident in memory. Supported resource IDs are listed in
// cef_pack_resources.h.
///
- pub get_data_resource: extern "C" fn(bundle_handler: *mut cef_resource_bundle_handler,
- resource_id: c_int, data: *mut *mut c_void, data_size: *mut size_t) -> c_int,
+ pub get_data_resource: Option<extern "C" fn(bundle_handler: *mut cef_resource_bundle_handler,
+ resource_id: c_int, data: *mut *mut c_void, data_size: *mut size_t) -> c_int>,
}
@@ -1014,115 +1014,115 @@ pub struct cef_list_value {
// Returns true (1) if this object is valid. Do not call any other functions
// if this function returns false (0).
///
- pub is_valid: extern "C" fn(list_value: *mut cef_list_value) -> c_int,
+ pub is_valid: Option<extern "C" fn(list_value: *mut cef_list_value) -> c_int>,
///
// Returns true (1) if this object is currently owned by another object.
///
- pub is_owned: extern "C" fn(list_value: *mut cef_list_value) -> c_int,
+ pub is_owned: Option<extern "C" fn(list_value: *mut cef_list_value) -> c_int>,
///
// Returns true (1) if the values of this object are read-only. Some APIs may
// expose read-only objects.
///
- pub is_read_only: extern "C" fn(list_value: *mut cef_list_value) -> c_int,
+ pub is_read_only: Option<extern "C" fn(list_value: *mut cef_list_value) -> c_int>,
///
// Returns a writable copy of this object.
///
- pub copy: extern "C" fn(list_value: *mut cef_list_value) -> *mut cef_list_value,
+ pub copy: Option<extern "C" fn(list_value: *mut cef_list_value) -> *mut cef_list_value>,
///
// Sets the number of values. If the number of values is expanded all new
// value slots will default to type null. Returns true (1) on success.
///
- pub set_size: extern "C" fn(list_value: *mut cef_list_value, size: size_t) -> c_int,
+ pub set_size: Option<extern "C" fn(list_value: *mut cef_list_value, size: size_t) -> c_int>,
///
// Returns the number of values.
///
- pub get_size: extern "C" fn(list_value: *mut cef_list_value) -> size_t,
+ pub get_size: Option<extern "C" fn(list_value: *mut cef_list_value) -> size_t>,
///
// Removes all values. Returns true (1) on success.
///
- pub clear: extern "C" fn(list_value: *mut cef_list_value) -> c_int,
+ pub clear: Option<extern "C" fn(list_value: *mut cef_list_value) -> c_int>,
///
// Removes the value at the specified index.
///
- pub remove: extern "C" fn(list_value: *mut cef_list_value) -> c_int,
+ pub remove: Option<extern "C" fn(list_value: *mut cef_list_value) -> c_int>,
///
// Returns the value type at the specified index.
///
- pub get_type: extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> cef_value_type_t,
+ pub get_type: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> cef_value_type_t>,
///
// Returns the value at the specified index as type bool.
///
- pub get_bool: extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> c_int,
+ pub get_bool: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> c_int>,
///
// Returns the value at the specified index as type int.
///
- pub get_int: extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> c_int,
+ pub get_int: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> c_int>,
///
// Returns the value at the specified index as type double.
///
- pub get_double: extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> c_double,
+ pub get_double: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> c_double>,
///
// Returns the value at the specified index as type string.
///
// The resulting string must be freed by calling cef_string_userfree_free().
- pub get_string: extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> *mut cef_string_userfree_t,
+ pub get_string: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> *mut cef_string_userfree_t>,
///
// Returns the value at the specified index as type binary.
///
- pub get_binary: extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> *mut cef_binary_value,
+ pub get_binary: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> *mut cef_binary_value>,
///
// Returns the value at the specified index as type dictionary.
///
- pub get_dictionary: extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> *mut cef_dictionary_value,
+ pub get_dictionary: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> *mut cef_dictionary_value>,
///
// Returns the value at the specified index as type list.
///
- pub get_list: extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> *mut cef_list_value,
+ pub get_list: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> *mut cef_list_value>,
///
// Sets the value at the specified index as type null. Returns true (1) if the
// value was set successfully.
///
- pub set_null: extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> c_int,
+ pub set_null: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int) -> c_int>,
///
// Sets the value at the specified index as type bool. Returns true (1) if the
// value was set successfully.
///
- pub set_bool: extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: c_int) -> c_int,
+ pub set_bool: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: c_int) -> c_int>,
///
// Sets the value at the specified index as type int. Returns true (1) if the
// value was set successfully.
///
- pub set_int: extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: c_int) -> c_int,
+ pub set_int: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: c_int) -> c_int>,
///
// Sets the value at the specified index as type double. Returns true (1) if
// the value was set successfully.
///
- pub set_double: extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: c_double) -> c_int,
+ pub set_double: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: c_double) -> c_int>,
///
// Sets the value at the specified index as type string. Returns true (1) if
// the value was set successfully.
///
- pub set_string: extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: *const cef_string_t) -> c_int,
+ pub set_string: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: *const cef_string_t) -> c_int>,
///
// Sets the value at the specified index as type binary. Returns true (1) if
@@ -1132,7 +1132,7 @@ pub struct cef_list_value {
// change. Otherwise, ownership will be transferred to this object and the
// |value| reference will be invalidated.
///
- pub set_binary: extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: *mut cef_binary_value) -> c_int,
+ pub set_binary: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: *mut cef_binary_value) -> c_int>,
///
// Sets the value at the specified index as type dict. Returns true (1) if the
@@ -1142,7 +1142,7 @@ pub struct cef_list_value {
// Otherwise, ownership will be transferred to this object and the |value|
// reference will be invalidated.
///
- pub set_dictionary: extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: *mut cef_dictionary_value) -> c_int,
+ pub set_dictionary: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: *mut cef_dictionary_value) -> c_int>,
///
// Sets the value at the specified index as type list. Returns true (1) if the
@@ -1152,7 +1152,7 @@ pub struct cef_list_value {
// Otherwise, ownership will be transferred to this object and the |value|
// reference will be invalidated.
///
- pub set_list: extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: *mut cef_list_value) -> c_int,
+ pub set_list: Option<extern "C" fn(list_value: *mut cef_list_value, index: c_int, value: *mut cef_list_value) -> c_int>,
}
///
@@ -1171,7 +1171,7 @@ pub struct cef_browser_process_handler {
// Called on the browser process UI thread immediately after the CEF context
// has been initialized.
///
- pub on_context_initialized: extern "C" fn(browser_handler: *mut cef_browser_process_handler),
+ pub on_context_initialized: Option<extern "C" fn(browser_handler: *mut cef_browser_process_handler)>,
///
// Called before a child process is launched. Will be called on the browser
@@ -1180,7 +1180,7 @@ pub struct cef_browser_process_handler {
// opportunity to modify the child process command line. Do not keep a
// reference to |command_line| outside of this function.
///
- pub on_before_child_process_launch: extern "C" fn(browser_handler: *mut cef_browser_process_handler, command_line: *mut cef_command_line),
+ pub on_before_child_process_launch: Option<extern "C" fn(browser_handler: *mut cef_browser_process_handler, command_line: *mut cef_command_line)>,
///
// Called on the browser process IO thread after the main thread has been
@@ -1189,7 +1189,7 @@ pub struct cef_browser_process_handler {
// cef_render_process_handler_t::on_render_thread_created() in the render
// process. Do not keep a reference to |extra_info| outside of this function.
///
- pub on_render_process_thread_created: extern "C" fn(browser_handler: *mut cef_browser_process_handler, extra_info: *mut cef_list_value),
+ pub on_render_process_thread_created: Option<extern "C" fn(browser_handler: *mut cef_browser_process_handler, extra_info: *mut cef_list_value)>,
}
@@ -1210,9 +1210,9 @@ pub struct cef_run_file_dialog_callback {
// depending on the dialog mode. If the selection was cancelled |file_paths|
// will be NULL.
///
- pub cont: extern "C" fn(run_file_dialog_callback: *mut cef_run_file_dialog_callback,
+ pub cont: Option<extern "C" fn(run_file_dialog_callback: *mut cef_run_file_dialog_callback,
browser_host: *mut cef_browser_host,
- file_paths: *mut cef_string_list_t),
+ file_paths: *mut cef_string_list_t)>,
}
///
@@ -1231,7 +1231,7 @@ pub struct cef_browser_host {
///
// Returns the hosted browser object.
///
- pub get_browser: extern "C" fn(browser_host: *mut cef_browser_host) -> *mut cef_browser,
+ pub get_browser: Option<extern "C" fn(browser_host: *mut cef_browser_host) -> *mut cef_browser>,
///
// Call this function before destroying a contained browser window. This
@@ -1239,7 +1239,7 @@ pub struct cef_browser_host {
// browser window is destroyed. See cef_life_span_handler_t::do_close()
// documentation for additional usage information.
///
- pub parent_window_will_close: extern "C" fn(browser_host: *mut cef_browser_host),
+ pub parent_window_will_close: Option<extern "C" fn(browser_host: *mut cef_browser_host)>,
///
// Request that the browser close. The JavaScript 'onbeforeunload' event will
@@ -1251,48 +1251,48 @@ pub struct cef_browser_host {
// cef_life_span_handler_t::do_close() documentation for additional usage
// information.
///
- pub close_browser: extern "C" fn(browser_host: *mut cef_browser_host, force_close: c_int),
+ pub close_browser: Option<extern "C" fn(browser_host: *mut cef_browser_host, force_close: c_int)>,
///
// Set focus for the browser window. If |enable| is true (1) focus will be set
// to the window. Otherwise, focus will be removed.
///
- pub set_focus: extern "C" fn(browser_host: *mut cef_browser_host, force_close: c_int),
+ pub set_focus: Option<extern "C" fn(browser_host: *mut cef_browser_host, force_close: c_int)>,
///
// Retrieve the window handle for this browser.
///
- pub get_window_handle: extern "C" fn(browser_host: *mut cef_browser_host) -> *mut cef_window_handle_t,
+ pub get_window_handle: Option<extern "C" fn(browser_host: *mut cef_browser_host) -> *mut cef_window_handle_t>,
///
// Retrieve the window handle of the browser that opened this browser. Will
// return NULL for non-popup windows. This function can be used in combination
// with custom handling of modal windows.
///
- pub get_opener_window_handle: extern "C" fn(browser_host: *mut cef_browser_host) -> *mut cef_window_handle_t,
+ pub get_opener_window_handle: Option<extern "C" fn(browser_host: *mut cef_browser_host) -> *mut cef_window_handle_t>,
///
// Returns the client for this browser.
///
- pub get_client: extern "C" fn(browser_host: *mut cef_browser_host) -> *mut cef_client_t,
+ pub get_client: Option<extern "C" fn(browser_host: *mut cef_browser_host) -> *mut cef_client_t>,
///
// Returns the request context for this browser.
///
- pub get_request_context: extern "C" fn(browser_host: *mut cef_browser_host) -> *mut cef_request_context_t,
+ pub get_request_context: Option<extern "C" fn(browser_host: *mut cef_browser_host) -> *mut cef_request_context_t>,
///
// Get the current zoom level. The default zoom level is 0.0. This function
// can only be called on the UI thread.
///
- pub get_zoom_level: extern "C" fn(browser_host: *mut cef_browser_host) -> c_double,
+ pub get_zoom_level: Option<extern "C" fn(browser_host: *mut cef_browser_host) -> c_double>,
///
// Change the zoom level to the specified value. Specify 0.0 to reset the zoom
// level. If called on the UI thread the change will be applied immediately.
// Otherwise, the change will be applied asynchronously on the UI thread.
///
- pub set_zoom_level: extern "C" fn(browser_host: *mut cef_browser_host, zoomLevel: c_double),
+ pub set_zoom_level: Option<extern "C" fn(browser_host: *mut cef_browser_host, zoomLevel: c_double)>,
///
// Call to run a file chooser dialog. Only a single file chooser dialog may be
@@ -1306,20 +1306,20 @@ pub struct cef_browser_host {
// dialog is already pending. The dialog will be initiated asynchronously on
// the UI thread.
///
- pub run_file_dialog: extern "C" fn(browser_host: *mut cef_browser_host,
+ pub run_file_dialog: Option<extern "C" fn(browser_host: *mut cef_browser_host,
mode: cef_file_dialog_mode_t, title: *const cef_string_t,
default_file_name: *const cef_string_t, accept_types: *mut cef_string_list_t,
- callback: *mut cef_run_file_dialog_callback),
+ callback: *mut cef_run_file_dialog_callback)>,
///
// Download the file at |url| using cef_download_handler_t.
///
- pub start_download: extern "C" fn(browser_host: *mut cef_browser_host, url: *const cef_string_t),
+ pub start_download: Option<extern "C" fn(browser_host: *mut cef_browser_host, url: *const cef_string_t)>,
///
// Print the current browser contents.
///
- pub print: extern "C" fn(browser_host: *mut cef_browser_host),
+ pub print: Option<extern "C" fn(browser_host: *mut cef_browser_host)>,
///
// Search for |searchText|. |identifier| can be used to have multiple searches
@@ -1328,43 +1328,43 @@ pub struct cef_browser_host {
// be case-sensitive. |findNext| indicates whether this is the first request
// or a follow-up.
///
- pub find: extern "C" fn(browser_host: *mut cef_browser_host, identifier: c_int, searchText: *const cef_string_t,
- forward: c_int, matchCase: c_int, findNext: c_int),
+ pub find: Option<extern "C" fn(browser_host: *mut cef_browser_host, identifier: c_int, searchText: *const cef_string_t,
+ forward: c_int, matchCase: c_int, findNext: c_int)>,
///
// Cancel all searches that are currently going on.
///
- pub stop_finding: extern "C" fn(browser_host: *mut cef_browser_host, clearSelection: c_int),
+ pub stop_finding: Option<extern "C" fn(browser_host: *mut cef_browser_host, clearSelection: c_int)>,
///
// Open developer tools in its own window.
///
- pub show_dev_tools: extern "C" fn(browser_host: *mut cef_browser_host,
+ pub show_dev_tools: Option<extern "C" fn(browser_host: *mut cef_browser_host,
windowInfo: *const cef_window_info_t,
client: *mut cef_client_t,
- settings: *const cef_browser_settings_t),
+ settings: *const cef_browser_settings_t)>,
///
// Explicitly close the developer tools window if one exists for this browser
// instance.
///
- pub close_dev_tools: extern "C" fn(browser_host: *mut cef_browser_host),
+ pub close_dev_tools: Option<extern "C" fn(browser_host: *mut cef_browser_host)>,
///
// Set whether mouse cursor change is disabled.
///
- pub set_mouse_cursor_change_disabled: extern "C" fn(browser_host: *mut cef_browser_host,
- disabled: c_int),
+ pub set_mouse_cursor_change_disabled: Option<extern "C" fn(browser_host: *mut cef_browser_host,
+ disabled: c_int)>,
///
// Returns true (1) if mouse cursor change is disabled.
///
- pub is_mouse_cursor_change_disabled: extern "C" fn(browser_host: *mut cef_browser_host) -> c_int,
+ pub is_mouse_cursor_change_disabled: Option<extern "C" fn(browser_host: *mut cef_browser_host) -> c_int>,
///
// Returns true (1) if window rendering is disabled.
///
- pub is_window_rendering_disabled: extern "C" fn(browser_host: *mut cef_browser_host) -> c_int,
+ pub is_window_rendering_disabled: Option<extern "C" fn(browser_host: *mut cef_browser_host) -> c_int>,
///
// Notify the browser that the widget has been resized. The browser will first
@@ -1372,14 +1372,14 @@ pub struct cef_browser_host {
// cef_render_handler_t::OnPaint asynchronously with the updated regions. This
// function is only used when window rendering is disabled.
///
- pub was_resized: extern "C" fn(browser_host: *mut cef_browser_host),
+ pub was_resized: Option<extern "C" fn(browser_host: *mut cef_browser_host)>,
///
// Notify the browser that it has been hidden or shown. Layouting and
// cef_render_handler_t::OnPaint notification will stop when the browser is
// hidden. This function is only used when window rendering is disabled.
///
- pub was_hidden: extern "C" fn(browser_host: *mut cef_browser_host, hidden: c_int),
+ pub was_hidden: Option<extern "C" fn(browser_host: *mut cef_browser_host, hidden: c_int)>,
///
// Send a notification to the browser that the screen info has changed. The
@@ -1389,37 +1389,37 @@ pub struct cef_browser_host {
// current display. This function is only used when window rendering is
// disabled.
///
- pub notify_screen_info_changed: extern "C" fn(browser_host: *mut cef_browser_host),
+ pub notify_screen_info_changed: Option<extern "C" fn(browser_host: *mut cef_browser_host)>,
///
// Invalidate the |dirtyRect| region of the view. The browser will call
// cef_render_handler_t::OnPaint asynchronously with the updated regions. This
// function is only used when window rendering is disabled.
///
- pub invalidate: extern "C" fn(browser_host: *mut cef_browser_host,
- dirtyRect: *const cef_rect, t: cef_paint_element_type_t),
+ pub invalidate: Option<extern "C" fn(browser_host: *mut cef_browser_host,
+ dirtyRect: *const cef_rect, t: cef_paint_element_type_t)>,
///
// Send a key event to the browser.
///
- pub send_key_event: extern "C" fn(browser_host: *mut cef_browser_host,
- event: *const cef_key_event),
+ pub send_key_event: Option<extern "C" fn(browser_host: *mut cef_browser_host,
+ event: *const cef_key_event)>,
///
// Send a mouse click event to the browser. The |x| and |y| coordinates are
// relative to the upper-left corner of the view.
///
- pub send_mouse_click_event: extern "C" fn(browser_host: *mut cef_browser_host,
+ pub send_mouse_click_event: Option<extern "C" fn(browser_host: *mut cef_browser_host,
event: *const cef_mouse_event,
t: cef_mouse_button_type_t,
- mouseUp: c_int, clickCount: c_int),
+ mouseUp: c_int, clickCount: c_int)>,
///
// Send a mouse move event to the browser. The |x| and |y| coordinates are
// relative to the upper-left corner of the view.
///
- pub send_mouse_move_event: extern "C" fn(browser_host: *mut cef_browser_host,
- event: *const cef_mouse_event, mouseLeave: c_int),
+ pub send_mouse_move_event: Option<extern "C" fn(browser_host: *mut cef_browser_host,
+ event: *const cef_mouse_event, mouseLeave: c_int)>,
///
// Send a mouse wheel event to the browser. The |x| and |y| coordinates are
@@ -1428,37 +1428,37 @@ pub struct cef_browser_host {
// In order to scroll inside select popups with window rendering disabled
// cef_render_handler_t::GetScreenPoint should be implemented properly.
///
- pub send_mouse_wheel_event: extern "C" fn(browser_host: *mut cef_browser_host,
- event: *const cef_mouse_event, deltaX: c_int, deltaY: c_int),
+ pub send_mouse_wheel_event: Option<extern "C" fn(browser_host: *mut cef_browser_host,
+ event: *const cef_mouse_event, deltaX: c_int, deltaY: c_int)>,
///
// Send a focus event to the browser.
///
- pub send_focus_event: extern "C" fn(browser_host: *mut cef_browser_host, setFocus: c_int),
+ pub send_focus_event: Option<extern "C" fn(browser_host: *mut cef_browser_host, setFocus: c_int)>,
///
// Send a capture lost event to the browser.
///
- pub send_capture_lost_event: extern "C" fn(browser_host: *mut cef_browser_host),
+ pub send_capture_lost_event: Option<extern "C" fn(browser_host: *mut cef_browser_host)>,
///
// Get the NSTextInputContext implementation for enabling IME on Mac when
// window rendering is disabled.
///
- pub get_nstext_input_context: extern "C" fn(browser_host: *mut cef_browser_host) -> cef_text_input_context_t,
+ pub get_nstext_input_context: Option<extern "C" fn(browser_host: *mut cef_browser_host) -> cef_text_input_context_t>,
///
// Handles a keyDown event prior to passing it through the NSTextInputClient
// machinery.
///
- pub handle_key_event_before_text_input_client: extern "C" fn(browser_host: *mut cef_browser_host,
- key_event: *mut cef_event_handle_t),
+ pub handle_key_event_before_text_input_client: Option<extern "C" fn(browser_host: *mut cef_browser_host,
+ key_event: *mut cef_event_handle_t)>,
///
// Performs any additional actions after NSTextInputClient handles the event.
///
- pub handle_key_event_after_text_input_client: extern "C" fn(browser_host: *mut cef_browser_host,
- key_event: *mut cef_event_handle_t),
+ pub handle_key_event_after_text_input_client: Option<extern "C" fn(browser_host: *mut cef_browser_host,
+ key_event: *mut cef_event_handle_t)>,
}
@@ -1479,112 +1479,112 @@ pub struct cef_browser {
// Returns the browser host object. This function can only be called in the
// browser process.
///
- pub get_host: extern "C" fn(browser: *mut cef_browser) -> *mut cef_browser_host,
+ pub get_host: Option<extern "C" fn(browser: *mut cef_browser) -> *mut cef_browser_host>,
///
// Returns true (1) if the browser can navigate backwards.
///
- pub can_go_back: extern "C" fn(browser: *mut cef_browser) -> c_int,
+ pub can_go_back: Option<extern "C" fn(browser: *mut cef_browser) -> c_int>,
///
// Navigate backwards.
///
- pub go_back: extern "C" fn(browser: *mut cef_browser),
+ pub go_back: Option<extern "C" fn(browser: *mut cef_browser)>,
///
// Returns true (1) if the browser can navigate forwards.
///
- pub can_go_forward: extern "C" fn(browser: *mut cef_browser) -> c_int,
+ pub can_go_forward: Option<extern "C" fn(browser: *mut cef_browser) -> c_int>,
///
// Navigate forwards.
///
- pub go_forward: extern "C" fn(browser: *mut cef_browser),
+ pub go_forward: Option<extern "C" fn(browser: *mut cef_browser)>,
///
// Returns true (1) if the browser is currently loading.
///
- pub is_loading: extern "C" fn(browser: *mut cef_browser) -> c_int,
+ pub is_loading: Option<extern "C" fn(browser: *mut cef_browser) -> c_int>,
///
// Reload the current page.
///
- pub reload: extern "C" fn(browser: *mut cef_browser),
+ pub reload: Option<extern "C" fn(browser: *mut cef_browser)>,
///
// Reload the current page ignoring any cached data.
///
- pub reload_ignore_cache: extern "C" fn(browser: *mut cef_browser),
+ pub reload_ignore_cache: Option<extern "C" fn(browser: *mut cef_browser)>,
///
// Stop loading the page.
///
- pub stop_load: extern "C" fn(browser: *mut cef_browser),
+ pub stop_load: Option<extern "C" fn(browser: *mut cef_browser)>,
///
// Returns the globally unique identifier for this browser.
///
- pub get_identifier: extern "C" fn(browser: *mut cef_browser) -> c_int,
+ pub get_identifier: Option<extern "C" fn(browser: *mut cef_browser) -> c_int>,
///
// Returns true (1) if this object is pointing to the same handle as |that|
// object.
///
- pub is_same: extern "C" fn(browser: *mut cef_browser, that: *mut cef_browser) -> c_int,
+ pub is_same: Option<extern "C" fn(browser: *mut cef_browser, that: *mut cef_browser) -> c_int>,
///
// Returns true (1) if the window is a popup window.
///
- pub is_popup: extern "C" fn(browser: *mut cef_browser) -> c_int,
+ pub is_popup: Option<extern "C" fn(browser: *mut cef_browser) -> c_int>,
///
// Returns true (1) if a document has been loaded in the browser.
///
- pub has_document: extern "C" fn(browser: *mut cef_browser) -> c_int,
+ pub has_document: Option<extern "C" fn(browser: *mut cef_browser) -> c_int>,
///
// Returns the main (top-level) frame for the browser window.
///
- pub get_main_frame: extern "C" fn(browser: *mut cef_browser) -> *mut cef_frame,
+ pub get_main_frame: Option<extern "C" fn(browser: *mut cef_browser) -> *mut cef_frame>,
///
// Returns the focused frame for the browser window.
///
- pub get_focused_frame: extern "C" fn(browser: *mut cef_browser) -> *mut cef_frame,
+ pub get_focused_frame: Option<extern "C" fn(browser: *mut cef_browser) -> *mut cef_frame>,
///
// Returns the frame with the specified identifier, or NULL if not found.
///
- pub get_frame_byident: extern "C" fn(browser: *mut cef_browser, identifier: c_longlong) -> *mut cef_frame,
+ pub get_frame_byident: Option<extern "C" fn(browser: *mut cef_browser, identifier: c_longlong) -> *mut cef_frame>,
///
// Returns the frame with the specified name, or NULL if not found.
///
- pub get_frame: extern "C" fn(browser: *mut cef_browser, name: *const cef_string_t) -> *mut cef_frame,
+ pub get_frame: Option<extern "C" fn(browser: *mut cef_browser, name: *const cef_string_t) -> *mut cef_frame>,
///
// Returns the number of frames that currently exist.
///
- pub get_frame_count: extern "C" fn(browser: *mut cef_browser) -> size_t,
+ pub get_frame_count: Option<extern "C" fn(browser: *mut cef_browser) -> size_t>,
///
// Returns the identifiers of all existing frames.
///
- pub get_frame_identifiers: extern "C" fn(browser: *mut cef_browser,
+ pub get_frame_identifiers: Option<extern "C" fn(browser: *mut cef_browser,
identifiersCount: *mut size_t,
- identifiers: *mut c_longlong),
+ identifiers: *mut c_longlong)>,
///
// Returns the names of all existing frames.
///
- pub get_frame_names: extern "C" fn(browser: *mut cef_browser, names: *mut cef_string_list_t),
+ pub get_frame_names: Option<extern "C" fn(browser: *mut cef_browser, names: *mut cef_string_list_t)>,
//
// Send a message to the specified |target_process|. Returns true (1) if the
// message was sent successfully.
///
- pub send_process_message: extern "C" fn(browser: *mut cef_browser, target_process: cef_process_id_t,
- message: *mut cef_process_message) -> c_int,
+ pub send_process_message: Option<extern "C" fn(browser: *mut cef_browser, target_process: cef_process_id_t,
+ message: *mut cef_process_message) -> c_int>,
}
///
@@ -1605,41 +1605,41 @@ pub struct cef_render_process_handler {
// cef_browser_process_handler_t::on_render_process_thread_created(). Do not
// keep a reference to |extra_info| outside of this function.
///
- pub on_render_thread_created: extern "C" fn(render_handler: *mut cef_render_process_handler, extra_info: *mut cef_list_value),
+ pub on_render_thread_created: Option<extern "C" fn(render_handler: *mut cef_render_process_handler, extra_info: *mut cef_list_value)>,
///
// Called after WebKit has been initialized.
///
- pub on_web_kit_initialized: extern "C" fn(render_handler: *mut cef_render_process_handler),
+ pub on_web_kit_initialized: Option<extern "C" fn(render_handler: *mut cef_render_process_handler)>,
///
// Called after a browser has been created. When browsing cross-origin a new
// browser will be created before the old browser with the same identifier is
// destroyed.
///
- pub on_browser_created: extern "C" fn(render_handler: *mut cef_render_process_handler, browser: *mut cef_browser),
+ pub on_browser_created: Option<extern "C" fn(render_handler: *mut cef_render_process_handler, browser: *mut cef_browser)>,
///
// Called before a browser is destroyed.
///
- pub on_browser_destroyed: extern "C" fn(render_handler: *mut cef_render_process_handler, browser: *mut cef_browser),
+ pub on_browser_destroyed: Option<extern "C" fn(render_handler: *mut cef_render_process_handler, browser: *mut cef_browser)>,
///
// Return the handler for browser load status events.
///
- pub get_load_handler: extern "C" fn(render_handler: *mut cef_render_process_handler) -> *mut cef_load_handler,
+ pub get_load_handler: Option<extern "C" fn(render_handler: *mut cef_render_process_handler) -> *mut cef_load_handler>,
///
// Called before browser navigation. Return true (1) to cancel the navigation
// or false (0) to allow the navigation to proceed. The |request| object
// cannot be modified in this callback.
///
- pub on_before_navigation: extern "C" fn(render_handler: *mut cef_render_process_handler,
+ pub on_before_navigation: Option<extern "C" fn(render_handler: *mut cef_render_process_handler,
browser: *mut cef_browser,
frame: *mut cef_frame,
request: *mut cef_request,
navigation_type: *mut cef_navigation_type,
- is_redirect: c_int) -> c_int,
+ is_redirect: c_int) -> c_int>,
///
// Called immediately after the V8 context for a frame has been created. To
@@ -1649,31 +1649,31 @@ pub struct cef_render_process_handler {
// on the associated thread can be retrieved via the
// cef_v8context_t::get_task_runner() function.
///
- pub on_context_created: extern "C" fn(render_handler: *mut cef_render_process_handler,
+ pub on_context_created: Option<extern "C" fn(render_handler: *mut cef_render_process_handler,
browser: *mut cef_browser,
frame: *mut cef_frame,
- context: *mut cef_v8context),
+ context: *mut cef_v8context)>,
///
// Called immediately before the V8 context for a frame is released. No
// references to the context should be kept after this function is called.
///
- pub on_context_released: extern "C" fn(render_handler: *mut cef_render_process_handler,
+ pub on_context_released: Option<extern "C" fn(render_handler: *mut cef_render_process_handler,
browser: *mut cef_browser,
frame: *mut cef_frame,
- context: *mut cef_v8context),
+ context: *mut cef_v8context)>,
///
// Called for global uncaught exceptions in a frame. Execution of this
// callback is disabled by default. To enable set
// CefSettings.uncaught_exception_stack_size 0.
///
- pub on_uncaught_exception: extern "C" fn(render_handler: *mut cef_render_process_handler,
+ pub on_uncaught_exception: Option<extern "C" fn(render_handler: *mut cef_render_process_handler,
browser: *mut cef_browser,
frame: *mut cef_frame,
context: *mut cef_v8context,
exception: *mut cef_v8exception,
- stackTrace: *mut cef_v8stack_trace),
+ stackTrace: *mut cef_v8stack_trace)>,
///
// Called when a new node in the the browser gets focus. The |node| value may
@@ -1683,20 +1683,20 @@ pub struct cef_render_process_handler {
// keep references to or attempt to access any DOM objects outside the scope
// of this function.
///
- pub on_focused_node_changed: extern "C" fn(render_handler: *mut cef_render_process_handler,
+ pub on_focused_node_changed: Option<extern "C" fn(render_handler: *mut cef_render_process_handler,
browser: *mut cef_browser,
frame: *mut cef_frame,
- node: *mut cef_domnode),
+ node: *mut cef_domnode)>,
///
// Called when a new message is received from a different process. Return true
// (1) if the message was handled or false (0) otherwise. Do not keep a
// reference to or attempt to access the message outside of this callback.
///
- pub on_process_message_received: extern "C" fn(render_handler: *mut cef_render_process_handler,
+ pub on_process_message_received: Option<extern "C" fn(render_handler: *mut cef_render_process_handler,
browser: *mut cef_browser,
source_process: cef_process_id_t,
- message: *mut cef_process_message) ->c_int,
+ message: *mut cef_process_message) ->c_int>,
}
///
@@ -1721,7 +1721,7 @@ pub struct cef_app {
// modify command-line arguments for non-browser processes as this may result
// in undefined behavior including crashes.
///
- pub on_before_command_line_processing: extern "C" fn(app: *mut cef_app_t, process_type: *const cef_string_t, command_line: *mut cef_command_line),
+ pub on_before_command_line_processing: Option<extern "C" fn(app: *mut cef_app_t, process_type: *const cef_string_t, command_line: *mut cef_command_line)>,
///
// Provides an opportunity to register custom schemes. Do not keep a reference
@@ -1729,7 +1729,7 @@ pub struct cef_app {
// each process and the registered schemes should be the same across all
// processes.
///
- pub on_register_custom_schemes: extern "C" fn(app: *mut cef_app_t, registrar: *mut cef_scheme_registrar),
+ pub on_register_custom_schemes: Option<extern "C" fn(app: *mut cef_app_t, registrar: *mut cef_scheme_registrar)>,
///
// Return the handler for resource bundle events. If
@@ -1737,19 +1737,19 @@ pub struct cef_app {
// If no handler is returned resources will be loaded from pack files. This
// function is called by the browser and render processes on multiple threads.
///
- pub get_resource_bundle_handler: extern "C" fn(app: *mut cef_app_t) -> *mut cef_resource_bundle_handler,
+ pub get_resource_bundle_handler: Option<extern "C" fn(app: *mut cef_app_t) -> *mut cef_resource_bundle_handler>,
///
// Return the handler for functionality specific to the browser process. This
// function is called on multiple threads in the browser process.
///
- pub get_browser_process_handler: extern "C" fn(app: *mut cef_app_t) -> *mut cef_browser_process_handler,
+ pub get_browser_process_handler: Option<extern "C" fn(app: *mut cef_app_t) -> *mut cef_browser_process_handler>,
///
// Return the handler for functionality specific to the render process. This
// function is called on the render process main thread.
///
- pub get_render_process_handler: extern "C" fn(app: *mut cef_app_t) -> *mut cef_render_process_handler,
+ pub get_render_process_handler: Option<extern "C" fn(app: *mut cef_app_t) -> *mut cef_render_process_handler>,
}
@@ -1771,35 +1771,35 @@ pub struct cef_urlrequest {
// Returns the request object used to create this URL request. The returned
// object is read-only and should not be modified.
///
- pub get_request: extern "C" fn(url_req: *mut cef_urlrequest) -> *mut cef_request_t,
+ pub get_request: Option<extern "C" fn(url_req: *mut cef_urlrequest) -> *mut cef_request_t>,
///
// Returns the client.
///
- pub get_client: extern "C" fn(url_req: *mut cef_urlrequest) -> *mut cef_urlrequest_client_t,
+ pub get_client: Option<extern "C" fn(url_req: *mut cef_urlrequest) -> *mut cef_urlrequest_client_t>,
///
// Returns the request status.
///
- pub get_request_status: extern "C" fn(url_req: *mut cef_urlrequest) -> cef_urlrequest_status_t,
+ pub get_request_status: Option<extern "C" fn(url_req: *mut cef_urlrequest) -> cef_urlrequest_status_t>,
///
// Returns the request error if status is UR_CANCELED or UR_FAILED, or 0
// otherwise.
///
- pub get_request_error: extern "C" fn(url_req: *mut cef_urlrequest) -> cef_errorcode_t,
+ pub get_request_error: Option<extern "C" fn(url_req: *mut cef_urlrequest) -> cef_errorcode_t>,
///
// Returns the response, or NULL if no response information is available.
// Response information will only be available after the upload has completed.
// The returned object is read-only and should not be modified.
///
- pub get_response: extern "C" fn(url_req: *mut cef_urlrequest) -> *mut cef_response_t,
+ pub get_response: Option<extern "C" fn(url_req: *mut cef_urlrequest) -> *mut cef_response_t>,
///
// Cancel the request.
///
- pub cancel: extern "C" fn(url_req: *mut cef_urlrequest),
+ pub cancel: Option<extern "C" fn(url_req: *mut cef_urlrequest)>,
}
@@ -1818,47 +1818,47 @@ pub struct cef_post_data_element {
///
// Returns true (1) if this object is read-only.
///
- pub is_read_only: extern "C" fn(post_data_element: *mut cef_post_data_element) -> c_int,
+ pub is_read_only: Option<extern "C" fn(post_data_element: *mut cef_post_data_element) -> c_int>,
///
// Remove all contents from the post data element.
///
- pub set_to_empty: extern "C" fn(post_data_element: *mut cef_post_data_element),
+ pub set_to_empty: Option<extern "C" fn(post_data_element: *mut cef_post_data_element)>,
///
// The post data element will represent a file.
///
- pub set_to_file: extern "C" fn(post_data_element: *mut cef_post_data_element, fileName: *const cef_string_t),
+ pub set_to_file: Option<extern "C" fn(post_data_element: *mut cef_post_data_element, fileName: *const cef_string_t)>,
///
// The post data element will represent bytes. The bytes passed in will be
// copied.
///
- pub set_to_bytes: extern "C" fn(post_data_element: *mut cef_post_data_element,
- size: size_t, bytes: *const c_void),
+ pub set_to_bytes: Option<extern "C" fn(post_data_element: *mut cef_post_data_element,
+ size: size_t, bytes: *const c_void)>,
///
// Return the type of this post data element.
///
- pub get_type: extern "C" fn(post_data_element: *mut cef_post_data_element) -> cef_postdataelement_type_t,
+ pub get_type: Option<extern "C" fn(post_data_element: *mut cef_post_data_element) -> cef_postdataelement_type_t>,
///
// Return the file name.
///
// The resulting string must be freed by calling cef_string_userfree_free().
- pub get_file: extern "C" fn(post_data_element: *mut cef_post_data_element) -> *mut cef_string_userfree_t,
+ pub get_file: Option<extern "C" fn(post_data_element: *mut cef_post_data_element) -> *mut cef_string_userfree_t>,
///
// Return the number of bytes.
///
- pub get_bytes_count: extern "C" fn(post_data_element: *mut cef_post_data_element) -> size_t,
+ pub get_bytes_count: Option<extern "C" fn(post_data_element: *mut cef_post_data_element) -> size_t>,
///
// Read up to |size| bytes into |bytes| and return the number of bytes
// actually read.
///
- pub get_bytes: extern "C" fn(post_data_element: *mut cef_post_data_element,
- size: size_t, bytes: *mut c_void) -> size_t,
+ pub get_bytes: Option<extern "C" fn(post_data_element: *mut cef_post_data_element,
+ size: size_t, bytes: *mut c_void) -> size_t>,
}
@@ -1876,34 +1876,34 @@ pub struct cef_post_data {
///
// Returns true (1) if this object is read-only.
///
- pub is_read_only: extern "C" fn(post_data: *mut cef_post_data) -> c_int,
+ pub is_read_only: Option<extern "C" fn(post_data: *mut cef_post_data) -> c_int>,
///
// Returns the number of existing post data elements.
///
- pub get_element_count: extern "C" fn(post_data: *mut cef_post_data) -> size_t,
+ pub get_element_count: Option<extern "C" fn(post_data: *mut cef_post_data) -> size_t>,
///
// Retrieve the post data elements.
///
- pub get_elements: extern "C" fn(post_data: *mut cef_post_data,
- elements_count: *mut size_t, elements: *mut *mut cef_post_data_element),
+ pub get_elements: Option<extern "C" fn(post_data: *mut cef_post_data,
+ elements_count: *mut size_t, elements: *mut *mut cef_post_data_element)>,
///
// Remove the specified post data element. Returns true (1) if the removal
// succeeds.
///
- pub remove_element: extern "C" fn(post_data: *mut cef_post_data,
- element: *mut cef_post_data_element) -> c_int,
+ pub remove_element: Option<extern "C" fn(post_data: *mut cef_post_data,
+ element: *mut cef_post_data_element) -> c_int>,
///
// Add the specified post data element. Returns true (1) if the add succeeds.
///
- pub add_element: extern "C" fn(post_data: *mut cef_post_data,
- element: *mut cef_post_data_element) -> c_int,
+ pub add_element: Option<extern "C" fn(post_data: *mut cef_post_data,
+ element: *mut cef_post_data_element) -> c_int>,
///
// Remove all existing post data elements.
///
- pub remove_elements: extern "C" fn(post_data: *mut cef_post_data),
+ pub remove_elements: Option<extern "C" fn(post_data: *mut cef_post_data)>,
}