зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #5955 - Embedding rebase rage (from zmike:embedding-REBASE_RAGE); r=larsbergstrom
This updates all the CEF interface stuff to the current CEF codebase. Source-Repo: https://github.com/servo/servo Source-Revision: 92f46e3149df7de59aa5aa6700c1878958e2f273 --HG-- rename : servo/ports/cef/interfaces/cef_url.rs => servo/ports/cef/interfaces/cef_parser.rs
This commit is contained in:
Родитель
b5ec349295
Коммит
b31ab650b7
|
@ -10,12 +10,6 @@ How to test:
|
|||
|
||||
Notes:
|
||||
* Running with the Debug build in GDB is EXTREMELY slow on startup. Only use this if you are actively debugging an unimplemented CEF interaction.
|
||||
* The contents of `interfaces/`, with the exception of `interfaces/mod.rs` is autogenerated. To
|
||||
regenerate:
|
||||
- Check out the `servo` branch of the following repository:
|
||||
https://github.com/pcwalton/chromium-embedded-framework
|
||||
- Change to the `tools` directory and run `./translator.sh`
|
||||
- Run the following command to copy in the Rust header files, replacing `${SERVO_SRC}` with
|
||||
the path to your Servo checkout:
|
||||
$ cp ../libcef_dll/rust/*.rs ${SERVO_SRC}/ports/cef/interfaces/
|
||||
* The contents of `interfaces/` are entirely autogenerated. To
|
||||
regenerate, see https://github.com/zmike/cef-rebase/blob/master/README.md for full instructions
|
||||
|
||||
|
|
|
@ -2,15 +2,16 @@
|
|||
* 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 interfaces::cef_cookie_manager_t;
|
||||
use interfaces::{cef_completion_callback_t, cef_cookie_manager_t};
|
||||
use types::cef_string_t;
|
||||
|
||||
use libc::c_int;
|
||||
|
||||
cef_stub_static_method_impls! {
|
||||
fn cef_cookie_manager_get_global_manager() -> *mut cef_cookie_manager_t
|
||||
fn cef_cookie_manager_get_global_manager(callback: *mut cef_completion_callback_t) -> *mut cef_cookie_manager_t
|
||||
fn cef_cookie_manager_create_manager(path: *const cef_string_t,
|
||||
persist_session_cookies: c_int)
|
||||
persist_session_cookies: c_int,
|
||||
callback: *mut cef_completion_callback_t)
|
||||
-> *mut cef_cookie_manager_t
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -106,13 +107,13 @@ pub struct _cef_app_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_app_t = _cef_app_t;
|
||||
|
||||
|
@ -128,7 +129,8 @@ pub struct CefApp {
|
|||
impl Clone for CefApp {
|
||||
fn clone(&self) -> CefApp{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefApp {
|
||||
|
@ -141,7 +143,8 @@ impl Clone for CefApp {
|
|||
impl Drop for CefApp {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +159,8 @@ impl CefApp {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_app_t) -> CefApp {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefApp {
|
||||
|
@ -170,7 +174,8 @@ impl CefApp {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_app_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -178,10 +183,10 @@ impl CefApp {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -197,7 +202,8 @@ impl CefApp {
|
|||
//
|
||||
pub fn on_before_command_line_processing(&self, process_type: &[u16],
|
||||
command_line: interfaces::CefCommandLine) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -217,7 +223,8 @@ impl CefApp {
|
|||
//
|
||||
pub fn on_register_custom_schemes(&self,
|
||||
registrar: interfaces::CefSchemeRegistrar) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -236,7 +243,8 @@ impl CefApp {
|
|||
//
|
||||
pub fn get_resource_bundle_handler(
|
||||
&self) -> interfaces::CefResourceBundleHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -252,7 +260,8 @@ impl CefApp {
|
|||
//
|
||||
pub fn get_browser_process_handler(
|
||||
&self) -> interfaces::CefBrowserProcessHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -268,7 +277,8 @@ impl CefApp {
|
|||
//
|
||||
pub fn get_render_process_handler(
|
||||
&self) -> interfaces::CefRenderProcessHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -295,7 +305,8 @@ impl CefWrap<*mut cef_app_t> for Option<CefApp> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_app_t) -> Option<CefApp> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefApp::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -71,13 +72,13 @@ pub struct _cef_auth_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_auth_callback_t = _cef_auth_callback_t;
|
||||
|
||||
|
@ -93,7 +94,8 @@ pub struct CefAuthCallback {
|
|||
impl Clone for CefAuthCallback {
|
||||
fn clone(&self) -> CefAuthCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefAuthCallback {
|
||||
|
@ -106,7 +108,8 @@ impl Clone for CefAuthCallback {
|
|||
impl Drop for CefAuthCallback {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +124,8 @@ impl CefAuthCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_auth_callback_t) -> CefAuthCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefAuthCallback {
|
||||
|
@ -135,7 +139,8 @@ impl CefAuthCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_auth_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -143,17 +148,18 @@ impl CefAuthCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Continue the authentication request.
|
||||
//
|
||||
pub fn cont(&self, username: &[u16], password: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -169,7 +175,8 @@ impl CefAuthCallback {
|
|||
// Cancel the authentication request.
|
||||
//
|
||||
pub fn cancel(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -196,7 +203,8 @@ impl CefWrap<*mut cef_auth_callback_t> for Option<CefAuthCallback> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_auth_callback_t) -> Option<CefAuthCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefAuthCallback::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -96,13 +97,13 @@ pub struct _cef_browser_process_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_browser_process_handler_t = _cef_browser_process_handler_t;
|
||||
|
||||
|
@ -119,7 +120,8 @@ pub struct CefBrowserProcessHandler {
|
|||
impl Clone for CefBrowserProcessHandler {
|
||||
fn clone(&self) -> CefBrowserProcessHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefBrowserProcessHandler {
|
||||
|
@ -132,7 +134,8 @@ impl Clone for CefBrowserProcessHandler {
|
|||
impl Drop for CefBrowserProcessHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +150,8 @@ impl CefBrowserProcessHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_browser_process_handler_t) -> CefBrowserProcessHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefBrowserProcessHandler {
|
||||
|
@ -161,7 +165,8 @@ impl CefBrowserProcessHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_browser_process_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -169,10 +174,10 @@ impl CefBrowserProcessHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -180,7 +185,8 @@ impl CefBrowserProcessHandler {
|
|||
// has been initialized.
|
||||
//
|
||||
pub fn on_context_initialized(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -199,7 +205,8 @@ impl CefBrowserProcessHandler {
|
|||
//
|
||||
pub fn on_before_child_process_launch(&self,
|
||||
command_line: interfaces::CefCommandLine) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -219,7 +226,8 @@ impl CefBrowserProcessHandler {
|
|||
//
|
||||
pub fn on_render_process_thread_created(&self,
|
||||
extra_info: interfaces::CefListValue) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -235,7 +243,8 @@ impl CefBrowserProcessHandler {
|
|||
// provided then printing will not be supported on the Linux platform.
|
||||
//
|
||||
pub fn get_print_handler(&self) -> interfaces::CefPrintHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -262,7 +271,8 @@ impl CefWrap<*mut cef_browser_process_handler_t> for Option<CefBrowserProcessHan
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_browser_process_handler_t) -> Option<CefBrowserProcessHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefBrowserProcessHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -68,13 +69,13 @@ pub struct _cef_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_callback_t = _cef_callback_t;
|
||||
|
||||
|
@ -89,7 +90,8 @@ pub struct CefCallback {
|
|||
impl Clone for CefCallback {
|
||||
fn clone(&self) -> CefCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefCallback {
|
||||
|
@ -102,7 +104,8 @@ impl Clone for CefCallback {
|
|||
impl Drop for CefCallback {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +120,8 @@ impl CefCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_callback_t) -> CefCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefCallback {
|
||||
|
@ -131,7 +135,8 @@ impl CefCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -139,17 +144,18 @@ impl CefCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Continue processing.
|
||||
//
|
||||
pub fn cont(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -163,7 +169,8 @@ impl CefCallback {
|
|||
// Cancel processing.
|
||||
//
|
||||
pub fn cancel(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -190,7 +197,8 @@ impl CefWrap<*mut cef_callback_t> for Option<CefCallback> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_callback_t) -> Option<CefCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefCallback::from_c_object_addref(c_object))
|
||||
|
@ -218,13 +226,13 @@ pub struct _cef_completion_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_completion_callback_t = _cef_completion_callback_t;
|
||||
|
||||
|
@ -239,7 +247,8 @@ pub struct CefCompletionCallback {
|
|||
impl Clone for CefCompletionCallback {
|
||||
fn clone(&self) -> CefCompletionCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefCompletionCallback {
|
||||
|
@ -252,7 +261,8 @@ impl Clone for CefCompletionCallback {
|
|||
impl Drop for CefCompletionCallback {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -267,7 +277,8 @@ impl CefCompletionCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_completion_callback_t) -> CefCompletionCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefCompletionCallback {
|
||||
|
@ -281,7 +292,8 @@ impl CefCompletionCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_completion_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -289,17 +301,18 @@ impl CefCompletionCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Method that will be called once the task is complete.
|
||||
//
|
||||
pub fn on_complete(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -326,7 +339,8 @@ impl CefWrap<*mut cef_completion_callback_t> for Option<CefCompletionCallback> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_completion_callback_t) -> Option<CefCompletionCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefCompletionCallback::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -88,6 +89,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.
|
||||
//
|
||||
|
@ -151,13 +158,13 @@ pub struct _cef_client_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_client_t = _cef_client_t;
|
||||
|
||||
|
@ -172,7 +179,8 @@ pub struct CefClient {
|
|||
impl Clone for CefClient {
|
||||
fn clone(&self) -> CefClient{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefClient {
|
||||
|
@ -185,7 +193,8 @@ impl Clone for CefClient {
|
|||
impl Drop for CefClient {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +209,8 @@ impl CefClient {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_client_t) -> CefClient {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefClient {
|
||||
|
@ -214,7 +224,8 @@ impl CefClient {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_client_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -222,10 +233,10 @@ impl CefClient {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -233,7 +244,8 @@ impl CefClient {
|
|||
// implementation will be used.
|
||||
//
|
||||
pub fn get_context_menu_handler(&self) -> interfaces::CefContextMenuHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -248,7 +260,8 @@ impl CefClient {
|
|||
// implementation will be used.
|
||||
//
|
||||
pub fn get_dialog_handler(&self) -> interfaces::CefDialogHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -262,7 +275,8 @@ impl CefClient {
|
|||
// Return the handler for browser display state events.
|
||||
//
|
||||
pub fn get_display_handler(&self) -> interfaces::CefDisplayHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -277,7 +291,8 @@ impl CefClient {
|
|||
// will not be allowed.
|
||||
//
|
||||
pub fn get_download_handler(&self) -> interfaces::CefDownloadHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -291,7 +306,8 @@ impl CefClient {
|
|||
// Return the handler for drag events.
|
||||
//
|
||||
pub fn get_drag_handler(&self) -> interfaces::CefDragHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -301,11 +317,27 @@ impl CefClient {
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Return the handler for find result events.
|
||||
//
|
||||
pub fn get_find_handler(&self) -> interfaces::CefFindHandler {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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.
|
||||
//
|
||||
pub fn get_focus_handler(&self) -> interfaces::CefFocusHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -320,7 +352,8 @@ impl CefClient {
|
|||
// provided geolocation access will be denied by default.
|
||||
//
|
||||
pub fn get_geolocation_handler(&self) -> interfaces::CefGeolocationHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -335,7 +368,8 @@ impl CefClient {
|
|||
// default implementation will be used.
|
||||
//
|
||||
pub fn get_jsdialog_handler(&self) -> interfaces::CefJSDialogHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -349,7 +383,8 @@ impl CefClient {
|
|||
// Return the handler for keyboard events.
|
||||
//
|
||||
pub fn get_keyboard_handler(&self) -> interfaces::CefKeyboardHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -363,7 +398,8 @@ impl CefClient {
|
|||
// Return the handler for browser life span events.
|
||||
//
|
||||
pub fn get_life_span_handler(&self) -> interfaces::CefLifeSpanHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -377,7 +413,8 @@ impl CefClient {
|
|||
// Return the handler for browser load status events.
|
||||
//
|
||||
pub fn get_load_handler(&self) -> interfaces::CefLoadHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -391,7 +428,8 @@ impl CefClient {
|
|||
// Return the handler for off-screen rendering events.
|
||||
//
|
||||
pub fn get_render_handler(&self) -> interfaces::CefRenderHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -405,7 +443,8 @@ impl CefClient {
|
|||
// Return the handler for browser request events.
|
||||
//
|
||||
pub fn get_request_handler(&self) -> interfaces::CefRequestHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -423,7 +462,8 @@ impl CefClient {
|
|||
pub fn on_process_message_received(&self, browser: interfaces::CefBrowser,
|
||||
source_process: interfaces::CefProcessId,
|
||||
message: interfaces::CefProcessMessage) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -453,7 +493,8 @@ impl CefWrap<*mut cef_client_t> for Option<CefClient> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_client_t) -> Option<CefClient> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefClient::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -200,13 +201,13 @@ pub struct _cef_command_line_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_command_line_t = _cef_command_line_t;
|
||||
|
||||
|
@ -228,7 +229,8 @@ pub struct CefCommandLine {
|
|||
impl Clone for CefCommandLine {
|
||||
fn clone(&self) -> CefCommandLine{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefCommandLine {
|
||||
|
@ -241,7 +243,8 @@ impl Clone for CefCommandLine {
|
|||
impl Drop for CefCommandLine {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +259,8 @@ impl CefCommandLine {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_command_line_t) -> CefCommandLine {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefCommandLine {
|
||||
|
@ -270,7 +274,8 @@ impl CefCommandLine {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_command_line_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -278,10 +283,10 @@ impl CefCommandLine {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -289,7 +294,8 @@ impl CefCommandLine {
|
|||
// if this function returns false (0).
|
||||
//
|
||||
pub fn is_valid(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -304,7 +310,8 @@ impl CefCommandLine {
|
|||
// expose read-only objects.
|
||||
//
|
||||
pub fn is_read_only(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -318,7 +325,8 @@ impl CefCommandLine {
|
|||
// Returns a writable copy of this object.
|
||||
//
|
||||
pub fn copy(&self) -> interfaces::CefCommandLine {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -334,7 +342,8 @@ impl CefCommandLine {
|
|||
// supported on non-Windows platforms.
|
||||
//
|
||||
pub fn init_from_argv(&self, argc: libc::c_int, argv: &&str) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -351,7 +360,8 @@ impl CefCommandLine {
|
|||
// GetCommandLineW(). This function is only supported on Windows.
|
||||
//
|
||||
pub fn init_from_string(&self, command_line: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -367,7 +377,8 @@ impl CefCommandLine {
|
|||
// component unchanged.
|
||||
//
|
||||
pub fn reset(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -382,7 +393,8 @@ impl CefCommandLine {
|
|||
// array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* }
|
||||
//
|
||||
pub fn get_argv(&self, argv: Vec<String>) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -399,7 +411,8 @@ impl CefCommandLine {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_command_line_string(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -414,7 +427,8 @@ impl CefCommandLine {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_program(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -428,7 +442,8 @@ impl CefCommandLine {
|
|||
// Set the program part of the command line string (the first item).
|
||||
//
|
||||
pub fn set_program(&self, program: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -443,7 +458,8 @@ impl CefCommandLine {
|
|||
// Returns true (1) if the command line has switches.
|
||||
//
|
||||
pub fn has_switches(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -457,7 +473,8 @@ impl CefCommandLine {
|
|||
// Returns true (1) if the command line contains the given switch.
|
||||
//
|
||||
pub fn has_switch(&self, name: &[u16]) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -474,7 +491,8 @@ impl CefCommandLine {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_switch_value(&self, name: &[u16]) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -490,7 +508,8 @@ impl CefCommandLine {
|
|||
// NULL string is returned.
|
||||
//
|
||||
pub fn get_switches(&self, switches: HashMap<String,String>) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -506,7 +525,8 @@ impl CefCommandLine {
|
|||
// pass an NULL value string.
|
||||
//
|
||||
pub fn append_switch(&self, name: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -521,7 +541,8 @@ impl CefCommandLine {
|
|||
// Add a switch with the specified value to the end of the command line.
|
||||
//
|
||||
pub fn append_switch_with_value(&self, name: &[u16], value: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -537,7 +558,8 @@ impl CefCommandLine {
|
|||
// True if there are remaining command line arguments.
|
||||
//
|
||||
pub fn has_arguments(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -551,7 +573,8 @@ impl CefCommandLine {
|
|||
// Get the remaining command line arguments.
|
||||
//
|
||||
pub fn get_arguments(&self, arguments: Vec<String>) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -566,7 +589,8 @@ impl CefCommandLine {
|
|||
// Add an argument to the end of the command line.
|
||||
//
|
||||
pub fn append_argument(&self, argument: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -582,7 +606,8 @@ impl CefCommandLine {
|
|||
// "valgrind" or "gdb --args".
|
||||
//
|
||||
pub fn prepend_wrapper(&self, wrapper: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -633,7 +658,8 @@ impl CefWrap<*mut cef_command_line_t> for Option<CefCommandLine> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_command_line_t) -> Option<CefCommandLine> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefCommandLine::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -99,13 +100,13 @@ pub struct _cef_context_menu_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_context_menu_handler_t = _cef_context_menu_handler_t;
|
||||
|
||||
|
@ -121,7 +122,8 @@ pub struct CefContextMenuHandler {
|
|||
impl Clone for CefContextMenuHandler {
|
||||
fn clone(&self) -> CefContextMenuHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefContextMenuHandler {
|
||||
|
@ -134,7 +136,8 @@ impl Clone for CefContextMenuHandler {
|
|||
impl Drop for CefContextMenuHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +152,8 @@ impl CefContextMenuHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_context_menu_handler_t) -> CefContextMenuHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefContextMenuHandler {
|
||||
|
@ -163,7 +167,8 @@ impl CefContextMenuHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_context_menu_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -171,10 +176,10 @@ impl CefContextMenuHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -187,7 +192,8 @@ impl CefContextMenuHandler {
|
|||
pub fn on_before_context_menu(&self, browser: interfaces::CefBrowser,
|
||||
frame: interfaces::CefFrame, params: interfaces::CefContextMenuParams,
|
||||
model: interfaces::CefMenuModel) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -214,7 +220,8 @@ impl CefContextMenuHandler {
|
|||
frame: interfaces::CefFrame, params: interfaces::CefContextMenuParams,
|
||||
command_id: libc::c_int,
|
||||
event_flags: types::cef_event_flags_t) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -235,7 +242,8 @@ impl CefContextMenuHandler {
|
|||
//
|
||||
pub fn on_context_menu_dismissed(&self, browser: interfaces::CefBrowser,
|
||||
frame: interfaces::CefFrame) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -264,7 +272,8 @@ impl CefWrap<*mut cef_context_menu_handler_t> for Option<CefContextMenuHandler>
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_context_menu_handler_t) -> Option<CefContextMenuHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefContextMenuHandler::from_c_object_addref(c_object))
|
||||
|
@ -274,7 +283,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 +396,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
|
||||
|
@ -426,19 +428,19 @@ pub struct _cef_context_menu_params_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
|
@ -448,7 +450,8 @@ pub struct CefContextMenuParams {
|
|||
impl Clone for CefContextMenuParams {
|
||||
fn clone(&self) -> CefContextMenuParams{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefContextMenuParams {
|
||||
|
@ -461,7 +464,8 @@ impl Clone for CefContextMenuParams {
|
|||
impl Drop for CefContextMenuParams {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -476,7 +480,8 @@ impl CefContextMenuParams {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_context_menu_params_t) -> CefContextMenuParams {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefContextMenuParams {
|
||||
|
@ -490,7 +495,8 @@ impl CefContextMenuParams {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_context_menu_params_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -498,10 +504,10 @@ impl CefContextMenuParams {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -509,7 +515,8 @@ impl CefContextMenuParams {
|
|||
// Coords are relative to the associated RenderView's origin.
|
||||
//
|
||||
pub fn get_xcoord(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -524,7 +531,8 @@ impl CefContextMenuParams {
|
|||
// Coords are relative to the associated RenderView's origin.
|
||||
//
|
||||
pub fn get_ycoord(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -539,7 +547,8 @@ impl CefContextMenuParams {
|
|||
// invoked on.
|
||||
//
|
||||
pub fn get_type_flags(&self) -> types::cef_context_menu_type_flags_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -555,7 +564,8 @@ impl CefContextMenuParams {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_link_url(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -571,7 +581,8 @@ impl CefContextMenuParams {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_unfiltered_link_url(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -587,7 +598,8 @@ impl CefContextMenuParams {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_source_url(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -602,7 +614,8 @@ impl CefContextMenuParams {
|
|||
// NULL contents.
|
||||
//
|
||||
pub fn has_image_contents(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -617,7 +630,8 @@ impl CefContextMenuParams {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_page_url(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -632,7 +646,8 @@ impl CefContextMenuParams {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_frame_url(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -648,7 +663,8 @@ impl CefContextMenuParams {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_frame_charset(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -662,7 +678,8 @@ impl CefContextMenuParams {
|
|||
// Returns the type of context node that the context menu was invoked on.
|
||||
//
|
||||
pub fn get_media_type(&self) -> types::cef_context_menu_media_type_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -678,7 +695,8 @@ impl CefContextMenuParams {
|
|||
//
|
||||
pub fn get_media_state_flags(
|
||||
&self) -> types::cef_context_menu_media_state_flags_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -694,7 +712,8 @@ impl CefContextMenuParams {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_selection_text(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -710,7 +729,8 @@ impl CefContextMenuParams {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_misspelled_word(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -720,21 +740,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
|
||||
|
@ -742,7 +747,8 @@ impl CefContextMenuParams {
|
|||
//
|
||||
pub fn get_dictionary_suggestions(&self,
|
||||
suggestions: Vec<String>) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -757,7 +763,8 @@ impl CefContextMenuParams {
|
|||
// Returns true (1) if the context menu was invoked on an editable node.
|
||||
//
|
||||
pub fn is_editable(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -772,7 +779,8 @@ impl CefContextMenuParams {
|
|||
// spell-check is enabled.
|
||||
//
|
||||
pub fn is_spell_check_enabled(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -788,7 +796,8 @@ impl CefContextMenuParams {
|
|||
//
|
||||
pub fn get_edit_state_flags(
|
||||
&self) -> types::cef_context_menu_edit_state_flags_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -815,7 +824,8 @@ impl CefWrap<*mut cef_context_menu_params_t> for Option<CefContextMenuParams> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_context_menu_params_t) -> Option<CefContextMenuParams> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefContextMenuParams::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -58,26 +59,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 +90,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 +120,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>,
|
||||
|
@ -132,13 +139,13 @@ pub struct _cef_cookie_manager_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_cookie_manager_t = _cef_cookie_manager_t;
|
||||
|
||||
|
@ -154,7 +161,8 @@ pub struct CefCookieManager {
|
|||
impl Clone for CefCookieManager {
|
||||
fn clone(&self) -> CefCookieManager{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefCookieManager {
|
||||
|
@ -167,7 +175,8 @@ impl Clone for CefCookieManager {
|
|||
impl Drop for CefCookieManager {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +191,8 @@ impl CefCookieManager {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_cookie_manager_t) -> CefCookieManager {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefCookieManager {
|
||||
|
@ -196,7 +206,8 @@ impl CefCookieManager {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_cookie_manager_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -204,36 +215,42 @@ impl CefCookieManager {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// 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>) -> () {
|
||||
if self.c_object.is_null() {
|
||||
pub fn set_supported_schemes(&self, schemes: Vec<String>,
|
||||
callback: interfaces::CefCompletionCallback) -> () {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
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 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -245,15 +262,16 @@ 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 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -270,13 +288,15 @@ 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 {
|
||||
if self.c_object.is_null() {
|
||||
pub fn set_cookie(&self, url: &[u16], cookie: &interfaces::CefCookie,
|
||||
callback: interfaces::CefSetCookieCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -284,22 +304,26 @@ 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 {
|
||||
if self.c_object.is_null() {
|
||||
pub fn delete_cookies(&self, url: &[u16], cookie_name: &[u16],
|
||||
callback: interfaces::CefDeleteCookiesCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -307,7 +331,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,12 +342,15 @@ 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 {
|
||||
if self.c_object.is_null() {
|
||||
persist_session_cookies: libc::c_int,
|
||||
callback: interfaces::CefCompletionCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -330,18 +358,20 @@ 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 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -354,13 +384,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 +405,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)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -399,7 +436,8 @@ impl CefWrap<*mut cef_cookie_manager_t> for Option<CefCookieManager> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_cookie_manager_t) -> Option<CefCookieManager> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefCookieManager::from_c_object_addref(c_object))
|
||||
|
@ -433,13 +471,13 @@ pub struct _cef_cookie_visitor_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_cookie_visitor_t = _cef_cookie_visitor_t;
|
||||
|
||||
|
@ -455,7 +493,8 @@ pub struct CefCookieVisitor {
|
|||
impl Clone for CefCookieVisitor {
|
||||
fn clone(&self) -> CefCookieVisitor{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefCookieVisitor {
|
||||
|
@ -468,7 +507,8 @@ impl Clone for CefCookieVisitor {
|
|||
impl Drop for CefCookieVisitor {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -483,7 +523,8 @@ impl CefCookieVisitor {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_cookie_visitor_t) -> CefCookieVisitor {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefCookieVisitor {
|
||||
|
@ -497,7 +538,8 @@ impl CefCookieVisitor {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_cookie_visitor_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -505,10 +547,10 @@ impl CefCookieVisitor {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -520,7 +562,8 @@ impl CefCookieVisitor {
|
|||
//
|
||||
pub fn visit(&self, cookie: &interfaces::CefCookie, count: libc::c_int,
|
||||
total: libc::c_int, deleteCookie: &mut libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -551,7 +594,8 @@ impl CefWrap<*mut cef_cookie_visitor_t> for Option<CefCookieVisitor> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_cookie_visitor_t) -> Option<CefCookieVisitor> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefCookieVisitor::from_c_object_addref(c_object))
|
||||
|
@ -559,3 +603,298 @@ 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: u32,
|
||||
|
||||
//
|
||||
// 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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
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() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
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: u32,
|
||||
|
||||
//
|
||||
// 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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
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() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -56,11 +57,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) -> ()>,
|
||||
|
||||
//
|
||||
|
@ -72,13 +76,13 @@ pub struct _cef_file_dialog_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_file_dialog_callback_t = _cef_file_dialog_callback_t;
|
||||
|
||||
|
@ -93,7 +97,8 @@ pub struct CefFileDialogCallback {
|
|||
impl Clone for CefFileDialogCallback {
|
||||
fn clone(&self) -> CefFileDialogCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefFileDialogCallback {
|
||||
|
@ -106,7 +111,8 @@ impl Clone for CefFileDialogCallback {
|
|||
impl Drop for CefFileDialogCallback {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +127,8 @@ impl CefFileDialogCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_file_dialog_callback_t) -> CefFileDialogCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefFileDialogCallback {
|
||||
|
@ -135,7 +142,8 @@ impl CefFileDialogCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_file_dialog_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -143,25 +151,30 @@ impl CefFileDialogCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// 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>) -> () {
|
||||
if self.c_object.is_null() {
|
||||
pub fn cont(&self, selected_accept_filter: libc::c_int,
|
||||
file_paths: Vec<String>) -> () {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
CefWrap::to_rust(
|
||||
((*self.c_object).cont.unwrap())(
|
||||
self.c_object,
|
||||
CefWrap::to_c(selected_accept_filter),
|
||||
CefWrap::to_c(file_paths)))
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +183,8 @@ impl CefFileDialogCallback {
|
|||
// Cancel the file selection.
|
||||
//
|
||||
pub fn cancel(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -197,7 +211,8 @@ impl CefWrap<*mut cef_file_dialog_callback_t> for Option<CefFileDialogCallback>
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_file_dialog_callback_t) -> Option<CefFileDialogCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefFileDialogCallback::from_c_object_addref(c_object))
|
||||
|
@ -221,30 +236,35 @@ 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>,
|
||||
|
||||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_dialog_handler_t = _cef_dialog_handler_t;
|
||||
|
||||
|
@ -260,7 +280,8 @@ pub struct CefDialogHandler {
|
|||
impl Clone for CefDialogHandler {
|
||||
fn clone(&self) -> CefDialogHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefDialogHandler {
|
||||
|
@ -273,7 +294,8 @@ impl Clone for CefDialogHandler {
|
|||
impl Drop for CefDialogHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -288,7 +310,8 @@ impl CefDialogHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_dialog_handler_t) -> CefDialogHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefDialogHandler {
|
||||
|
@ -302,7 +325,8 @@ impl CefDialogHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_dialog_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -310,28 +334,34 @@ impl CefDialogHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// 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() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -341,8 +371,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)))
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +395,8 @@ impl CefWrap<*mut cef_dialog_handler_t> for Option<CefDialogHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_dialog_handler_t) -> Option<CefDialogHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefDialogHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -71,6 +72,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
|
||||
|
@ -103,13 +111,13 @@ pub struct _cef_display_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_display_handler_t = _cef_display_handler_t;
|
||||
|
||||
|
@ -125,7 +133,8 @@ pub struct CefDisplayHandler {
|
|||
impl Clone for CefDisplayHandler {
|
||||
fn clone(&self) -> CefDisplayHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefDisplayHandler {
|
||||
|
@ -138,7 +147,8 @@ impl Clone for CefDisplayHandler {
|
|||
impl Drop for CefDisplayHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +163,8 @@ impl CefDisplayHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_display_handler_t) -> CefDisplayHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefDisplayHandler {
|
||||
|
@ -167,7 +178,8 @@ impl CefDisplayHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_display_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -175,10 +187,10 @@ impl CefDisplayHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -186,7 +198,8 @@ impl CefDisplayHandler {
|
|||
//
|
||||
pub fn on_address_change(&self, browser: interfaces::CefBrowser,
|
||||
frame: interfaces::CefFrame, url: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -204,7 +217,8 @@ impl CefDisplayHandler {
|
|||
//
|
||||
pub fn on_title_change(&self, browser: interfaces::CefBrowser,
|
||||
title: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -216,6 +230,24 @@ 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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
|
||||
|
@ -226,7 +258,8 @@ impl CefDisplayHandler {
|
|||
//
|
||||
pub fn on_tooltip(&self, browser: interfaces::CefBrowser,
|
||||
text: *mut types::cef_string_t) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -244,7 +277,8 @@ impl CefDisplayHandler {
|
|||
//
|
||||
pub fn on_status_message(&self, browser: interfaces::CefBrowser,
|
||||
value: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -262,7 +296,8 @@ impl CefDisplayHandler {
|
|||
//
|
||||
pub fn on_console_message(&self, browser: interfaces::CefBrowser,
|
||||
message: &[u16], source: &[u16], line: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -293,7 +328,8 @@ impl CefWrap<*mut cef_display_handler_t> for Option<CefDisplayHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_display_handler_t) -> Option<CefDisplayHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefDisplayHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -69,13 +70,13 @@ pub struct _cef_domvisitor_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_domvisitor_t = _cef_domvisitor_t;
|
||||
|
||||
|
@ -91,7 +92,8 @@ pub struct CefDOMVisitor {
|
|||
impl Clone for CefDOMVisitor {
|
||||
fn clone(&self) -> CefDOMVisitor{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefDOMVisitor {
|
||||
|
@ -104,7 +106,8 @@ impl Clone for CefDOMVisitor {
|
|||
impl Drop for CefDOMVisitor {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +122,8 @@ impl CefDOMVisitor {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_domvisitor_t) -> CefDOMVisitor {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefDOMVisitor {
|
||||
|
@ -133,7 +137,8 @@ impl CefDOMVisitor {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_domvisitor_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -141,10 +146,10 @@ impl CefDOMVisitor {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -155,7 +160,8 @@ impl CefDOMVisitor {
|
|||
// of this function.
|
||||
//
|
||||
pub fn visit(&self, document: interfaces::CefDOMDocument) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -183,7 +189,8 @@ impl CefWrap<*mut cef_domvisitor_t> for Option<CefDOMVisitor> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_domvisitor_t) -> Option<CefDOMVisitor> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefDOMVisitor::from_c_object_addref(c_object))
|
||||
|
@ -252,24 +259,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.
|
||||
//
|
||||
|
@ -308,13 +303,13 @@ pub struct _cef_domdocument_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_domdocument_t = _cef_domdocument_t;
|
||||
|
||||
|
@ -330,7 +325,8 @@ pub struct CefDOMDocument {
|
|||
impl Clone for CefDOMDocument {
|
||||
fn clone(&self) -> CefDOMDocument{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefDOMDocument {
|
||||
|
@ -343,7 +339,8 @@ impl Clone for CefDOMDocument {
|
|||
impl Drop for CefDOMDocument {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -358,7 +355,8 @@ impl CefDOMDocument {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_domdocument_t) -> CefDOMDocument {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefDOMDocument {
|
||||
|
@ -372,7 +370,8 @@ impl CefDOMDocument {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_domdocument_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -380,17 +379,18 @@ impl CefDOMDocument {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Returns the document type.
|
||||
//
|
||||
pub fn get_type(&self) -> types::cef_dom_document_type_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -404,7 +404,8 @@ impl CefDOMDocument {
|
|||
// Returns the root document node.
|
||||
//
|
||||
pub fn get_document(&self) -> interfaces::CefDOMNode {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -418,7 +419,8 @@ impl CefDOMDocument {
|
|||
// Returns the BODY node of an HTML document.
|
||||
//
|
||||
pub fn get_body(&self) -> interfaces::CefDOMNode {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -432,7 +434,8 @@ impl CefDOMDocument {
|
|||
// Returns the HEAD node of an HTML document.
|
||||
//
|
||||
pub fn get_head(&self) -> interfaces::CefDOMNode {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -447,7 +450,8 @@ impl CefDOMDocument {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_title(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -461,7 +465,8 @@ impl CefDOMDocument {
|
|||
// Returns the document element with the specified ID value.
|
||||
//
|
||||
pub fn get_element_by_id(&self, id: &[u16]) -> interfaces::CefDOMNode {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -476,7 +481,8 @@ impl CefDOMDocument {
|
|||
// Returns the node that currently has keyboard focus.
|
||||
//
|
||||
pub fn get_focused_node(&self) -> interfaces::CefDOMNode {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -490,7 +496,8 @@ impl CefDOMDocument {
|
|||
// Returns true (1) if a portion of the document is selected.
|
||||
//
|
||||
pub fn has_selection(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -500,25 +507,12 @@ 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.
|
||||
//
|
||||
pub fn get_selection_start_offset(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -528,25 +522,12 @@ 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.
|
||||
//
|
||||
pub fn get_selection_end_offset(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -561,7 +542,8 @@ impl CefDOMDocument {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_selection_as_markup(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -576,7 +558,8 @@ impl CefDOMDocument {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_selection_as_text(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -591,7 +574,8 @@ impl CefDOMDocument {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_base_url(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -607,7 +591,8 @@ impl CefDOMDocument {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_complete_url(&self, partialURL: &[u16]) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -635,7 +620,8 @@ impl CefWrap<*mut cef_domdocument_t> for Option<CefDOMDocument> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_domdocument_t) -> Option<CefDOMDocument> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefDOMDocument::from_c_object_addref(c_object))
|
||||
|
@ -820,13 +806,13 @@ pub struct _cef_domnode_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_domnode_t = _cef_domnode_t;
|
||||
|
||||
|
@ -842,7 +828,8 @@ pub struct CefDOMNode {
|
|||
impl Clone for CefDOMNode {
|
||||
fn clone(&self) -> CefDOMNode{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefDOMNode {
|
||||
|
@ -855,7 +842,8 @@ impl Clone for CefDOMNode {
|
|||
impl Drop for CefDOMNode {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -870,7 +858,8 @@ impl CefDOMNode {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_domnode_t) -> CefDOMNode {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefDOMNode {
|
||||
|
@ -884,7 +873,8 @@ impl CefDOMNode {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_domnode_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -892,17 +882,18 @@ impl CefDOMNode {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Returns the type for this node.
|
||||
//
|
||||
pub fn get_type(&self) -> types::cef_dom_node_type_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -916,7 +907,8 @@ impl CefDOMNode {
|
|||
// Returns true (1) if this is a text node.
|
||||
//
|
||||
pub fn is_text(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -930,7 +922,8 @@ impl CefDOMNode {
|
|||
// Returns true (1) if this is an element node.
|
||||
//
|
||||
pub fn is_element(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -944,7 +937,8 @@ impl CefDOMNode {
|
|||
// Returns true (1) if this is an editable node.
|
||||
//
|
||||
pub fn is_editable(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -958,7 +952,8 @@ impl CefDOMNode {
|
|||
// Returns true (1) if this is a form control element node.
|
||||
//
|
||||
pub fn is_form_control_element(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -973,7 +968,8 @@ impl CefDOMNode {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_form_control_element_type(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -988,7 +984,8 @@ impl CefDOMNode {
|
|||
// object.
|
||||
//
|
||||
pub fn is_same(&self, that: interfaces::CefDOMNode) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1004,7 +1001,8 @@ impl CefDOMNode {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_name(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1019,7 +1017,8 @@ impl CefDOMNode {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_value(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1033,7 +1032,8 @@ impl CefDOMNode {
|
|||
// Set the value of this node. Returns true (1) on success.
|
||||
//
|
||||
pub fn set_value(&self, value: &[u16]) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1049,7 +1049,8 @@ impl CefDOMNode {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_as_markup(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1063,7 +1064,8 @@ impl CefDOMNode {
|
|||
// Returns the document associated with this node.
|
||||
//
|
||||
pub fn get_document(&self) -> interfaces::CefDOMDocument {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1077,7 +1079,8 @@ impl CefDOMNode {
|
|||
// Returns the parent node.
|
||||
//
|
||||
pub fn get_parent(&self) -> interfaces::CefDOMNode {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1091,7 +1094,8 @@ impl CefDOMNode {
|
|||
// Returns the previous sibling node.
|
||||
//
|
||||
pub fn get_previous_sibling(&self) -> interfaces::CefDOMNode {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1105,7 +1109,8 @@ impl CefDOMNode {
|
|||
// Returns the next sibling node.
|
||||
//
|
||||
pub fn get_next_sibling(&self) -> interfaces::CefDOMNode {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1119,7 +1124,8 @@ impl CefDOMNode {
|
|||
// Returns true (1) if this node has child nodes.
|
||||
//
|
||||
pub fn has_children(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1133,7 +1139,8 @@ impl CefDOMNode {
|
|||
// Return the first child node.
|
||||
//
|
||||
pub fn get_first_child(&self) -> interfaces::CefDOMNode {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1147,7 +1154,8 @@ impl CefDOMNode {
|
|||
// Returns the last child node.
|
||||
//
|
||||
pub fn get_last_child(&self) -> interfaces::CefDOMNode {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1165,7 +1173,8 @@ impl CefDOMNode {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_element_tag_name(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1179,7 +1188,8 @@ impl CefDOMNode {
|
|||
// Returns true (1) if this element has attributes.
|
||||
//
|
||||
pub fn has_element_attributes(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1193,7 +1203,8 @@ impl CefDOMNode {
|
|||
// Returns true (1) if this element has an attribute named |attrName|.
|
||||
//
|
||||
pub fn has_element_attribute(&self, attrName: &[u16]) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1209,7 +1220,8 @@ impl CefDOMNode {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_element_attribute(&self, attrName: &[u16]) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1224,7 +1236,8 @@ impl CefDOMNode {
|
|||
// Returns a map of all element attributes.
|
||||
//
|
||||
pub fn get_element_attributes(&self, attrMap: HashMap<String,String>) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1241,7 +1254,8 @@ impl CefDOMNode {
|
|||
//
|
||||
pub fn set_element_attribute(&self, attrName: &[u16],
|
||||
value: &[u16]) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1258,7 +1272,8 @@ impl CefDOMNode {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_element_inner_text(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1285,7 +1300,8 @@ impl CefWrap<*mut cef_domnode_t> for Option<CefDOMNode> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_domnode_t) -> Option<CefDOMNode> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefDOMNode::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -68,13 +69,13 @@ pub struct _cef_before_download_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_before_download_callback_t = _cef_before_download_callback_t;
|
||||
|
||||
|
@ -89,7 +90,8 @@ pub struct CefBeforeDownloadCallback {
|
|||
impl Clone for CefBeforeDownloadCallback {
|
||||
fn clone(&self) -> CefBeforeDownloadCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefBeforeDownloadCallback {
|
||||
|
@ -102,7 +104,8 @@ impl Clone for CefBeforeDownloadCallback {
|
|||
impl Drop for CefBeforeDownloadCallback {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +120,8 @@ impl CefBeforeDownloadCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_before_download_callback_t) -> CefBeforeDownloadCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefBeforeDownloadCallback {
|
||||
|
@ -131,7 +135,8 @@ impl CefBeforeDownloadCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_before_download_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -139,10 +144,10 @@ impl CefBeforeDownloadCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -152,7 +157,8 @@ impl CefBeforeDownloadCallback {
|
|||
// (1) if you do wish to show the default "Save As" dialog.
|
||||
//
|
||||
pub fn cont(&self, download_path: &[u16], show_dialog: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -181,7 +187,8 @@ impl CefWrap<*mut cef_before_download_callback_t> for Option<CefBeforeDownloadCa
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_before_download_callback_t) -> Option<CefBeforeDownloadCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefBeforeDownloadCallback::from_c_object_addref(c_object))
|
||||
|
@ -206,16 +213,28 @@ 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!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_download_item_callback_t = _cef_download_item_callback_t;
|
||||
|
||||
|
@ -230,7 +249,8 @@ pub struct CefDownloadItemCallback {
|
|||
impl Clone for CefDownloadItemCallback {
|
||||
fn clone(&self) -> CefDownloadItemCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefDownloadItemCallback {
|
||||
|
@ -243,7 +263,8 @@ impl Clone for CefDownloadItemCallback {
|
|||
impl Drop for CefDownloadItemCallback {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +279,8 @@ impl CefDownloadItemCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_download_item_callback_t) -> CefDownloadItemCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefDownloadItemCallback {
|
||||
|
@ -272,7 +294,8 @@ impl CefDownloadItemCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_download_item_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -280,17 +303,18 @@ impl CefDownloadItemCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Call to cancel the download.
|
||||
//
|
||||
pub fn cancel(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -299,6 +323,36 @@ impl CefDownloadItemCallback {
|
|||
self.c_object))
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Call to pause the download.
|
||||
//
|
||||
pub fn pause(&self) -> () {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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 {
|
||||
|
@ -317,7 +371,8 @@ impl CefWrap<*mut cef_download_item_callback_t> for Option<CefDownloadItemCallba
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_download_item_callback_t) -> Option<CefDownloadItemCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefDownloadItemCallback::from_c_object_addref(c_object))
|
||||
|
@ -367,13 +422,13 @@ pub struct _cef_download_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_download_handler_t = _cef_download_handler_t;
|
||||
|
||||
|
@ -389,7 +444,8 @@ pub struct CefDownloadHandler {
|
|||
impl Clone for CefDownloadHandler {
|
||||
fn clone(&self) -> CefDownloadHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefDownloadHandler {
|
||||
|
@ -402,7 +458,8 @@ impl Clone for CefDownloadHandler {
|
|||
impl Drop for CefDownloadHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -417,7 +474,8 @@ impl CefDownloadHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_download_handler_t) -> CefDownloadHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefDownloadHandler {
|
||||
|
@ -431,7 +489,8 @@ impl CefDownloadHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_download_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -439,10 +498,10 @@ impl CefDownloadHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -455,7 +514,8 @@ impl CefDownloadHandler {
|
|||
pub fn on_before_download(&self, browser: interfaces::CefBrowser,
|
||||
download_item: interfaces::CefDownloadItem, suggested_name: &[u16],
|
||||
callback: interfaces::CefBeforeDownloadCallback) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -479,7 +539,8 @@ impl CefDownloadHandler {
|
|||
pub fn on_download_updated(&self, browser: interfaces::CefBrowser,
|
||||
download_item: interfaces::CefDownloadItem,
|
||||
callback: interfaces::CefDownloadItemCallback) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -509,7 +570,8 @@ impl CefWrap<*mut cef_download_handler_t> for Option<CefDownloadHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_download_handler_t) -> Option<CefDownloadHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefDownloadHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -136,6 +137,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.
|
||||
//
|
||||
|
@ -160,13 +168,13 @@ pub struct _cef_download_item_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_download_item_t = _cef_download_item_t;
|
||||
|
||||
|
@ -181,7 +189,8 @@ pub struct CefDownloadItem {
|
|||
impl Clone for CefDownloadItem {
|
||||
fn clone(&self) -> CefDownloadItem{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefDownloadItem {
|
||||
|
@ -194,7 +203,8 @@ impl Clone for CefDownloadItem {
|
|||
impl Drop for CefDownloadItem {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +219,8 @@ impl CefDownloadItem {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_download_item_t) -> CefDownloadItem {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefDownloadItem {
|
||||
|
@ -223,7 +234,8 @@ impl CefDownloadItem {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_download_item_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -231,10 +243,10 @@ impl CefDownloadItem {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -242,7 +254,8 @@ impl CefDownloadItem {
|
|||
// if this function returns false (0).
|
||||
//
|
||||
pub fn is_valid(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -256,7 +269,8 @@ impl CefDownloadItem {
|
|||
// Returns true (1) if the download is in progress.
|
||||
//
|
||||
pub fn is_in_progress(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -270,7 +284,8 @@ impl CefDownloadItem {
|
|||
// Returns true (1) if the download is complete.
|
||||
//
|
||||
pub fn is_complete(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -284,7 +299,8 @@ impl CefDownloadItem {
|
|||
// Returns true (1) if the download has been canceled or interrupted.
|
||||
//
|
||||
pub fn is_canceled(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -298,7 +314,8 @@ impl CefDownloadItem {
|
|||
// Returns a simple speed estimate in bytes/s.
|
||||
//
|
||||
pub fn get_current_speed(&self) -> i64 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -313,7 +330,8 @@ impl CefDownloadItem {
|
|||
// unknown.
|
||||
//
|
||||
pub fn get_percent_complete(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -327,7 +345,8 @@ impl CefDownloadItem {
|
|||
// Returns the total number of bytes.
|
||||
//
|
||||
pub fn get_total_bytes(&self) -> i64 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -341,7 +360,8 @@ impl CefDownloadItem {
|
|||
// Returns the number of received bytes.
|
||||
//
|
||||
pub fn get_received_bytes(&self) -> i64 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -355,7 +375,8 @@ impl CefDownloadItem {
|
|||
// Returns the time that the download started.
|
||||
//
|
||||
pub fn get_start_time(&self) -> types::cef_time_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -369,7 +390,8 @@ impl CefDownloadItem {
|
|||
// Returns the time that the download ended.
|
||||
//
|
||||
pub fn get_end_time(&self) -> types::cef_time_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -384,7 +406,8 @@ impl CefDownloadItem {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_full_path(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -398,7 +421,8 @@ impl CefDownloadItem {
|
|||
// Returns the unique identifier for this download.
|
||||
//
|
||||
pub fn get_id(&self) -> u32 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -413,7 +437,8 @@ impl CefDownloadItem {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_url(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -423,12 +448,29 @@ 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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.
|
||||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_suggested_file_name(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -443,7 +485,8 @@ impl CefDownloadItem {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_content_disposition(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -458,7 +501,8 @@ impl CefDownloadItem {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_mime_type(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -485,7 +529,8 @@ impl CefWrap<*mut cef_download_item_t> for Option<CefDownloadItem> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_download_item_t) -> Option<CefDownloadItem> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefDownloadItem::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -204,13 +205,13 @@ pub struct _cef_drag_data_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_drag_data_t = _cef_drag_data_t;
|
||||
|
||||
|
@ -226,7 +227,8 @@ pub struct CefDragData {
|
|||
impl Clone for CefDragData {
|
||||
fn clone(&self) -> CefDragData{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefDragData {
|
||||
|
@ -239,7 +241,8 @@ impl Clone for CefDragData {
|
|||
impl Drop for CefDragData {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -254,7 +257,8 @@ impl CefDragData {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_drag_data_t) -> CefDragData {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefDragData {
|
||||
|
@ -268,7 +272,8 @@ impl CefDragData {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_drag_data_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -276,17 +281,18 @@ impl CefDragData {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Returns a copy of the current object.
|
||||
//
|
||||
pub fn clone(&self) -> interfaces::CefDragData {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -300,7 +306,8 @@ impl CefDragData {
|
|||
// Returns true (1) if this object is read-only.
|
||||
//
|
||||
pub fn is_read_only(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -314,7 +321,8 @@ impl CefDragData {
|
|||
// Returns true (1) if the drag data is a link.
|
||||
//
|
||||
pub fn is_link(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -328,7 +336,8 @@ impl CefDragData {
|
|||
// Returns true (1) if the drag data is a text or html fragment.
|
||||
//
|
||||
pub fn is_fragment(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -342,7 +351,8 @@ impl CefDragData {
|
|||
// Returns true (1) if the drag data is a file.
|
||||
//
|
||||
pub fn is_file(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -357,7 +367,8 @@ impl CefDragData {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_link_url(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -372,7 +383,8 @@ impl CefDragData {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_link_title(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -387,7 +399,8 @@ impl CefDragData {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_link_metadata(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -402,7 +415,8 @@ impl CefDragData {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_fragment_text(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -417,7 +431,8 @@ impl CefDragData {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_fragment_html(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -433,7 +448,8 @@ impl CefDragData {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_fragment_base_url(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -448,7 +464,8 @@ impl CefDragData {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_file_name(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -466,7 +483,8 @@ impl CefDragData {
|
|||
//
|
||||
pub fn get_file_contents(&self,
|
||||
writer: interfaces::CefStreamWriter) -> libc::size_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -482,7 +500,8 @@ impl CefDragData {
|
|||
// window.
|
||||
//
|
||||
pub fn get_file_names(&self, names: Vec<String>) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -497,7 +516,8 @@ impl CefDragData {
|
|||
// Set the link URL that is being dragged.
|
||||
//
|
||||
pub fn set_link_url(&self, url: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -512,7 +532,8 @@ impl CefDragData {
|
|||
// Set the title associated with the link being dragged.
|
||||
//
|
||||
pub fn set_link_title(&self, title: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -527,7 +548,8 @@ impl CefDragData {
|
|||
// Set the metadata associated with the link being dragged.
|
||||
//
|
||||
pub fn set_link_metadata(&self, data: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -542,7 +564,8 @@ impl CefDragData {
|
|||
// Set the plain text fragment that is being dragged.
|
||||
//
|
||||
pub fn set_fragment_text(&self, text: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -557,7 +580,8 @@ impl CefDragData {
|
|||
// Set the text/html fragment that is being dragged.
|
||||
//
|
||||
pub fn set_fragment_html(&self, html: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -572,7 +596,8 @@ impl CefDragData {
|
|||
// Set the base URL that the fragment came from.
|
||||
//
|
||||
pub fn set_fragment_base_url(&self, base_url: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -589,7 +614,8 @@ impl CefDragData {
|
|||
// to drag in this kind of data.
|
||||
//
|
||||
pub fn reset_file_contents(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -603,7 +629,8 @@ impl CefDragData {
|
|||
// Add a file that is being dragged into the webview.
|
||||
//
|
||||
pub fn add_file(&self, path: &[u16], display_name: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -643,7 +670,8 @@ impl CefWrap<*mut cef_drag_data_t> for Option<CefDragData> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_drag_data_t) -> Option<CefDragData> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefDragData::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -70,13 +71,13 @@ pub struct _cef_drag_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_drag_handler_t = _cef_drag_handler_t;
|
||||
|
||||
|
@ -92,7 +93,8 @@ pub struct CefDragHandler {
|
|||
impl Clone for CefDragHandler {
|
||||
fn clone(&self) -> CefDragHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefDragHandler {
|
||||
|
@ -105,7 +107,8 @@ impl Clone for CefDragHandler {
|
|||
impl Drop for CefDragHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +123,8 @@ impl CefDragHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_drag_handler_t) -> CefDragHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefDragHandler {
|
||||
|
@ -134,7 +138,8 @@ impl CefDragHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_drag_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -142,10 +147,10 @@ impl CefDragHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -157,7 +162,8 @@ impl CefDragHandler {
|
|||
pub fn on_drag_enter(&self, browser: interfaces::CefBrowser,
|
||||
dragData: interfaces::CefDragData,
|
||||
mask: types::cef_drag_operations_mask_t) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -187,7 +193,8 @@ impl CefWrap<*mut cef_drag_handler_t> for Option<CefDragHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_drag_handler_t) -> Option<CefDragHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefDragHandler::from_c_object_addref(c_object))
|
||||
|
|
|
@ -0,0 +1,212 @@
|
|||
// 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::mem;
|
||||
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: u32,
|
||||
|
||||
//
|
||||
// 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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
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() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -83,13 +84,13 @@ pub struct _cef_focus_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_focus_handler_t = _cef_focus_handler_t;
|
||||
|
||||
|
@ -105,7 +106,8 @@ pub struct CefFocusHandler {
|
|||
impl Clone for CefFocusHandler {
|
||||
fn clone(&self) -> CefFocusHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefFocusHandler {
|
||||
|
@ -118,7 +120,8 @@ impl Clone for CefFocusHandler {
|
|||
impl Drop for CefFocusHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +136,8 @@ impl CefFocusHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_focus_handler_t) -> CefFocusHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefFocusHandler {
|
||||
|
@ -147,7 +151,8 @@ impl CefFocusHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_focus_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -155,10 +160,10 @@ impl CefFocusHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -169,7 +174,8 @@ impl CefFocusHandler {
|
|||
//
|
||||
pub fn on_take_focus(&self, browser: interfaces::CefBrowser,
|
||||
next: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -188,7 +194,8 @@ impl CefFocusHandler {
|
|||
//
|
||||
pub fn on_set_focus(&self, browser: interfaces::CefBrowser,
|
||||
source: types::cef_focus_source_t) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -204,7 +211,8 @@ impl CefFocusHandler {
|
|||
// Called when the browser component has received focus.
|
||||
//
|
||||
pub fn on_got_focus(&self, browser: interfaces::CefBrowser) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -232,7 +240,8 @@ impl CefWrap<*mut cef_focus_handler_t> for Option<CefFocusHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_focus_handler_t) -> Option<CefFocusHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefFocusHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -214,13 +215,13 @@ pub struct _cef_frame_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_frame_t = _cef_frame_t;
|
||||
|
||||
|
@ -238,7 +239,8 @@ pub struct CefFrame {
|
|||
impl Clone for CefFrame {
|
||||
fn clone(&self) -> CefFrame{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefFrame {
|
||||
|
@ -251,7 +253,8 @@ impl Clone for CefFrame {
|
|||
impl Drop for CefFrame {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -266,7 +269,8 @@ impl CefFrame {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_frame_t) -> CefFrame {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefFrame {
|
||||
|
@ -280,7 +284,8 @@ impl CefFrame {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_frame_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -288,17 +293,18 @@ impl CefFrame {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// True if this object is currently attached to a valid frame.
|
||||
//
|
||||
pub fn is_valid(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -312,7 +318,8 @@ impl CefFrame {
|
|||
// Execute undo in this frame.
|
||||
//
|
||||
pub fn undo(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -326,7 +333,8 @@ impl CefFrame {
|
|||
// Execute redo in this frame.
|
||||
//
|
||||
pub fn redo(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -340,7 +348,8 @@ impl CefFrame {
|
|||
// Execute cut in this frame.
|
||||
//
|
||||
pub fn cut(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -354,7 +363,8 @@ impl CefFrame {
|
|||
// Execute copy in this frame.
|
||||
//
|
||||
pub fn copy(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -368,7 +378,8 @@ impl CefFrame {
|
|||
// Execute paste in this frame.
|
||||
//
|
||||
pub fn paste(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -382,7 +393,8 @@ impl CefFrame {
|
|||
// Execute delete in this frame.
|
||||
//
|
||||
pub fn del(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -396,7 +408,8 @@ impl CefFrame {
|
|||
// Execute select all in this frame.
|
||||
//
|
||||
pub fn select_all(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -412,7 +425,8 @@ impl CefFrame {
|
|||
// browser process.
|
||||
//
|
||||
pub fn view_source(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -427,7 +441,8 @@ impl CefFrame {
|
|||
// visitor.
|
||||
//
|
||||
pub fn get_source(&self, visitor: interfaces::CefStringVisitor) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -443,7 +458,8 @@ impl CefFrame {
|
|||
// visitor.
|
||||
//
|
||||
pub fn get_text(&self, visitor: interfaces::CefStringVisitor) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -458,7 +474,8 @@ impl CefFrame {
|
|||
// Load the request represented by the |request| object.
|
||||
//
|
||||
pub fn load_request(&self, request: interfaces::CefRequest) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -473,7 +490,8 @@ impl CefFrame {
|
|||
// Load the specified |url|.
|
||||
//
|
||||
pub fn load_url(&self, url: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -490,7 +508,8 @@ impl CefFrame {
|
|||
// link clicks and web security restrictions may not behave as expected.
|
||||
//
|
||||
pub fn load_string(&self, string_val: &[u16], url: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -511,7 +530,8 @@ impl CefFrame {
|
|||
//
|
||||
pub fn execute_java_script(&self, code: &[u16], script_url: &[u16],
|
||||
start_line: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -528,7 +548,8 @@ impl CefFrame {
|
|||
// Returns true (1) if this is the main (top-level) frame.
|
||||
//
|
||||
pub fn is_main(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -542,7 +563,8 @@ impl CefFrame {
|
|||
// Returns true (1) if this is the focused frame.
|
||||
//
|
||||
pub fn is_focused(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -561,7 +583,8 @@ impl CefFrame {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_name(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -575,7 +598,8 @@ impl CefFrame {
|
|||
// Returns the globally unique identifier for this frame.
|
||||
//
|
||||
pub fn get_identifier(&self) -> i64 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -590,7 +614,8 @@ impl CefFrame {
|
|||
// frame.
|
||||
//
|
||||
pub fn get_parent(&self) -> interfaces::CefFrame {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -605,7 +630,8 @@ impl CefFrame {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_url(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -619,7 +645,8 @@ impl CefFrame {
|
|||
// Returns the browser that this frame belongs to.
|
||||
//
|
||||
pub fn get_browser(&self) -> interfaces::CefBrowser {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -634,7 +661,8 @@ impl CefFrame {
|
|||
// called from the render process.
|
||||
//
|
||||
pub fn get_v8context(&self) -> interfaces::CefV8Context {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -649,7 +677,8 @@ impl CefFrame {
|
|||
// process.
|
||||
//
|
||||
pub fn visit_dom(&self, visitor: interfaces::CefDOMVisitor) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -677,7 +706,8 @@ impl CefWrap<*mut cef_frame_t> for Option<CefFrame> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_frame_t) -> Option<CefFrame> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefFrame::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -67,13 +68,13 @@ pub struct _cef_get_geolocation_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_get_geolocation_callback_t = _cef_get_geolocation_callback_t;
|
||||
|
||||
|
@ -89,7 +90,8 @@ pub struct CefGetGeolocationCallback {
|
|||
impl Clone for CefGetGeolocationCallback {
|
||||
fn clone(&self) -> CefGetGeolocationCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefGetGeolocationCallback {
|
||||
|
@ -102,7 +104,8 @@ impl Clone for CefGetGeolocationCallback {
|
|||
impl Drop for CefGetGeolocationCallback {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +120,8 @@ impl CefGetGeolocationCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_get_geolocation_callback_t) -> CefGetGeolocationCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefGetGeolocationCallback {
|
||||
|
@ -131,7 +135,8 @@ impl CefGetGeolocationCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_get_geolocation_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -139,10 +144,10 @@ impl CefGetGeolocationCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -151,7 +156,8 @@ impl CefGetGeolocationCallback {
|
|||
//
|
||||
pub fn on_location_update(&self, position: &interfaces::CefGeoposition) -> (
|
||||
) {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -179,7 +185,8 @@ impl CefWrap<*mut cef_get_geolocation_callback_t> for Option<CefGetGeolocationCa
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_get_geolocation_callback_t) -> Option<CefGetGeolocationCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefGetGeolocationCallback::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -65,13 +66,13 @@ pub struct _cef_geolocation_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_geolocation_callback_t = _cef_geolocation_callback_t;
|
||||
|
||||
|
@ -87,7 +88,8 @@ pub struct CefGeolocationCallback {
|
|||
impl Clone for CefGeolocationCallback {
|
||||
fn clone(&self) -> CefGeolocationCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefGeolocationCallback {
|
||||
|
@ -100,7 +102,8 @@ impl Clone for CefGeolocationCallback {
|
|||
impl Drop for CefGeolocationCallback {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +118,8 @@ impl CefGeolocationCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_geolocation_callback_t) -> CefGeolocationCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefGeolocationCallback {
|
||||
|
@ -129,7 +133,8 @@ impl CefGeolocationCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_geolocation_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -137,17 +142,18 @@ impl CefGeolocationCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Call to allow or deny geolocation access.
|
||||
//
|
||||
pub fn cont(&self, allow: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -175,7 +181,8 @@ impl CefWrap<*mut cef_geolocation_callback_t> for Option<CefGeolocationCallback>
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_geolocation_callback_t) -> Option<CefGeolocationCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefGeolocationCallback::from_c_object_addref(c_object))
|
||||
|
@ -224,13 +231,13 @@ pub struct _cef_geolocation_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_geolocation_handler_t = _cef_geolocation_handler_t;
|
||||
|
||||
|
@ -247,7 +254,8 @@ pub struct CefGeolocationHandler {
|
|||
impl Clone for CefGeolocationHandler {
|
||||
fn clone(&self) -> CefGeolocationHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefGeolocationHandler {
|
||||
|
@ -260,7 +268,8 @@ impl Clone for CefGeolocationHandler {
|
|||
impl Drop for CefGeolocationHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +284,8 @@ impl CefGeolocationHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_geolocation_handler_t) -> CefGeolocationHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefGeolocationHandler {
|
||||
|
@ -289,7 +299,8 @@ impl CefGeolocationHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_geolocation_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -297,10 +308,10 @@ impl CefGeolocationHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -315,7 +326,8 @@ impl CefGeolocationHandler {
|
|||
browser: interfaces::CefBrowser, requesting_url: &[u16],
|
||||
request_id: libc::c_int,
|
||||
callback: interfaces::CefGeolocationCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -337,7 +349,8 @@ impl CefGeolocationHandler {
|
|||
pub fn on_cancel_geolocation_permission(&self,
|
||||
browser: interfaces::CefBrowser, requesting_url: &[u16],
|
||||
request_id: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -367,7 +380,8 @@ impl CefWrap<*mut cef_geolocation_handler_t> for Option<CefGeolocationHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_geolocation_handler_t) -> Option<CefGeolocationHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefGeolocationHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -66,13 +67,13 @@ pub struct _cef_jsdialog_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_jsdialog_callback_t = _cef_jsdialog_callback_t;
|
||||
|
||||
|
@ -88,7 +89,8 @@ pub struct CefJSDialogCallback {
|
|||
impl Clone for CefJSDialogCallback {
|
||||
fn clone(&self) -> CefJSDialogCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefJSDialogCallback {
|
||||
|
@ -101,7 +103,8 @@ impl Clone for CefJSDialogCallback {
|
|||
impl Drop for CefJSDialogCallback {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +119,8 @@ impl CefJSDialogCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_jsdialog_callback_t) -> CefJSDialogCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefJSDialogCallback {
|
||||
|
@ -130,7 +134,8 @@ impl CefJSDialogCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_jsdialog_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -138,10 +143,10 @@ impl CefJSDialogCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -149,7 +154,8 @@ impl CefJSDialogCallback {
|
|||
// was pressed. The |user_input| value should be specified for prompt dialogs.
|
||||
//
|
||||
pub fn cont(&self, success: libc::c_int, user_input: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -178,7 +184,8 @@ impl CefWrap<*mut cef_jsdialog_callback_t> for Option<CefJSDialogCallback> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_jsdialog_callback_t) -> Option<CefJSDialogCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefJSDialogCallback::from_c_object_addref(c_object))
|
||||
|
@ -255,13 +262,13 @@ pub struct _cef_jsdialog_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_jsdialog_handler_t = _cef_jsdialog_handler_t;
|
||||
|
||||
|
@ -277,7 +284,8 @@ pub struct CefJSDialogHandler {
|
|||
impl Clone for CefJSDialogHandler {
|
||||
fn clone(&self) -> CefJSDialogHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefJSDialogHandler {
|
||||
|
@ -290,7 +298,8 @@ impl Clone for CefJSDialogHandler {
|
|||
impl Drop for CefJSDialogHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -305,7 +314,8 @@ impl CefJSDialogHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_jsdialog_handler_t) -> CefJSDialogHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefJSDialogHandler {
|
||||
|
@ -319,7 +329,8 @@ impl CefJSDialogHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_jsdialog_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -327,10 +338,10 @@ impl CefJSDialogHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -353,7 +364,8 @@ impl CefJSDialogHandler {
|
|||
message_text: &[u16], default_prompt_text: &[u16],
|
||||
callback: interfaces::CefJSDialogCallback,
|
||||
suppress_message: &mut libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -382,7 +394,8 @@ impl CefJSDialogHandler {
|
|||
pub fn on_before_unload_dialog(&self, browser: interfaces::CefBrowser,
|
||||
message_text: &[u16], is_reload: libc::c_int,
|
||||
callback: interfaces::CefJSDialogCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -402,7 +415,8 @@ impl CefJSDialogHandler {
|
|||
// dialogs are currently pending.
|
||||
//
|
||||
pub fn on_reset_dialog_state(&self, browser: interfaces::CefBrowser) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -417,7 +431,8 @@ impl CefJSDialogHandler {
|
|||
// Called when the default implementation dialog is closed.
|
||||
//
|
||||
pub fn on_dialog_closed(&self, browser: interfaces::CefBrowser) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -445,7 +460,8 @@ impl CefWrap<*mut cef_jsdialog_handler_t> for Option<CefJSDialogHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_jsdialog_handler_t) -> Option<CefJSDialogHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefJSDialogHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -81,13 +82,13 @@ pub struct _cef_keyboard_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_keyboard_handler_t = _cef_keyboard_handler_t;
|
||||
|
||||
|
@ -103,7 +104,8 @@ pub struct CefKeyboardHandler {
|
|||
impl Clone for CefKeyboardHandler {
|
||||
fn clone(&self) -> CefKeyboardHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefKeyboardHandler {
|
||||
|
@ -116,7 +118,8 @@ impl Clone for CefKeyboardHandler {
|
|||
impl Drop for CefKeyboardHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +134,8 @@ impl CefKeyboardHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_keyboard_handler_t) -> CefKeyboardHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefKeyboardHandler {
|
||||
|
@ -145,7 +149,8 @@ impl CefKeyboardHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_keyboard_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -153,10 +158,10 @@ impl CefKeyboardHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
// Called before a keyboard event is sent to the renderer. |event| contains
|
||||
|
@ -167,7 +172,8 @@ impl CefKeyboardHandler {
|
|||
pub fn on_pre_key_event(&self, browser: interfaces::CefBrowser,
|
||||
event: &interfaces::CefKeyEvent, os_event: types::cef_event_handle_t,
|
||||
is_keyboard_shortcut: &mut libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -190,7 +196,8 @@ impl CefKeyboardHandler {
|
|||
pub fn on_key_event(&self, browser: interfaces::CefBrowser,
|
||||
event: &interfaces::CefKeyEvent,
|
||||
os_event: types::cef_event_handle_t) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -220,7 +227,8 @@ impl CefWrap<*mut cef_keyboard_handler_t> for Option<CefKeyboardHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_keyboard_handler_t) -> Option<CefKeyboardHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefKeyboardHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -58,22 +59,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 +103,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
|
||||
|
@ -168,13 +176,13 @@ pub struct _cef_life_span_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_life_span_handler_t = _cef_life_span_handler_t;
|
||||
|
||||
|
@ -191,7 +199,8 @@ pub struct CefLifeSpanHandler {
|
|||
impl Clone for CefLifeSpanHandler {
|
||||
fn clone(&self) -> CefLifeSpanHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefLifeSpanHandler {
|
||||
|
@ -204,7 +213,8 @@ impl Clone for CefLifeSpanHandler {
|
|||
impl Drop for CefLifeSpanHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +229,8 @@ impl CefLifeSpanHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_life_span_handler_t) -> CefLifeSpanHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefLifeSpanHandler {
|
||||
|
@ -233,7 +244,8 @@ impl CefLifeSpanHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_life_span_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -241,32 +253,40 @@ impl CefLifeSpanHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// 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,
|
||||
no_javascript_access: &mut libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -277,6 +297,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),
|
||||
|
@ -289,7 +311,8 @@ impl CefLifeSpanHandler {
|
|||
// Called after a new browser is created.
|
||||
//
|
||||
pub fn on_after_created(&self, browser: interfaces::CefBrowser) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -306,7 +329,8 @@ impl CefLifeSpanHandler {
|
|||
// implementation or true (1) to use a custom implementation.
|
||||
//
|
||||
pub fn run_modal(&self, browser: interfaces::CefBrowser) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -318,7 +342,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
|
||||
|
@ -375,7 +399,8 @@ impl CefLifeSpanHandler {
|
|||
// exist.
|
||||
//
|
||||
pub fn do_close(&self, browser: interfaces::CefBrowser) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -395,7 +420,8 @@ impl CefLifeSpanHandler {
|
|||
// additional usage information.
|
||||
//
|
||||
pub fn on_before_close(&self, browser: interfaces::CefBrowser) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -423,7 +449,8 @@ impl CefWrap<*mut cef_life_span_handler_t> for Option<CefLifeSpanHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_life_span_handler_t) -> Option<CefLifeSpanHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefLifeSpanHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -108,13 +109,13 @@ pub struct _cef_load_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_load_handler_t = _cef_load_handler_t;
|
||||
|
||||
|
@ -131,7 +132,8 @@ pub struct CefLoadHandler {
|
|||
impl Clone for CefLoadHandler {
|
||||
fn clone(&self) -> CefLoadHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefLoadHandler {
|
||||
|
@ -144,7 +146,8 @@ impl Clone for CefLoadHandler {
|
|||
impl Drop for CefLoadHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +162,8 @@ impl CefLoadHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_load_handler_t) -> CefLoadHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefLoadHandler {
|
||||
|
@ -173,7 +177,8 @@ impl CefLoadHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_load_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -181,10 +186,10 @@ impl CefLoadHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -196,7 +201,8 @@ impl CefLoadHandler {
|
|||
pub fn on_loading_state_change(&self, browser: interfaces::CefBrowser,
|
||||
isLoading: libc::c_int, canGoBack: libc::c_int,
|
||||
canGoForward: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -221,7 +227,8 @@ impl CefLoadHandler {
|
|||
//
|
||||
pub fn on_load_start(&self, browser: interfaces::CefBrowser,
|
||||
frame: interfaces::CefFrame) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -243,7 +250,8 @@ impl CefLoadHandler {
|
|||
//
|
||||
pub fn on_load_end(&self, browser: interfaces::CefBrowser,
|
||||
frame: interfaces::CefFrame, httpStatusCode: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -265,7 +273,8 @@ impl CefLoadHandler {
|
|||
pub fn on_load_error(&self, browser: interfaces::CefBrowser,
|
||||
frame: interfaces::CefFrame, errorCode: types::cef_errorcode_t,
|
||||
errorText: &[u16], failedUrl: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -297,7 +306,8 @@ impl CefWrap<*mut cef_load_handler_t> for Option<CefLoadHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_load_handler_t) -> Option<CefLoadHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefLoadHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -401,13 +402,13 @@ pub struct _cef_menu_model_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_menu_model_t = _cef_menu_model_t;
|
||||
|
||||
|
@ -425,7 +426,8 @@ pub struct CefMenuModel {
|
|||
impl Clone for CefMenuModel {
|
||||
fn clone(&self) -> CefMenuModel{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefMenuModel {
|
||||
|
@ -438,7 +440,8 @@ impl Clone for CefMenuModel {
|
|||
impl Drop for CefMenuModel {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -453,7 +456,8 @@ impl CefMenuModel {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_menu_model_t) -> CefMenuModel {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefMenuModel {
|
||||
|
@ -467,7 +471,8 @@ impl CefMenuModel {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_menu_model_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -475,17 +480,18 @@ impl CefMenuModel {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Clears the menu. Returns true (1) on success.
|
||||
//
|
||||
pub fn clear(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -499,7 +505,8 @@ impl CefMenuModel {
|
|||
// Returns the number of items in this menu.
|
||||
//
|
||||
pub fn get_count(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -513,7 +520,8 @@ impl CefMenuModel {
|
|||
// Add a separator to the menu. Returns true (1) on success.
|
||||
//
|
||||
pub fn add_separator(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -528,7 +536,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn add_item(&self, command_id: libc::c_int,
|
||||
label: &[u16]) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -545,7 +554,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn add_check_item(&self, command_id: libc::c_int,
|
||||
label: &[u16]) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -563,7 +573,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn add_radio_item(&self, command_id: libc::c_int, label: &[u16],
|
||||
group_id: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -581,7 +592,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn add_sub_menu(&self, command_id: libc::c_int,
|
||||
label: &[u16]) -> interfaces::CefMenuModel {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -598,7 +610,8 @@ impl CefMenuModel {
|
|||
// on success.
|
||||
//
|
||||
pub fn insert_separator_at(&self, index: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -615,7 +628,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn insert_item_at(&self, index: libc::c_int, command_id: libc::c_int,
|
||||
label: &[u16]) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -634,7 +648,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn insert_check_item_at(&self, index: libc::c_int,
|
||||
command_id: libc::c_int, label: &[u16]) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -655,7 +670,8 @@ impl CefMenuModel {
|
|||
pub fn insert_radio_item_at(&self, index: libc::c_int,
|
||||
command_id: libc::c_int, label: &[u16],
|
||||
group_id: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -675,7 +691,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn insert_sub_menu_at(&self, index: libc::c_int, command_id: libc::c_int,
|
||||
label: &[u16]) -> interfaces::CefMenuModel {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -693,7 +710,8 @@ impl CefMenuModel {
|
|||
// success.
|
||||
//
|
||||
pub fn remove(&self, command_id: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -708,7 +726,8 @@ impl CefMenuModel {
|
|||
// Removes the item at the specified |index|. Returns true (1) on success.
|
||||
//
|
||||
pub fn remove_at(&self, index: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -724,7 +743,8 @@ impl CefMenuModel {
|
|||
// found due to the command id not existing in the menu.
|
||||
//
|
||||
pub fn get_index_of(&self, command_id: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -740,7 +760,8 @@ impl CefMenuModel {
|
|||
// invalid range or the index being a separator.
|
||||
//
|
||||
pub fn get_command_id_at(&self, index: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -756,7 +777,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn set_command_id_at(&self, index: libc::c_int,
|
||||
command_id: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -773,7 +795,8 @@ impl CefMenuModel {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_label(&self, command_id: libc::c_int) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -790,7 +813,8 @@ impl CefMenuModel {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_label_at(&self, index: libc::c_int) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -806,7 +830,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn set_label(&self, command_id: libc::c_int,
|
||||
label: &[u16]) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -822,7 +847,8 @@ impl CefMenuModel {
|
|||
// Set the label at the specified |index|. Returns true (1) on success.
|
||||
//
|
||||
pub fn set_label_at(&self, index: libc::c_int, label: &[u16]) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -839,7 +865,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn get_type(&self,
|
||||
command_id: libc::c_int) -> types::cef_menu_item_type_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -854,7 +881,8 @@ impl CefMenuModel {
|
|||
// Returns the item type at the specified |index|.
|
||||
//
|
||||
pub fn get_type_at(&self, index: libc::c_int) -> types::cef_menu_item_type_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -869,7 +897,8 @@ impl CefMenuModel {
|
|||
// Returns the group id for the specified |command_id| or -1 if invalid.
|
||||
//
|
||||
pub fn get_group_id(&self, command_id: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -884,7 +913,8 @@ impl CefMenuModel {
|
|||
// Returns the group id at the specified |index| or -1 if invalid.
|
||||
//
|
||||
pub fn get_group_id_at(&self, index: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -901,7 +931,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn set_group_id(&self, command_id: libc::c_int,
|
||||
group_id: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -918,7 +949,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn set_group_id_at(&self, index: libc::c_int,
|
||||
group_id: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -935,7 +967,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn get_sub_menu(&self,
|
||||
command_id: libc::c_int) -> interfaces::CefMenuModel {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -951,7 +984,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn get_sub_menu_at(&self,
|
||||
index: libc::c_int) -> interfaces::CefMenuModel {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -966,7 +1000,8 @@ impl CefMenuModel {
|
|||
// Returns true (1) if the specified |command_id| is visible.
|
||||
//
|
||||
pub fn is_visible(&self, command_id: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -981,7 +1016,8 @@ impl CefMenuModel {
|
|||
// Returns true (1) if the specified |index| is visible.
|
||||
//
|
||||
pub fn is_visible_at(&self, index: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -998,7 +1034,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn set_visible(&self, command_id: libc::c_int,
|
||||
visible: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1016,7 +1053,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn set_visible_at(&self, index: libc::c_int,
|
||||
visible: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1032,7 +1070,8 @@ impl CefMenuModel {
|
|||
// Returns true (1) if the specified |command_id| is enabled.
|
||||
//
|
||||
pub fn is_enabled(&self, command_id: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1047,7 +1086,8 @@ impl CefMenuModel {
|
|||
// Returns true (1) if the specified |index| is enabled.
|
||||
//
|
||||
pub fn is_enabled_at(&self, index: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1064,7 +1104,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn set_enabled(&self, command_id: libc::c_int,
|
||||
enabled: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1082,7 +1123,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn set_enabled_at(&self, index: libc::c_int,
|
||||
enabled: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1099,7 +1141,8 @@ impl CefMenuModel {
|
|||
// check and radio items.
|
||||
//
|
||||
pub fn is_checked(&self, command_id: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1115,7 +1158,8 @@ impl CefMenuModel {
|
|||
// and radio items.
|
||||
//
|
||||
pub fn is_checked_at(&self, index: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1132,7 +1176,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn set_checked(&self, command_id: libc::c_int,
|
||||
checked: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1150,7 +1195,8 @@ impl CefMenuModel {
|
|||
//
|
||||
pub fn set_checked_at(&self, index: libc::c_int,
|
||||
checked: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1167,7 +1213,8 @@ impl CefMenuModel {
|
|||
// assigned.
|
||||
//
|
||||
pub fn has_accelerator(&self, command_id: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1183,7 +1230,8 @@ impl CefMenuModel {
|
|||
// assigned.
|
||||
//
|
||||
pub fn has_accelerator_at(&self, index: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1201,7 +1249,8 @@ impl CefMenuModel {
|
|||
pub fn set_accelerator(&self, command_id: libc::c_int, key_code: libc::c_int,
|
||||
shift_pressed: libc::c_int, ctrl_pressed: libc::c_int,
|
||||
alt_pressed: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1223,7 +1272,8 @@ impl CefMenuModel {
|
|||
pub fn set_accelerator_at(&self, index: libc::c_int, key_code: libc::c_int,
|
||||
shift_pressed: libc::c_int, ctrl_pressed: libc::c_int,
|
||||
alt_pressed: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1243,7 +1293,8 @@ impl CefMenuModel {
|
|||
// true (1) on success.
|
||||
//
|
||||
pub fn remove_accelerator(&self, command_id: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1259,7 +1310,8 @@ impl CefMenuModel {
|
|||
// on success.
|
||||
//
|
||||
pub fn remove_accelerator_at(&self, index: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1278,7 +1330,8 @@ impl CefMenuModel {
|
|||
key_code: &mut libc::c_int, shift_pressed: &mut libc::c_int,
|
||||
ctrl_pressed: &mut libc::c_int,
|
||||
alt_pressed: &mut libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1301,7 +1354,8 @@ impl CefMenuModel {
|
|||
key_code: &mut libc::c_int, shift_pressed: &mut libc::c_int,
|
||||
ctrl_pressed: &mut libc::c_int,
|
||||
alt_pressed: &mut libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1333,7 +1387,8 @@ impl CefWrap<*mut cef_menu_model_t> for Option<CefMenuModel> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_menu_model_t) -> Option<CefMenuModel> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefMenuModel::from_c_object_addref(c_object))
|
||||
|
|
|
@ -0,0 +1,404 @@
|
|||
// 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::mem;
|
||||
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: u32,
|
||||
|
||||
//
|
||||
// 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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
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() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
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
|
||||
|
@ -43,4 +43,5 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
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
|
||||
|
@ -43,4 +43,5 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
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
|
||||
|
@ -43,4 +43,5 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -70,13 +71,13 @@ pub struct _cef_print_dialog_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_print_dialog_callback_t = _cef_print_dialog_callback_t;
|
||||
|
||||
|
@ -91,7 +92,8 @@ pub struct CefPrintDialogCallback {
|
|||
impl Clone for CefPrintDialogCallback {
|
||||
fn clone(&self) -> CefPrintDialogCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefPrintDialogCallback {
|
||||
|
@ -104,7 +106,8 @@ impl Clone for CefPrintDialogCallback {
|
|||
impl Drop for CefPrintDialogCallback {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +122,8 @@ impl CefPrintDialogCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_print_dialog_callback_t) -> CefPrintDialogCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefPrintDialogCallback {
|
||||
|
@ -133,7 +137,8 @@ impl CefPrintDialogCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_print_dialog_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -141,17 +146,18 @@ impl CefPrintDialogCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Continue printing with the specified |settings|.
|
||||
//
|
||||
pub fn cont(&self, settings: interfaces::CefPrintSettings) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -166,7 +172,8 @@ impl CefPrintDialogCallback {
|
|||
// Cancel the printing.
|
||||
//
|
||||
pub fn cancel(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -193,7 +200,8 @@ impl CefWrap<*mut cef_print_dialog_callback_t> for Option<CefPrintDialogCallback
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_print_dialog_callback_t) -> Option<CefPrintDialogCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefPrintDialogCallback::from_c_object_addref(c_object))
|
||||
|
@ -220,13 +228,13 @@ pub struct _cef_print_job_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_print_job_callback_t = _cef_print_job_callback_t;
|
||||
|
||||
|
@ -241,7 +249,8 @@ pub struct CefPrintJobCallback {
|
|||
impl Clone for CefPrintJobCallback {
|
||||
fn clone(&self) -> CefPrintJobCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefPrintJobCallback {
|
||||
|
@ -254,7 +263,8 @@ impl Clone for CefPrintJobCallback {
|
|||
impl Drop for CefPrintJobCallback {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +279,8 @@ impl CefPrintJobCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_print_job_callback_t) -> CefPrintJobCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefPrintJobCallback {
|
||||
|
@ -283,7 +294,8 @@ impl CefPrintJobCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_print_job_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -291,17 +303,18 @@ impl CefPrintJobCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Indicate completion of the print job.
|
||||
//
|
||||
pub fn cont(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -328,7 +341,8 @@ impl CefWrap<*mut cef_print_job_callback_t> for Option<CefPrintJobCallback> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_print_job_callback_t) -> Option<CefPrintJobCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefPrintJobCallback::from_c_object_addref(c_object))
|
||||
|
@ -385,13 +399,13 @@ pub struct _cef_print_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_print_handler_t = _cef_print_handler_t;
|
||||
|
||||
|
@ -407,7 +421,8 @@ pub struct CefPrintHandler {
|
|||
impl Clone for CefPrintHandler {
|
||||
fn clone(&self) -> CefPrintHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefPrintHandler {
|
||||
|
@ -420,7 +435,8 @@ impl Clone for CefPrintHandler {
|
|||
impl Drop for CefPrintHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -435,7 +451,8 @@ impl CefPrintHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_print_handler_t) -> CefPrintHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefPrintHandler {
|
||||
|
@ -449,7 +466,8 @@ impl CefPrintHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_print_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -457,10 +475,10 @@ impl CefPrintHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -470,7 +488,8 @@ impl CefPrintHandler {
|
|||
//
|
||||
pub fn on_print_settings(&self, settings: interfaces::CefPrintSettings,
|
||||
get_defaults: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -489,7 +508,8 @@ impl CefPrintHandler {
|
|||
//
|
||||
pub fn on_print_dialog(&self, has_selection: libc::c_int,
|
||||
callback: interfaces::CefPrintDialogCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -508,7 +528,8 @@ impl CefPrintHandler {
|
|||
//
|
||||
pub fn on_print_job(&self, document_name: &[u16], pdf_file_path: &[u16],
|
||||
callback: interfaces::CefPrintJobCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -525,7 +546,8 @@ impl CefPrintHandler {
|
|||
// Reset client state related to printing.
|
||||
//
|
||||
pub fn on_print_reset(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -552,7 +574,8 @@ impl CefWrap<*mut cef_print_handler_t> for Option<CefPrintHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_print_handler_t) -> Option<CefPrintHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefPrintHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -206,13 +207,13 @@ pub struct _cef_print_settings_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_print_settings_t = _cef_print_settings_t;
|
||||
|
||||
|
@ -227,7 +228,8 @@ pub struct CefPrintSettings {
|
|||
impl Clone for CefPrintSettings {
|
||||
fn clone(&self) -> CefPrintSettings{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefPrintSettings {
|
||||
|
@ -240,7 +242,8 @@ impl Clone for CefPrintSettings {
|
|||
impl Drop for CefPrintSettings {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +258,8 @@ impl CefPrintSettings {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_print_settings_t) -> CefPrintSettings {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefPrintSettings {
|
||||
|
@ -269,7 +273,8 @@ impl CefPrintSettings {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_print_settings_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -277,10 +282,10 @@ impl CefPrintSettings {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -288,7 +293,8 @@ impl CefPrintSettings {
|
|||
// if this function returns false (0).
|
||||
//
|
||||
pub fn is_valid(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -303,7 +309,8 @@ impl CefPrintSettings {
|
|||
// expose read-only objects.
|
||||
//
|
||||
pub fn is_read_only(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -317,7 +324,8 @@ impl CefPrintSettings {
|
|||
// Returns a writable copy of this object.
|
||||
//
|
||||
pub fn copy(&self) -> interfaces::CefPrintSettings {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -331,7 +339,8 @@ impl CefPrintSettings {
|
|||
// Set the page orientation.
|
||||
//
|
||||
pub fn set_orientation(&self, landscape: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -346,7 +355,8 @@ impl CefPrintSettings {
|
|||
// Returns true (1) if the orientation is landscape.
|
||||
//
|
||||
pub fn is_landscape(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -365,7 +375,8 @@ impl CefPrintSettings {
|
|||
physical_size_device_units: &types::cef_size_t,
|
||||
printable_area_device_units: &types::cef_rect_t,
|
||||
landscape_needs_flip: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -382,7 +393,8 @@ impl CefPrintSettings {
|
|||
// Set the device name.
|
||||
//
|
||||
pub fn set_device_name(&self, name: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -398,7 +410,8 @@ impl CefPrintSettings {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_device_name(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -412,7 +425,8 @@ impl CefPrintSettings {
|
|||
// Set the DPI (dots per inch).
|
||||
//
|
||||
pub fn set_dpi(&self, dpi: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -427,7 +441,8 @@ impl CefPrintSettings {
|
|||
// Get the DPI (dots per inch).
|
||||
//
|
||||
pub fn get_dpi(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -442,7 +457,8 @@ impl CefPrintSettings {
|
|||
//
|
||||
pub fn set_page_ranges(&self, ranges_count: libc::size_t,
|
||||
ranges: *const types::cef_page_range_t) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -458,7 +474,8 @@ impl CefPrintSettings {
|
|||
// Returns the number of page ranges that currently exist.
|
||||
//
|
||||
pub fn get_page_ranges_count(&self) -> libc::size_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -473,7 +490,8 @@ impl CefPrintSettings {
|
|||
//
|
||||
pub fn get_page_ranges(&self, ranges_count: *mut libc::size_t,
|
||||
ranges: *mut types::cef_page_range_t) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -489,7 +507,8 @@ impl CefPrintSettings {
|
|||
// Set whether only the selection will be printed.
|
||||
//
|
||||
pub fn set_selection_only(&self, selection_only: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -504,7 +523,8 @@ impl CefPrintSettings {
|
|||
// Returns true (1) if only the selection will be printed.
|
||||
//
|
||||
pub fn is_selection_only(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -518,7 +538,8 @@ impl CefPrintSettings {
|
|||
// Set whether pages will be collated.
|
||||
//
|
||||
pub fn set_collate(&self, collate: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -533,7 +554,8 @@ impl CefPrintSettings {
|
|||
// Returns true (1) if pages will be collated.
|
||||
//
|
||||
pub fn will_collate(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -547,7 +569,8 @@ impl CefPrintSettings {
|
|||
// Set the color model.
|
||||
//
|
||||
pub fn set_color_model(&self, model: types::cef_color_model_t) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -562,7 +585,8 @@ impl CefPrintSettings {
|
|||
// Get the color model.
|
||||
//
|
||||
pub fn get_color_model(&self) -> types::cef_color_model_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -576,7 +600,8 @@ impl CefPrintSettings {
|
|||
// Set the number of copies.
|
||||
//
|
||||
pub fn set_copies(&self, copies: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -591,7 +616,8 @@ impl CefPrintSettings {
|
|||
// Get the number of copies.
|
||||
//
|
||||
pub fn get_copies(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -605,7 +631,8 @@ impl CefPrintSettings {
|
|||
// Set the duplex mode.
|
||||
//
|
||||
pub fn set_duplex_mode(&self, mode: types::cef_duplex_mode_t) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -620,7 +647,8 @@ impl CefPrintSettings {
|
|||
// Get the duplex mode.
|
||||
//
|
||||
pub fn get_duplex_mode(&self) -> types::cef_duplex_mode_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -658,7 +686,8 @@ impl CefWrap<*mut cef_print_settings_t> for Option<CefPrintSettings> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_print_settings_t) -> Option<CefPrintSettings> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefPrintSettings::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -91,13 +92,13 @@ pub struct _cef_process_message_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_process_message_t = _cef_process_message_t;
|
||||
|
||||
|
@ -112,7 +113,8 @@ pub struct CefProcessMessage {
|
|||
impl Clone for CefProcessMessage {
|
||||
fn clone(&self) -> CefProcessMessage{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefProcessMessage {
|
||||
|
@ -125,7 +127,8 @@ impl Clone for CefProcessMessage {
|
|||
impl Drop for CefProcessMessage {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +143,8 @@ impl CefProcessMessage {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_process_message_t) -> CefProcessMessage {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefProcessMessage {
|
||||
|
@ -154,7 +158,8 @@ impl CefProcessMessage {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_process_message_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -162,10 +167,10 @@ impl CefProcessMessage {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -173,7 +178,8 @@ impl CefProcessMessage {
|
|||
// if this function returns false (0).
|
||||
//
|
||||
pub fn is_valid(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -188,7 +194,8 @@ impl CefProcessMessage {
|
|||
// expose read-only objects.
|
||||
//
|
||||
pub fn is_read_only(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -202,7 +209,8 @@ impl CefProcessMessage {
|
|||
// Returns a writable copy of this object.
|
||||
//
|
||||
pub fn copy(&self) -> interfaces::CefProcessMessage {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -217,7 +225,8 @@ impl CefProcessMessage {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_name(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -231,7 +240,8 @@ impl CefProcessMessage {
|
|||
// Returns the list of arguments.
|
||||
//
|
||||
pub fn get_argument_list(&self) -> interfaces::CefListValue {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -269,7 +279,8 @@ impl CefWrap<*mut cef_process_message_t> for Option<CefProcessMessage> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_process_message_t) -> Option<CefProcessMessage> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefProcessMessage::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
|
||||
|
@ -43,4 +43,5 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -103,18 +104,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 +127,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 +168,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
|
||||
|
@ -184,13 +191,13 @@ pub struct _cef_render_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_render_handler_t = _cef_render_handler_t;
|
||||
|
||||
|
@ -206,7 +213,8 @@ pub struct CefRenderHandler {
|
|||
impl Clone for CefRenderHandler {
|
||||
fn clone(&self) -> CefRenderHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefRenderHandler {
|
||||
|
@ -219,7 +227,8 @@ impl Clone for CefRenderHandler {
|
|||
impl Drop for CefRenderHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +243,8 @@ impl CefRenderHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_render_handler_t) -> CefRenderHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefRenderHandler {
|
||||
|
@ -248,7 +258,8 @@ impl CefRenderHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_render_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -256,10 +267,10 @@ impl CefRenderHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -268,7 +279,8 @@ impl CefRenderHandler {
|
|||
//
|
||||
pub fn get_root_screen_rect(&self, browser: interfaces::CefBrowser,
|
||||
rect: &mut types::cef_rect_t) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -286,7 +298,8 @@ impl CefRenderHandler {
|
|||
//
|
||||
pub fn get_view_rect(&self, browser: interfaces::CefBrowser,
|
||||
rect: &mut types::cef_rect_t) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -305,7 +318,8 @@ impl CefRenderHandler {
|
|||
pub fn get_screen_point(&self, browser: interfaces::CefBrowser,
|
||||
viewX: libc::c_int, viewY: libc::c_int, screenX: &mut libc::c_int,
|
||||
screenY: &mut libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -331,7 +345,8 @@ impl CefRenderHandler {
|
|||
//
|
||||
pub fn get_screen_info(&self, browser: interfaces::CefBrowser,
|
||||
screen_info: &mut interfaces::CefScreenInfo) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -349,7 +364,8 @@ impl CefRenderHandler {
|
|||
//
|
||||
pub fn on_popup_show(&self, browser: interfaces::CefBrowser,
|
||||
show: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -363,11 +379,12 @@ 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) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -380,17 +397,21 @@ 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,
|
||||
dirtyRects: *const types::cef_rect_t, buffer: &(), width: libc::c_int,
|
||||
height: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -408,11 +429,14 @@ 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) -> () {
|
||||
if self.c_object.is_null() {
|
||||
cursor: types::cef_cursor_handle_t, ty: types::cef_cursor_type_t,
|
||||
custom_cursor_info: &interfaces::CefCursorInfo) -> () {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -420,14 +444,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).
|
||||
|
@ -441,7 +468,8 @@ impl CefRenderHandler {
|
|||
drag_data: interfaces::CefDragData,
|
||||
allowed_ops: types::cef_drag_operations_mask_t, x: libc::c_int,
|
||||
y: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -463,7 +491,8 @@ impl CefRenderHandler {
|
|||
//
|
||||
pub fn update_drag_cursor(&self, browser: interfaces::CefBrowser,
|
||||
operation: types::cef_drag_operations_mask_t) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -478,16 +507,19 @@ impl CefRenderHandler {
|
|||
//
|
||||
// Called when the scroll offset has changed.
|
||||
//
|
||||
pub fn on_scroll_offset_changed(&self, browser: interfaces::CefBrowser) -> (
|
||||
) {
|
||||
if self.c_object.is_null() {
|
||||
pub fn on_scroll_offset_changed(&self, browser: interfaces::CefBrowser,
|
||||
x: libc::c_double, y: libc::c_double) -> () {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
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)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -499,7 +531,8 @@ impl CefRenderHandler {
|
|||
//
|
||||
pub fn get_backing_rect(&self, browser: interfaces::CefBrowser,
|
||||
rect: &mut types::cef_rect_t) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -516,7 +549,8 @@ impl CefRenderHandler {
|
|||
// flip). This is called only during accelerated compositing.
|
||||
//
|
||||
pub fn on_present(&self, browser: interfaces::CefBrowser) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -544,7 +578,8 @@ impl CefWrap<*mut cef_render_handler_t> for Option<CefRenderHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_render_handler_t) -> Option<CefRenderHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefRenderHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -173,13 +174,13 @@ pub struct _cef_render_process_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_render_process_handler_t = _cef_render_process_handler_t;
|
||||
|
||||
|
@ -196,7 +197,8 @@ pub struct CefRenderProcessHandler {
|
|||
impl Clone for CefRenderProcessHandler {
|
||||
fn clone(&self) -> CefRenderProcessHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefRenderProcessHandler {
|
||||
|
@ -209,7 +211,8 @@ impl Clone for CefRenderProcessHandler {
|
|||
impl Drop for CefRenderProcessHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +227,8 @@ impl CefRenderProcessHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_render_process_handler_t) -> CefRenderProcessHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefRenderProcessHandler {
|
||||
|
@ -238,7 +242,8 @@ impl CefRenderProcessHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_render_process_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -246,10 +251,10 @@ impl CefRenderProcessHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -260,7 +265,8 @@ impl CefRenderProcessHandler {
|
|||
//
|
||||
pub fn on_render_thread_created(&self,
|
||||
extra_info: interfaces::CefListValue) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -275,7 +281,8 @@ impl CefRenderProcessHandler {
|
|||
// Called after WebKit has been initialized.
|
||||
//
|
||||
pub fn on_web_kit_initialized(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -291,7 +298,8 @@ impl CefRenderProcessHandler {
|
|||
// destroyed.
|
||||
//
|
||||
pub fn on_browser_created(&self, browser: interfaces::CefBrowser) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -306,7 +314,8 @@ impl CefRenderProcessHandler {
|
|||
// Called before a browser is destroyed.
|
||||
//
|
||||
pub fn on_browser_destroyed(&self, browser: interfaces::CefBrowser) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -321,7 +330,8 @@ impl CefRenderProcessHandler {
|
|||
// Return the handler for browser load status events.
|
||||
//
|
||||
pub fn get_load_handler(&self) -> interfaces::CefLoadHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -340,7 +350,8 @@ impl CefRenderProcessHandler {
|
|||
frame: interfaces::CefFrame, request: interfaces::CefRequest,
|
||||
navigation_type: types::cef_navigation_type_t,
|
||||
is_redirect: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -365,7 +376,8 @@ impl CefRenderProcessHandler {
|
|||
//
|
||||
pub fn on_context_created(&self, browser: interfaces::CefBrowser,
|
||||
frame: interfaces::CefFrame, context: interfaces::CefV8Context) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -384,7 +396,8 @@ impl CefRenderProcessHandler {
|
|||
//
|
||||
pub fn on_context_released(&self, browser: interfaces::CefBrowser,
|
||||
frame: interfaces::CefFrame, context: interfaces::CefV8Context) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -406,7 +419,8 @@ impl CefRenderProcessHandler {
|
|||
frame: interfaces::CefFrame, context: interfaces::CefV8Context,
|
||||
exception: interfaces::CefV8Exception,
|
||||
stackTrace: interfaces::CefV8StackTrace) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -431,7 +445,8 @@ impl CefRenderProcessHandler {
|
|||
//
|
||||
pub fn on_focused_node_changed(&self, browser: interfaces::CefBrowser,
|
||||
frame: interfaces::CefFrame, node: interfaces::CefDOMNode) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -452,7 +467,8 @@ impl CefRenderProcessHandler {
|
|||
pub fn on_process_message_received(&self, browser: interfaces::CefBrowser,
|
||||
source_process: interfaces::CefProcessId,
|
||||
message: interfaces::CefProcessMessage) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -482,7 +498,8 @@ impl CefWrap<*mut cef_render_process_handler_t> for Option<CefRenderProcessHandl
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_render_process_handler_t) -> Option<CefRenderProcessHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefRenderProcessHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -164,16 +165,23 @@ 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!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_request_t = _cef_request_t;
|
||||
|
||||
|
@ -189,7 +197,8 @@ pub struct CefRequest {
|
|||
impl Clone for CefRequest {
|
||||
fn clone(&self) -> CefRequest{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefRequest {
|
||||
|
@ -202,7 +211,8 @@ impl Clone for CefRequest {
|
|||
impl Drop for CefRequest {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +227,8 @@ impl CefRequest {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_t) -> CefRequest {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefRequest {
|
||||
|
@ -231,7 +242,8 @@ impl CefRequest {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_request_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -239,17 +251,18 @@ impl CefRequest {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Returns true (1) if this object is read-only.
|
||||
//
|
||||
pub fn is_read_only(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -264,7 +277,8 @@ impl CefRequest {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_url(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -278,7 +292,8 @@ impl CefRequest {
|
|||
// Set the fully qualified URL.
|
||||
//
|
||||
pub fn set_url(&self, url: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -295,7 +310,8 @@ impl CefRequest {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_method(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -309,7 +325,8 @@ impl CefRequest {
|
|||
// Set the request function type.
|
||||
//
|
||||
pub fn set_method(&self, method: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -324,7 +341,8 @@ impl CefRequest {
|
|||
// Get the post data.
|
||||
//
|
||||
pub fn get_post_data(&self) -> interfaces::CefPostData {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -338,7 +356,8 @@ impl CefRequest {
|
|||
// Set the post data.
|
||||
//
|
||||
pub fn set_post_data(&self, postData: interfaces::CefPostData) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -353,7 +372,8 @@ impl CefRequest {
|
|||
// Get the header values.
|
||||
//
|
||||
pub fn get_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -368,7 +388,8 @@ impl CefRequest {
|
|||
// Set the header values.
|
||||
//
|
||||
pub fn set_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -385,7 +406,8 @@ impl CefRequest {
|
|||
pub fn set(&self, url: &[u16], method: &[u16],
|
||||
postData: interfaces::CefPostData, headerMap: HashMap<String,
|
||||
Vec<String>>) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -404,7 +426,8 @@ impl CefRequest {
|
|||
// cef_urlrequest_flags_t for supported values.
|
||||
//
|
||||
pub fn get_flags(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -419,7 +442,8 @@ impl CefRequest {
|
|||
// cef_urlrequest_flags_t for supported values.
|
||||
//
|
||||
pub fn set_flags(&self, flags: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -436,7 +460,8 @@ impl CefRequest {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_first_party_for_cookies(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -451,7 +476,8 @@ impl CefRequest {
|
|||
// cef_urlrequest_t.
|
||||
//
|
||||
pub fn set_first_party_for_cookies(&self, url: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -467,7 +493,8 @@ impl CefRequest {
|
|||
// process.
|
||||
//
|
||||
pub fn get_resource_type(&self) -> types::cef_resource_type_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -483,7 +510,8 @@ impl CefRequest {
|
|||
// frame navigation.
|
||||
//
|
||||
pub fn get_transition_type(&self) -> types::cef_transition_type_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -493,6 +521,23 @@ 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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.
|
||||
//
|
||||
|
@ -521,7 +566,8 @@ impl CefWrap<*mut cef_request_t> for Option<CefRequest> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_request_t) -> Option<CefRequest> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefRequest::from_c_object_addref(c_object))
|
||||
|
@ -581,13 +627,13 @@ pub struct _cef_post_data_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_post_data_t = _cef_post_data_t;
|
||||
|
||||
|
@ -603,7 +649,8 @@ pub struct CefPostData {
|
|||
impl Clone for CefPostData {
|
||||
fn clone(&self) -> CefPostData{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefPostData {
|
||||
|
@ -616,7 +663,8 @@ impl Clone for CefPostData {
|
|||
impl Drop for CefPostData {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -631,7 +679,8 @@ impl CefPostData {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_post_data_t) -> CefPostData {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefPostData {
|
||||
|
@ -645,7 +694,8 @@ impl CefPostData {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_post_data_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -653,17 +703,18 @@ impl CefPostData {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Returns true (1) if this object is read-only.
|
||||
//
|
||||
pub fn is_read_only(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -677,7 +728,8 @@ impl CefPostData {
|
|||
// Returns the number of existing post data elements.
|
||||
//
|
||||
pub fn get_element_count(&self) -> libc::size_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -692,7 +744,8 @@ impl CefPostData {
|
|||
//
|
||||
pub fn get_elements(&self, elements_count: *mut libc::size_t,
|
||||
elements: *mut interfaces::CefPostDataElement) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -710,7 +763,8 @@ impl CefPostData {
|
|||
//
|
||||
pub fn remove_element(&self,
|
||||
element: interfaces::CefPostDataElement) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -726,7 +780,8 @@ impl CefPostData {
|
|||
//
|
||||
pub fn add_element(&self,
|
||||
element: interfaces::CefPostDataElement) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -741,7 +796,8 @@ impl CefPostData {
|
|||
// Remove all existing post data elements.
|
||||
//
|
||||
pub fn remove_elements(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -779,7 +835,8 @@ impl CefWrap<*mut cef_post_data_t> for Option<CefPostData> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_post_data_t) -> Option<CefPostData> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefPostData::from_c_object_addref(c_object))
|
||||
|
@ -853,13 +910,13 @@ pub struct _cef_post_data_element_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_post_data_element_t = _cef_post_data_element_t;
|
||||
|
||||
|
@ -875,7 +932,8 @@ pub struct CefPostDataElement {
|
|||
impl Clone for CefPostDataElement {
|
||||
fn clone(&self) -> CefPostDataElement{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefPostDataElement {
|
||||
|
@ -888,7 +946,8 @@ impl Clone for CefPostDataElement {
|
|||
impl Drop for CefPostDataElement {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -903,7 +962,8 @@ impl CefPostDataElement {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_post_data_element_t) -> CefPostDataElement {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefPostDataElement {
|
||||
|
@ -917,7 +977,8 @@ impl CefPostDataElement {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_post_data_element_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -925,17 +986,18 @@ impl CefPostDataElement {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Returns true (1) if this object is read-only.
|
||||
//
|
||||
pub fn is_read_only(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -949,7 +1011,8 @@ impl CefPostDataElement {
|
|||
// Remove all contents from the post data element.
|
||||
//
|
||||
pub fn set_to_empty(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -963,7 +1026,8 @@ impl CefPostDataElement {
|
|||
// The post data element will represent a file.
|
||||
//
|
||||
pub fn set_to_file(&self, fileName: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -979,7 +1043,8 @@ impl CefPostDataElement {
|
|||
// copied.
|
||||
//
|
||||
pub fn set_to_bytes(&self, size: libc::size_t, bytes: &()) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -995,7 +1060,8 @@ impl CefPostDataElement {
|
|||
// Return the type of this post data element.
|
||||
//
|
||||
pub fn get_type(&self) -> types::cef_postdataelement_type_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1010,7 +1076,8 @@ impl CefPostDataElement {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_file(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1024,7 +1091,8 @@ impl CefPostDataElement {
|
|||
// Return the number of bytes.
|
||||
//
|
||||
pub fn get_bytes_count(&self) -> libc::size_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1039,7 +1107,8 @@ impl CefPostDataElement {
|
|||
// actually read.
|
||||
//
|
||||
pub fn get_bytes(&self, size: libc::size_t, bytes: &mut ()) -> libc::size_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1079,7 +1148,8 @@ impl CefWrap<*mut cef_post_data_element_t> for Option<CefPostDataElement> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_post_data_element_t) -> Option<CefPostDataElement> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefPostDataElement::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
|
||||
|
@ -43,22 +43,24 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
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 +77,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,34 +97,80 @@ 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!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -122,7 +179,8 @@ pub struct CefRequestContext {
|
|||
impl Clone for CefRequestContext {
|
||||
fn clone(&self) -> CefRequestContext{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefRequestContext {
|
||||
|
@ -135,7 +193,8 @@ impl Clone for CefRequestContext {
|
|||
impl Drop for CefRequestContext {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +209,8 @@ impl CefRequestContext {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_context_t) -> CefRequestContext {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefRequestContext {
|
||||
|
@ -164,7 +224,8 @@ impl CefRequestContext {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_request_context_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -172,10 +233,10 @@ impl CefRequestContext {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -183,7 +244,8 @@ impl CefRequestContext {
|
|||
// object.
|
||||
//
|
||||
pub fn is_same(&self, other: interfaces::CefRequestContext) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -195,10 +257,31 @@ 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -212,7 +295,8 @@ impl CefRequestContext {
|
|||
// Returns the handler for this context if any.
|
||||
//
|
||||
pub fn get_handler(&self) -> interfaces::CefRequestContextHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -222,6 +306,91 @@ 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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 +403,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)))
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +447,8 @@ impl CefWrap<*mut cef_request_context_t> for Option<CefRequestContext> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_request_context_t) -> Option<CefRequestContext> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefRequestContext::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
|
||||
|
@ -43,10 +43,13 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
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 +59,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>,
|
||||
|
@ -65,19 +69,21 @@ pub struct _cef_request_context_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -86,7 +92,8 @@ pub struct CefRequestContextHandler {
|
|||
impl Clone for CefRequestContextHandler {
|
||||
fn clone(&self) -> CefRequestContextHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefRequestContextHandler {
|
||||
|
@ -99,7 +106,8 @@ impl Clone for CefRequestContextHandler {
|
|||
impl Drop for CefRequestContextHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +122,8 @@ impl CefRequestContextHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_context_handler_t) -> CefRequestContextHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefRequestContextHandler {
|
||||
|
@ -128,7 +137,8 @@ impl CefRequestContextHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_request_context_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -136,18 +146,20 @@ impl CefRequestContextHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// 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() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -174,7 +186,8 @@ impl CefWrap<*mut cef_request_context_handler_t> for Option<CefRequestContextHan
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_request_context_handler_t) -> Option<CefRequestContextHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefRequestContextHandler::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
|
||||
|
@ -43,97 +43,102 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
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!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
|
||||
pub type cef_quota_callback_t = _cef_quota_callback_t;
|
||||
|
||||
|
||||
//
|
||||
// Callback structure used for asynchronous continuation of quota requests.
|
||||
//
|
||||
pub struct CefQuotaCallback {
|
||||
c_object: *mut cef_quota_callback_t,
|
||||
}
|
||||
|
||||
impl Clone for CefQuotaCallback {
|
||||
fn clone(&self) -> CefQuotaCallback{
|
||||
pub type cef_request_callback_t = _cef_request_callback_t;
|
||||
|
||||
|
||||
//
|
||||
// Callback structure used for asynchronous continuation of url requests.
|
||||
//
|
||||
pub struct CefRequestCallback {
|
||||
c_object: *mut cef_request_callback_t,
|
||||
}
|
||||
|
||||
impl Clone for CefRequestCallback {
|
||||
fn clone(&self) -> CefRequestCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*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() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
if !c_object.is_null() {
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_callback_t) -> CefRequestCallback {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*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() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -141,18 +146,19 @@ impl CefQuotaCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// 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() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -164,10 +170,11 @@ impl CefQuotaCallback {
|
|||
}
|
||||
|
||||
//
|
||||
// Cancel the quota request.
|
||||
// Cancel the url request.
|
||||
//
|
||||
pub fn cancel(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -178,168 +185,27 @@ 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> {
|
||||
if c_object.is_null() {
|
||||
unsafe fn to_rust(c_object: *mut cef_request_callback_t) -> Option<CefRequestCallback> {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
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 +238,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 +287,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 +329,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 +353,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 +384,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.
|
||||
|
@ -485,13 +404,13 @@ pub struct _cef_request_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_request_handler_t = _cef_request_handler_t;
|
||||
|
||||
|
@ -507,7 +426,8 @@ pub struct CefRequestHandler {
|
|||
impl Clone for CefRequestHandler {
|
||||
fn clone(&self) -> CefRequestHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefRequestHandler {
|
||||
|
@ -520,7 +440,8 @@ impl Clone for CefRequestHandler {
|
|||
impl Drop for CefRequestHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -535,7 +456,8 @@ impl CefRequestHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_request_handler_t) -> CefRequestHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefRequestHandler {
|
||||
|
@ -549,7 +471,8 @@ impl CefRequestHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_request_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -557,10 +480,10 @@ impl CefRequestHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -576,7 +499,8 @@ impl CefRequestHandler {
|
|||
pub fn on_before_browse(&self, browser: interfaces::CefBrowser,
|
||||
frame: interfaces::CefFrame, request: interfaces::CefRequest,
|
||||
is_redirect: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -590,15 +514,55 @@ 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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 {
|
||||
if self.c_object.is_null() {
|
||||
frame: interfaces::CefFrame, request: interfaces::CefRequest,
|
||||
callback: interfaces::CefRequestCallback) -> types::cef_return_value_t {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -607,7 +571,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)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -620,7 +585,8 @@ impl CefRequestHandler {
|
|||
pub fn get_resource_handler(&self, browser: interfaces::CefBrowser,
|
||||
frame: interfaces::CefFrame,
|
||||
request: interfaces::CefRequest) -> interfaces::CefResourceHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -634,14 +600,16 @@ 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() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -650,23 +618,49 @@ 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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],
|
||||
port: libc::c_int, realm: &[u16], scheme: &[u16],
|
||||
callback: interfaces::CefAuthCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -688,14 +682,16 @@ 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 {
|
||||
if self.c_object.is_null() {
|
||||
callback: interfaces::CefRequestCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -718,7 +714,8 @@ impl CefRequestHandler {
|
|||
//
|
||||
pub fn on_protocol_execution(&self, browser: interfaces::CefBrowser,
|
||||
url: &[u16], allow_os_execution: &mut libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -733,26 +730,29 @@ 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 {
|
||||
if self.c_object.is_null() {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
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)))
|
||||
}
|
||||
}
|
||||
|
@ -764,7 +764,8 @@ impl CefRequestHandler {
|
|||
pub fn on_before_plugin_load(&self, browser: interfaces::CefBrowser,
|
||||
url: &[u16], policy_url: &[u16],
|
||||
info: interfaces::CefWebPluginInfo) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -784,7 +785,8 @@ impl CefRequestHandler {
|
|||
//
|
||||
pub fn on_plugin_crashed(&self, browser: interfaces::CefBrowser,
|
||||
plugin_path: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -796,13 +798,32 @@ 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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.
|
||||
//
|
||||
pub fn on_render_process_terminated(&self, browser: interfaces::CefBrowser,
|
||||
status: types::cef_termination_status_t) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -831,7 +852,8 @@ impl CefWrap<*mut cef_request_handler_t> for Option<CefRequestHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_request_handler_t) -> Option<CefRequestHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefRequestHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -82,13 +83,13 @@ pub struct _cef_resource_bundle_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_resource_bundle_handler_t = _cef_resource_bundle_handler_t;
|
||||
|
||||
|
@ -104,7 +105,8 @@ pub struct CefResourceBundleHandler {
|
|||
impl Clone for CefResourceBundleHandler {
|
||||
fn clone(&self) -> CefResourceBundleHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefResourceBundleHandler {
|
||||
|
@ -117,7 +119,8 @@ impl Clone for CefResourceBundleHandler {
|
|||
impl Drop for CefResourceBundleHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +135,8 @@ impl CefResourceBundleHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_resource_bundle_handler_t) -> CefResourceBundleHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefResourceBundleHandler {
|
||||
|
@ -146,7 +150,8 @@ impl CefResourceBundleHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_resource_bundle_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -154,10 +159,10 @@ impl CefResourceBundleHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -168,7 +173,8 @@ impl CefResourceBundleHandler {
|
|||
//
|
||||
pub fn get_localized_string(&self, message_id: libc::c_int,
|
||||
string: *mut types::cef_string_t) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -191,7 +197,8 @@ impl CefResourceBundleHandler {
|
|||
pub fn get_data_resource(&self, resource_id: libc::c_int,
|
||||
data: &mut *mut libc::c_void,
|
||||
data_size: &mut libc::size_t) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -221,7 +228,8 @@ impl CefWrap<*mut cef_resource_bundle_handler_t> for Option<CefResourceBundleHan
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_resource_bundle_handler_t) -> Option<CefResourceBundleHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefResourceBundleHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -117,13 +118,13 @@ pub struct _cef_resource_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_resource_handler_t = _cef_resource_handler_t;
|
||||
|
||||
|
@ -139,7 +140,8 @@ pub struct CefResourceHandler {
|
|||
impl Clone for CefResourceHandler {
|
||||
fn clone(&self) -> CefResourceHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefResourceHandler {
|
||||
|
@ -152,7 +154,8 @@ impl Clone for CefResourceHandler {
|
|||
impl Drop for CefResourceHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +170,8 @@ impl CefResourceHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_resource_handler_t) -> CefResourceHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefResourceHandler {
|
||||
|
@ -181,7 +185,8 @@ impl CefResourceHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_resource_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -189,10 +194,10 @@ impl CefResourceHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -204,7 +209,8 @@ impl CefResourceHandler {
|
|||
//
|
||||
pub fn process_request(&self, request: interfaces::CefRequest,
|
||||
callback: interfaces::CefCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -229,7 +235,8 @@ impl CefResourceHandler {
|
|||
pub fn get_response_headers(&self, response: interfaces::CefResponse,
|
||||
response_length: &mut i64, redirectUrl: *mut types::cef_string_t) -> (
|
||||
) {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -252,7 +259,8 @@ impl CefResourceHandler {
|
|||
pub fn read_response(&self, data_out: &mut (), bytes_to_read: libc::c_int,
|
||||
bytes_read: &mut libc::c_int,
|
||||
callback: interfaces::CefCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -272,7 +280,8 @@ impl CefResourceHandler {
|
|||
// cookies will be sent with the request.
|
||||
//
|
||||
pub fn can_get_cookie(&self, cookie: &interfaces::CefCookie) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -288,7 +297,8 @@ impl CefResourceHandler {
|
|||
// set or false (0) otherwise.
|
||||
//
|
||||
pub fn can_set_cookie(&self, cookie: &interfaces::CefCookie) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -303,7 +313,8 @@ impl CefResourceHandler {
|
|||
// Request processing has been canceled.
|
||||
//
|
||||
pub fn cancel(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -330,7 +341,8 @@ impl CefWrap<*mut cef_resource_handler_t> for Option<CefResourceHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_resource_handler_t) -> Option<CefResourceHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefResourceHandler::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -122,13 +123,13 @@ pub struct _cef_response_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_response_t = _cef_response_t;
|
||||
|
||||
|
@ -144,7 +145,8 @@ pub struct CefResponse {
|
|||
impl Clone for CefResponse {
|
||||
fn clone(&self) -> CefResponse{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefResponse {
|
||||
|
@ -157,7 +159,8 @@ impl Clone for CefResponse {
|
|||
impl Drop for CefResponse {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +175,8 @@ impl CefResponse {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_response_t) -> CefResponse {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefResponse {
|
||||
|
@ -186,7 +190,8 @@ impl CefResponse {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_response_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -194,17 +199,18 @@ impl CefResponse {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Returns true (1) if this object is read-only.
|
||||
//
|
||||
pub fn is_read_only(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -218,7 +224,8 @@ impl CefResponse {
|
|||
// Get the response status code.
|
||||
//
|
||||
pub fn get_status(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -232,7 +239,8 @@ impl CefResponse {
|
|||
// Set the response status code.
|
||||
//
|
||||
pub fn set_status(&self, status: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -248,7 +256,8 @@ impl CefResponse {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_status_text(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -262,7 +271,8 @@ impl CefResponse {
|
|||
// Set the response status text.
|
||||
//
|
||||
pub fn set_status_text(&self, statusText: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -278,7 +288,8 @@ impl CefResponse {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_mime_type(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -292,7 +303,8 @@ impl CefResponse {
|
|||
// Set the response mime type.
|
||||
//
|
||||
pub fn set_mime_type(&self, mimeType: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -308,7 +320,8 @@ impl CefResponse {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_header(&self, name: &[u16]) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -323,7 +336,8 @@ impl CefResponse {
|
|||
// Get all response header fields.
|
||||
//
|
||||
pub fn get_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -338,7 +352,8 @@ impl CefResponse {
|
|||
// Set all response header fields.
|
||||
//
|
||||
pub fn set_header_map(&self, headerMap: HashMap<String,Vec<String>>) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -377,7 +392,8 @@ impl CefWrap<*mut cef_response_t> for Option<CefResponse> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_response_t) -> Option<CefResponse> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefResponse::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -108,13 +109,13 @@ pub struct _cef_scheme_registrar_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_scheme_registrar_t = _cef_scheme_registrar_t;
|
||||
|
||||
|
@ -129,7 +130,8 @@ pub struct CefSchemeRegistrar {
|
|||
impl Clone for CefSchemeRegistrar {
|
||||
fn clone(&self) -> CefSchemeRegistrar{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefSchemeRegistrar {
|
||||
|
@ -142,7 +144,8 @@ impl Clone for CefSchemeRegistrar {
|
|||
impl Drop for CefSchemeRegistrar {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +160,8 @@ impl CefSchemeRegistrar {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_scheme_registrar_t) -> CefSchemeRegistrar {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefSchemeRegistrar {
|
||||
|
@ -171,7 +175,8 @@ impl CefSchemeRegistrar {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_scheme_registrar_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -179,10 +184,10 @@ impl CefSchemeRegistrar {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -234,7 +239,8 @@ impl CefSchemeRegistrar {
|
|||
pub fn add_custom_scheme(&self, scheme_name: &[u16], is_standard: libc::c_int,
|
||||
is_local: libc::c_int,
|
||||
is_display_isolated: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -265,7 +271,8 @@ impl CefWrap<*mut cef_scheme_registrar_t> for Option<CefSchemeRegistrar> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_scheme_registrar_t) -> Option<CefSchemeRegistrar> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefSchemeRegistrar::from_c_object_addref(c_object))
|
||||
|
@ -303,13 +310,13 @@ pub struct _cef_scheme_handler_factory_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_scheme_handler_factory_t = _cef_scheme_handler_factory_t;
|
||||
|
||||
|
@ -326,7 +333,8 @@ pub struct CefSchemeHandlerFactory {
|
|||
impl Clone for CefSchemeHandlerFactory {
|
||||
fn clone(&self) -> CefSchemeHandlerFactory{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefSchemeHandlerFactory {
|
||||
|
@ -339,7 +347,8 @@ impl Clone for CefSchemeHandlerFactory {
|
|||
impl Drop for CefSchemeHandlerFactory {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -354,7 +363,8 @@ impl CefSchemeHandlerFactory {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_scheme_handler_factory_t) -> CefSchemeHandlerFactory {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefSchemeHandlerFactory {
|
||||
|
@ -368,7 +378,8 @@ impl CefSchemeHandlerFactory {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_scheme_handler_factory_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -376,10 +387,10 @@ impl CefSchemeHandlerFactory {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -393,7 +404,8 @@ impl CefSchemeHandlerFactory {
|
|||
pub fn create(&self, browser: interfaces::CefBrowser,
|
||||
frame: interfaces::CefFrame, scheme_name: &[u16],
|
||||
request: interfaces::CefRequest) -> interfaces::CefResourceHandler {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -424,7 +436,8 @@ impl CefWrap<*mut cef_scheme_handler_factory_t> for Option<CefSchemeHandlerFacto
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_scheme_handler_factory_t) -> Option<CefSchemeHandlerFactory> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefSchemeHandlerFactory::from_c_object_addref(c_object))
|
||||
|
|
|
@ -0,0 +1,655 @@
|
|||
// 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::mem;
|
||||
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: u32,
|
||||
|
||||
//
|
||||
// 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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
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() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
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: u32,
|
||||
|
||||
//
|
||||
// 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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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 as usize != mem::POST_DROP_USIZE {
|
||||
((*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() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
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() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// 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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
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() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -90,13 +91,13 @@ pub struct _cef_read_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_read_handler_t = _cef_read_handler_t;
|
||||
|
||||
|
@ -112,7 +113,8 @@ pub struct CefReadHandler {
|
|||
impl Clone for CefReadHandler {
|
||||
fn clone(&self) -> CefReadHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefReadHandler {
|
||||
|
@ -125,7 +127,8 @@ impl Clone for CefReadHandler {
|
|||
impl Drop for CefReadHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +143,8 @@ impl CefReadHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_read_handler_t) -> CefReadHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefReadHandler {
|
||||
|
@ -154,7 +158,8 @@ impl CefReadHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_read_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -162,10 +167,10 @@ impl CefReadHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -173,7 +178,8 @@ impl CefReadHandler {
|
|||
//
|
||||
pub fn read(&self, ptr: &mut (), size: libc::size_t,
|
||||
n: libc::size_t) -> libc::size_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -191,7 +197,8 @@ impl CefReadHandler {
|
|||
// SEEK_END or SEEK_SET. Return zero on success and non-zero on failure.
|
||||
//
|
||||
pub fn seek(&self, offset: i64, whence: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -207,7 +214,8 @@ impl CefReadHandler {
|
|||
// Return the current offset position.
|
||||
//
|
||||
pub fn tell(&self) -> i64 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -221,7 +229,8 @@ impl CefReadHandler {
|
|||
// Return non-zero if at end of file.
|
||||
//
|
||||
pub fn eof(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -237,7 +246,8 @@ impl CefReadHandler {
|
|||
// the handler from.
|
||||
//
|
||||
pub fn may_block(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -264,7 +274,8 @@ impl CefWrap<*mut cef_read_handler_t> for Option<CefReadHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_read_handler_t) -> Option<CefReadHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefReadHandler::from_c_object_addref(c_object))
|
||||
|
@ -318,13 +329,13 @@ pub struct _cef_stream_reader_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_stream_reader_t = _cef_stream_reader_t;
|
||||
|
||||
|
@ -340,7 +351,8 @@ pub struct CefStreamReader {
|
|||
impl Clone for CefStreamReader {
|
||||
fn clone(&self) -> CefStreamReader{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefStreamReader {
|
||||
|
@ -353,7 +365,8 @@ impl Clone for CefStreamReader {
|
|||
impl Drop for CefStreamReader {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -368,7 +381,8 @@ impl CefStreamReader {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_stream_reader_t) -> CefStreamReader {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefStreamReader {
|
||||
|
@ -382,7 +396,8 @@ impl CefStreamReader {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_stream_reader_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -390,10 +405,10 @@ impl CefStreamReader {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -401,7 +416,8 @@ impl CefStreamReader {
|
|||
//
|
||||
pub fn read(&self, ptr: &mut (), size: libc::size_t,
|
||||
n: libc::size_t) -> libc::size_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -419,7 +435,8 @@ impl CefStreamReader {
|
|||
// SEEK_END or SEEK_SET. Returns zero on success and non-zero on failure.
|
||||
//
|
||||
pub fn seek(&self, offset: i64, whence: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -435,7 +452,8 @@ impl CefStreamReader {
|
|||
// Return the current offset position.
|
||||
//
|
||||
pub fn tell(&self) -> i64 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -449,7 +467,8 @@ impl CefStreamReader {
|
|||
// Return non-zero if at end of file.
|
||||
//
|
||||
pub fn eof(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -465,7 +484,8 @@ impl CefStreamReader {
|
|||
// the reader from.
|
||||
//
|
||||
pub fn may_block(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -528,7 +548,8 @@ impl CefWrap<*mut cef_stream_reader_t> for Option<CefStreamReader> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_stream_reader_t) -> Option<CefStreamReader> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefStreamReader::from_c_object_addref(c_object))
|
||||
|
@ -583,13 +604,13 @@ pub struct _cef_write_handler_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_write_handler_t = _cef_write_handler_t;
|
||||
|
||||
|
@ -605,7 +626,8 @@ pub struct CefWriteHandler {
|
|||
impl Clone for CefWriteHandler {
|
||||
fn clone(&self) -> CefWriteHandler{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefWriteHandler {
|
||||
|
@ -618,7 +640,8 @@ impl Clone for CefWriteHandler {
|
|||
impl Drop for CefWriteHandler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -633,7 +656,8 @@ impl CefWriteHandler {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_write_handler_t) -> CefWriteHandler {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefWriteHandler {
|
||||
|
@ -647,7 +671,8 @@ impl CefWriteHandler {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_write_handler_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -655,10 +680,10 @@ impl CefWriteHandler {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -666,7 +691,8 @@ impl CefWriteHandler {
|
|||
//
|
||||
pub fn write(&self, ptr: &(), size: libc::size_t,
|
||||
n: libc::size_t) -> libc::size_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -684,7 +710,8 @@ impl CefWriteHandler {
|
|||
// SEEK_END or SEEK_SET. Return zero on success and non-zero on failure.
|
||||
//
|
||||
pub fn seek(&self, offset: i64, whence: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -700,7 +727,8 @@ impl CefWriteHandler {
|
|||
// Return the current offset position.
|
||||
//
|
||||
pub fn tell(&self) -> i64 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -714,7 +742,8 @@ impl CefWriteHandler {
|
|||
// Flush the stream.
|
||||
//
|
||||
pub fn flush(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -730,7 +759,8 @@ impl CefWriteHandler {
|
|||
// the handler from.
|
||||
//
|
||||
pub fn may_block(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -757,7 +787,8 @@ impl CefWrap<*mut cef_write_handler_t> for Option<CefWriteHandler> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_write_handler_t) -> Option<CefWriteHandler> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefWriteHandler::from_c_object_addref(c_object))
|
||||
|
@ -812,13 +843,13 @@ pub struct _cef_stream_writer_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_stream_writer_t = _cef_stream_writer_t;
|
||||
|
||||
|
@ -834,7 +865,8 @@ pub struct CefStreamWriter {
|
|||
impl Clone for CefStreamWriter {
|
||||
fn clone(&self) -> CefStreamWriter{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefStreamWriter {
|
||||
|
@ -847,7 +879,8 @@ impl Clone for CefStreamWriter {
|
|||
impl Drop for CefStreamWriter {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -862,7 +895,8 @@ impl CefStreamWriter {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_stream_writer_t) -> CefStreamWriter {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefStreamWriter {
|
||||
|
@ -876,7 +910,8 @@ impl CefStreamWriter {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_stream_writer_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -884,10 +919,10 @@ impl CefStreamWriter {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -895,7 +930,8 @@ impl CefStreamWriter {
|
|||
//
|
||||
pub fn write(&self, ptr: &(), size: libc::size_t,
|
||||
n: libc::size_t) -> libc::size_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -913,7 +949,8 @@ impl CefStreamWriter {
|
|||
// SEEK_END or SEEK_SET. Returns zero on success and non-zero on failure.
|
||||
//
|
||||
pub fn seek(&self, offset: i64, whence: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -929,7 +966,8 @@ impl CefStreamWriter {
|
|||
// Return the current offset position.
|
||||
//
|
||||
pub fn tell(&self) -> i64 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -943,7 +981,8 @@ impl CefStreamWriter {
|
|||
// Flush the stream.
|
||||
//
|
||||
pub fn flush(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -959,7 +998,8 @@ impl CefStreamWriter {
|
|||
// the writer from.
|
||||
//
|
||||
pub fn may_block(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -1009,7 +1049,8 @@ impl CefWrap<*mut cef_stream_writer_t> for Option<CefStreamWriter> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_stream_writer_t) -> Option<CefStreamWriter> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefStreamWriter::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -64,13 +65,13 @@ pub struct _cef_string_visitor_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_string_visitor_t = _cef_string_visitor_t;
|
||||
|
||||
|
@ -85,7 +86,8 @@ pub struct CefStringVisitor {
|
|||
impl Clone for CefStringVisitor {
|
||||
fn clone(&self) -> CefStringVisitor{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefStringVisitor {
|
||||
|
@ -98,7 +100,8 @@ impl Clone for CefStringVisitor {
|
|||
impl Drop for CefStringVisitor {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +116,8 @@ impl CefStringVisitor {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_string_visitor_t) -> CefStringVisitor {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefStringVisitor {
|
||||
|
@ -127,7 +131,8 @@ impl CefStringVisitor {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_string_visitor_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -135,17 +140,18 @@ impl CefStringVisitor {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Method that will be executed.
|
||||
//
|
||||
pub fn visit(&self, string: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -173,7 +179,8 @@ impl CefWrap<*mut cef_string_visitor_t> for Option<CefStringVisitor> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_string_visitor_t) -> Option<CefStringVisitor> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefStringVisitor::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -68,13 +69,13 @@ pub struct _cef_task_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_task_t = _cef_task_t;
|
||||
|
||||
|
@ -94,7 +95,8 @@ pub struct CefTask {
|
|||
impl Clone for CefTask {
|
||||
fn clone(&self) -> CefTask{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefTask {
|
||||
|
@ -107,7 +109,8 @@ impl Clone for CefTask {
|
|||
impl Drop for CefTask {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +125,8 @@ impl CefTask {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_task_t) -> CefTask {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefTask {
|
||||
|
@ -136,7 +140,8 @@ impl CefTask {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_task_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -144,17 +149,18 @@ impl CefTask {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
// Method that will be executed on the target thread.
|
||||
//
|
||||
pub fn execute(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -181,7 +187,8 @@ impl CefWrap<*mut cef_task_t> for Option<CefTask> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_task_t) -> Option<CefTask> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefTask::from_c_object_addref(c_object))
|
||||
|
@ -244,13 +251,13 @@ pub struct _cef_task_runner_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_task_runner_t = _cef_task_runner_t;
|
||||
|
||||
|
@ -271,7 +278,8 @@ pub struct CefTaskRunner {
|
|||
impl Clone for CefTaskRunner {
|
||||
fn clone(&self) -> CefTaskRunner{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefTaskRunner {
|
||||
|
@ -284,7 +292,8 @@ impl Clone for CefTaskRunner {
|
|||
impl Drop for CefTaskRunner {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -299,7 +308,8 @@ impl CefTaskRunner {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_task_runner_t) -> CefTaskRunner {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefTaskRunner {
|
||||
|
@ -313,7 +323,8 @@ impl CefTaskRunner {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_task_runner_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -321,10 +332,10 @@ impl CefTaskRunner {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -332,7 +343,8 @@ impl CefTaskRunner {
|
|||
// |that| object.
|
||||
//
|
||||
pub fn is_same(&self, that: interfaces::CefTaskRunner) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -347,7 +359,8 @@ impl CefTaskRunner {
|
|||
// Returns true (1) if this task runner belongs to the current thread.
|
||||
//
|
||||
pub fn belongs_to_current_thread(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -362,7 +375,8 @@ impl CefTaskRunner {
|
|||
//
|
||||
pub fn belongs_to_thread(&self,
|
||||
threadId: types::cef_thread_id_t) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -378,7 +392,8 @@ impl CefTaskRunner {
|
|||
// Execution will occur asynchronously.
|
||||
//
|
||||
pub fn post_task(&self, task: interfaces::CefTask) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -397,7 +412,8 @@ impl CefTaskRunner {
|
|||
//
|
||||
pub fn post_delayed_task(&self, task: interfaces::CefTask,
|
||||
delay_ms: i64) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -451,7 +467,8 @@ impl CefWrap<*mut cef_task_runner_t> for Option<CefTaskRunner> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_task_runner_t) -> Option<CefTaskRunner> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefTaskRunner::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -69,13 +70,13 @@ pub struct _cef_end_tracing_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_end_tracing_callback_t = _cef_end_tracing_callback_t;
|
||||
|
||||
|
@ -92,7 +93,8 @@ pub struct CefEndTracingCallback {
|
|||
impl Clone for CefEndTracingCallback {
|
||||
fn clone(&self) -> CefEndTracingCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefEndTracingCallback {
|
||||
|
@ -105,7 +107,8 @@ impl Clone for CefEndTracingCallback {
|
|||
impl Drop for CefEndTracingCallback {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +123,8 @@ impl CefEndTracingCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_end_tracing_callback_t) -> CefEndTracingCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefEndTracingCallback {
|
||||
|
@ -134,7 +138,8 @@ impl CefEndTracingCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_end_tracing_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -142,10 +147,10 @@ impl CefEndTracingCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -154,7 +159,8 @@ impl CefEndTracingCallback {
|
|||
// deleting |tracing_file|.
|
||||
//
|
||||
pub fn on_end_tracing_complete(&self, tracing_file: &[u16]) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -182,7 +188,8 @@ impl CefWrap<*mut cef_end_tracing_callback_t> for Option<CefEndTracingCallback>
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_end_tracing_callback_t) -> Option<CefEndTracingCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefEndTracingCallback::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -101,13 +102,13 @@ pub struct _cef_urlrequest_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_urlrequest_t = _cef_urlrequest_t;
|
||||
|
||||
|
@ -126,7 +127,8 @@ pub struct CefURLRequest {
|
|||
impl Clone for CefURLRequest {
|
||||
fn clone(&self) -> CefURLRequest{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefURLRequest {
|
||||
|
@ -139,7 +141,8 @@ impl Clone for CefURLRequest {
|
|||
impl Drop for CefURLRequest {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +157,8 @@ impl CefURLRequest {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_urlrequest_t) -> CefURLRequest {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefURLRequest {
|
||||
|
@ -168,7 +172,8 @@ impl CefURLRequest {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_urlrequest_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -176,10 +181,10 @@ impl CefURLRequest {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -187,7 +192,8 @@ impl CefURLRequest {
|
|||
// object is read-only and should not be modified.
|
||||
//
|
||||
pub fn get_request(&self) -> interfaces::CefRequest {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -201,7 +207,8 @@ impl CefURLRequest {
|
|||
// Returns the client.
|
||||
//
|
||||
pub fn get_client(&self) -> interfaces::CefURLRequestClient {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -215,7 +222,8 @@ impl CefURLRequest {
|
|||
// Returns the request status.
|
||||
//
|
||||
pub fn get_request_status(&self) -> types::cef_urlrequest_status_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -230,7 +238,8 @@ impl CefURLRequest {
|
|||
// otherwise.
|
||||
//
|
||||
pub fn get_request_error(&self) -> types::cef_errorcode_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -246,7 +255,8 @@ impl CefURLRequest {
|
|||
// The returned object is read-only and should not be modified.
|
||||
//
|
||||
pub fn get_response(&self) -> interfaces::CefResponse {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -260,7 +270,8 @@ impl CefURLRequest {
|
|||
// Cancel the request.
|
||||
//
|
||||
pub fn cancel(&self) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -280,15 +291,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)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +325,8 @@ impl CefWrap<*mut cef_urlrequest_t> for Option<CefURLRequest> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_urlrequest_t) -> Option<CefURLRequest> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefURLRequest::from_c_object_addref(c_object))
|
||||
|
@ -347,8 +364,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 +374,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
|
||||
|
@ -387,13 +404,13 @@ pub struct _cef_urlrequest_client_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_urlrequest_client_t = _cef_urlrequest_client_t;
|
||||
|
||||
|
@ -410,7 +427,8 @@ pub struct CefURLRequestClient {
|
|||
impl Clone for CefURLRequestClient {
|
||||
fn clone(&self) -> CefURLRequestClient{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefURLRequestClient {
|
||||
|
@ -423,7 +441,8 @@ impl Clone for CefURLRequestClient {
|
|||
impl Drop for CefURLRequestClient {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -438,7 +457,8 @@ impl CefURLRequestClient {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_urlrequest_client_t) -> CefURLRequestClient {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefURLRequestClient {
|
||||
|
@ -452,7 +472,8 @@ impl CefURLRequestClient {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_urlrequest_client_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -460,10 +481,10 @@ impl CefURLRequestClient {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -472,7 +493,8 @@ impl CefURLRequestClient {
|
|||
// successful or not.
|
||||
//
|
||||
pub fn on_request_complete(&self, request: interfaces::CefURLRequest) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -490,8 +512,9 @@ 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) -> () {
|
||||
if self.c_object.is_null() {
|
||||
current: i64, total: i64) -> () {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -510,8 +533,9 @@ impl CefURLRequestClient {
|
|||
// response (or -1 if not determined).
|
||||
//
|
||||
pub fn on_download_progress(&self, request: interfaces::CefURLRequest,
|
||||
current: u64, total: u64) -> () {
|
||||
if self.c_object.is_null() {
|
||||
current: i64, total: i64) -> () {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -531,7 +555,8 @@ impl CefURLRequestClient {
|
|||
//
|
||||
pub fn on_download_data(&self, request: interfaces::CefURLRequest, data: &(),
|
||||
data_length: libc::size_t) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -556,7 +581,8 @@ impl CefURLRequestClient {
|
|||
pub fn get_auth_credentials(&self, isProxy: libc::c_int, host: &[u16],
|
||||
port: libc::c_int, realm: &[u16], scheme: &[u16],
|
||||
callback: interfaces::CefAuthCallback) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -589,7 +615,8 @@ impl CefWrap<*mut cef_urlrequest_client_t> for Option<CefURLRequestClient> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_urlrequest_client_t) -> Option<CefURLRequestClient> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefURLRequestClient::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -86,13 +87,13 @@ pub struct _cef_web_plugin_info_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_web_plugin_info_t = _cef_web_plugin_info_t;
|
||||
|
||||
|
@ -107,7 +108,8 @@ pub struct CefWebPluginInfo {
|
|||
impl Clone for CefWebPluginInfo {
|
||||
fn clone(&self) -> CefWebPluginInfo{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefWebPluginInfo {
|
||||
|
@ -120,7 +122,8 @@ impl Clone for CefWebPluginInfo {
|
|||
impl Drop for CefWebPluginInfo {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +138,8 @@ impl CefWebPluginInfo {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_web_plugin_info_t) -> CefWebPluginInfo {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefWebPluginInfo {
|
||||
|
@ -149,7 +153,8 @@ impl CefWebPluginInfo {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_web_plugin_info_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -157,10 +162,10 @@ impl CefWebPluginInfo {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -168,7 +173,8 @@ impl CefWebPluginInfo {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_name(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -183,7 +189,8 @@ impl CefWebPluginInfo {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_path(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -198,7 +205,8 @@ impl CefWebPluginInfo {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_version(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -213,7 +221,8 @@ impl CefWebPluginInfo {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_description(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -240,7 +249,8 @@ impl CefWrap<*mut cef_web_plugin_info_t> for Option<CefWebPluginInfo> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_web_plugin_info_t) -> Option<CefWebPluginInfo> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefWebPluginInfo::from_c_object_addref(c_object))
|
||||
|
@ -273,13 +283,13 @@ pub struct _cef_web_plugin_info_visitor_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_web_plugin_info_visitor_t = _cef_web_plugin_info_visitor_t;
|
||||
|
||||
|
@ -295,7 +305,8 @@ pub struct CefWebPluginInfoVisitor {
|
|||
impl Clone for CefWebPluginInfoVisitor {
|
||||
fn clone(&self) -> CefWebPluginInfoVisitor{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefWebPluginInfoVisitor {
|
||||
|
@ -308,7 +319,8 @@ impl Clone for CefWebPluginInfoVisitor {
|
|||
impl Drop for CefWebPluginInfoVisitor {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -323,7 +335,8 @@ impl CefWebPluginInfoVisitor {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_web_plugin_info_visitor_t) -> CefWebPluginInfoVisitor {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefWebPluginInfoVisitor {
|
||||
|
@ -337,7 +350,8 @@ impl CefWebPluginInfoVisitor {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_web_plugin_info_visitor_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -345,10 +359,10 @@ impl CefWebPluginInfoVisitor {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -359,7 +373,8 @@ impl CefWebPluginInfoVisitor {
|
|||
//
|
||||
pub fn visit(&self, info: interfaces::CefWebPluginInfo, count: libc::c_int,
|
||||
total: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -389,7 +404,8 @@ impl CefWrap<*mut cef_web_plugin_info_visitor_t> for Option<CefWebPluginInfoVisi
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_web_plugin_info_visitor_t) -> Option<CefWebPluginInfoVisitor> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefWebPluginInfoVisitor::from_c_object_addref(c_object))
|
||||
|
@ -421,13 +437,13 @@ pub struct _cef_web_plugin_unstable_callback_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_web_plugin_unstable_callback_t = _cef_web_plugin_unstable_callback_t;
|
||||
|
||||
|
@ -443,7 +459,8 @@ pub struct CefWebPluginUnstableCallback {
|
|||
impl Clone for CefWebPluginUnstableCallback {
|
||||
fn clone(&self) -> CefWebPluginUnstableCallback{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefWebPluginUnstableCallback {
|
||||
|
@ -456,7 +473,8 @@ impl Clone for CefWebPluginUnstableCallback {
|
|||
impl Drop for CefWebPluginUnstableCallback {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -471,7 +489,8 @@ impl CefWebPluginUnstableCallback {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_web_plugin_unstable_callback_t) -> CefWebPluginUnstableCallback {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefWebPluginUnstableCallback {
|
||||
|
@ -485,7 +504,8 @@ impl CefWebPluginUnstableCallback {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_web_plugin_unstable_callback_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -493,10 +513,10 @@ impl CefWebPluginUnstableCallback {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -505,7 +525,8 @@ impl CefWebPluginUnstableCallback {
|
|||
// 120 seconds.
|
||||
//
|
||||
pub fn is_unstable(&self, path: &[u16], unstable: libc::c_int) -> () {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -534,7 +555,8 @@ impl CefWrap<*mut cef_web_plugin_unstable_callback_t> for Option<CefWebPluginUns
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_web_plugin_unstable_callback_t) -> Option<CefWebPluginUnstableCallback> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefWebPluginUnstableCallback::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -277,13 +278,13 @@ pub struct _cef_xml_reader_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_xml_reader_t = _cef_xml_reader_t;
|
||||
|
||||
|
@ -300,7 +301,8 @@ pub struct CefXmlReader {
|
|||
impl Clone for CefXmlReader {
|
||||
fn clone(&self) -> CefXmlReader{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefXmlReader {
|
||||
|
@ -313,7 +315,8 @@ impl Clone for CefXmlReader {
|
|||
impl Drop for CefXmlReader {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -328,7 +331,8 @@ impl CefXmlReader {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_xml_reader_t) -> CefXmlReader {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefXmlReader {
|
||||
|
@ -342,7 +346,8 @@ impl CefXmlReader {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_xml_reader_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -350,10 +355,10 @@ impl CefXmlReader {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -362,7 +367,8 @@ impl CefXmlReader {
|
|||
// if the cursor position was set successfully.
|
||||
//
|
||||
pub fn move_to_next_node(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -377,7 +383,8 @@ impl CefXmlReader {
|
|||
// occurs on the correct thread.
|
||||
//
|
||||
pub fn close(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -391,7 +398,8 @@ impl CefXmlReader {
|
|||
// Returns true (1) if an error has been reported by the XML parser.
|
||||
//
|
||||
pub fn has_error(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -406,7 +414,8 @@ impl CefXmlReader {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_error(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -424,7 +433,8 @@ impl CefXmlReader {
|
|||
// Returns the node type.
|
||||
//
|
||||
pub fn get_type(&self) -> types::cef_xml_node_type_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -438,7 +448,8 @@ impl CefXmlReader {
|
|||
// Returns the node depth. Depth starts at 0 for the root node.
|
||||
//
|
||||
pub fn get_depth(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -454,7 +465,8 @@ impl CefXmlReader {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_local_name(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -470,7 +482,8 @@ impl CefXmlReader {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_prefix(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -486,7 +499,8 @@ impl CefXmlReader {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_qualified_name(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -502,7 +516,8 @@ impl CefXmlReader {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_namespace_uri(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -518,7 +533,8 @@ impl CefXmlReader {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_base_uri(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -534,7 +550,8 @@ impl CefXmlReader {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_xml_lang(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -549,7 +566,8 @@ impl CefXmlReader {
|
|||
// NULL but <a></a> is not.
|
||||
//
|
||||
pub fn is_empty_element(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -563,7 +581,8 @@ impl CefXmlReader {
|
|||
// Returns true (1) if the node has a text value.
|
||||
//
|
||||
pub fn has_value(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -578,7 +597,8 @@ impl CefXmlReader {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_value(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -592,7 +612,8 @@ impl CefXmlReader {
|
|||
// Returns true (1) if the node has attributes.
|
||||
//
|
||||
pub fn has_attributes(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -606,7 +627,8 @@ impl CefXmlReader {
|
|||
// Returns the number of attributes.
|
||||
//
|
||||
pub fn get_attribute_count(&self) -> libc::size_t {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -621,7 +643,8 @@ impl CefXmlReader {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_attribute_byindex(&self, index: libc::c_int) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -637,7 +660,8 @@ impl CefXmlReader {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_attribute_byqname(&self, qualifiedName: &[u16]) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -655,7 +679,8 @@ impl CefXmlReader {
|
|||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_attribute_bylname(&self, localName: &[u16],
|
||||
namespaceURI: &[u16]) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -672,7 +697,8 @@ impl CefXmlReader {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_inner_xml(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -687,7 +713,8 @@ impl CefXmlReader {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_outer_xml(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -701,7 +728,8 @@ impl CefXmlReader {
|
|||
// Returns the line number for the current node.
|
||||
//
|
||||
pub fn get_line_number(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -722,7 +750,8 @@ impl CefXmlReader {
|
|||
// true (1) if the cursor position was set successfully.
|
||||
//
|
||||
pub fn move_to_attribute_byindex(&self, index: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -739,7 +768,8 @@ impl CefXmlReader {
|
|||
//
|
||||
pub fn move_to_attribute_byqname(&self,
|
||||
qualifiedName: &[u16]) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -757,7 +787,8 @@ impl CefXmlReader {
|
|||
//
|
||||
pub fn move_to_attribute_bylname(&self, localName: &[u16],
|
||||
namespaceURI: &[u16]) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -774,7 +805,8 @@ impl CefXmlReader {
|
|||
// true (1) if the cursor position was set successfully.
|
||||
//
|
||||
pub fn move_to_first_attribute(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -789,7 +821,8 @@ impl CefXmlReader {
|
|||
// (1) if the cursor position was set successfully.
|
||||
//
|
||||
pub fn move_to_next_attribute(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -804,7 +837,8 @@ impl CefXmlReader {
|
|||
// cursor position was set successfully.
|
||||
//
|
||||
pub fn move_to_carrying_element(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -847,7 +881,8 @@ impl CefWrap<*mut cef_xml_reader_t> for Option<CefXmlReader> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_xml_reader_t) -> Option<CefXmlReader> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefXmlReader::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
|
||||
|
@ -43,6 +43,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use libc;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
//
|
||||
|
@ -105,7 +106,7 @@ pub struct _cef_zip_reader_t {
|
|||
// Returns the last modified timestamp for the file.
|
||||
//
|
||||
pub get_file_last_modified: Option<extern "C" fn(
|
||||
this: *mut cef_zip_reader_t) -> libc::time_t>,
|
||||
this: *mut cef_zip_reader_t) -> types::cef_time_t>,
|
||||
|
||||
//
|
||||
// Opens the file for reading of uncompressed data. A read password may
|
||||
|
@ -140,13 +141,13 @@ pub struct _cef_zip_reader_t {
|
|||
//
|
||||
// The reference count. This will only be present for Rust instances!
|
||||
//
|
||||
pub ref_count: usize,
|
||||
pub ref_count: u32,
|
||||
|
||||
//
|
||||
// Extra data. This will only be present for Rust instances!
|
||||
//
|
||||
pub extra: u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub type cef_zip_reader_t = _cef_zip_reader_t;
|
||||
|
||||
|
@ -163,7 +164,8 @@ pub struct CefZipReader {
|
|||
impl Clone for CefZipReader {
|
||||
fn clone(&self) -> CefZipReader{
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.add_ref.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
CefZipReader {
|
||||
|
@ -176,7 +178,8 @@ impl Clone for CefZipReader {
|
|||
impl Drop for CefZipReader {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*self.c_object).base.release.unwrap())(&mut (*self.c_object).base);
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +194,8 @@ impl CefZipReader {
|
|||
}
|
||||
|
||||
pub unsafe fn from_c_object_addref(c_object: *mut cef_zip_reader_t) -> CefZipReader {
|
||||
if !c_object.is_null() {
|
||||
if !c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
((*c_object).base.add_ref.unwrap())(&mut (*c_object).base);
|
||||
}
|
||||
CefZipReader {
|
||||
|
@ -205,7 +209,8 @@ impl CefZipReader {
|
|||
|
||||
pub fn c_object_addrefed(&self) -> *mut cef_zip_reader_t {
|
||||
unsafe {
|
||||
if !self.c_object.is_null() {
|
||||
if !self.c_object.is_null() &&
|
||||
self.c_object as usize != mem::POST_DROP_USIZE {
|
||||
eutil::add_ref(self.c_object as *mut types::cef_base_t);
|
||||
}
|
||||
self.c_object
|
||||
|
@ -213,10 +218,10 @@ impl CefZipReader {
|
|||
}
|
||||
|
||||
pub fn is_null_cef_object(&self) -> bool {
|
||||
self.c_object.is_null()
|
||||
self.c_object.is_null() || self.c_object as usize == mem::POST_DROP_USIZE
|
||||
}
|
||||
pub fn is_not_null_cef_object(&self) -> bool {
|
||||
!self.c_object.is_null()
|
||||
!self.c_object.is_null() && self.c_object as usize != mem::POST_DROP_USIZE
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -224,7 +229,8 @@ impl CefZipReader {
|
|||
// cursor position was set successfully.
|
||||
//
|
||||
pub fn move_to_first_file(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -239,7 +245,8 @@ impl CefZipReader {
|
|||
// cursor position was set successfully.
|
||||
//
|
||||
pub fn move_to_next_file(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -256,7 +263,8 @@ impl CefZipReader {
|
|||
//
|
||||
pub fn move_to_file(&self, fileName: &[u16],
|
||||
caseSensitive: libc::c_int) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -273,7 +281,8 @@ impl CefZipReader {
|
|||
// occurs on the correct thread.
|
||||
//
|
||||
pub fn close(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -291,7 +300,8 @@ impl CefZipReader {
|
|||
//
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
pub fn get_file_name(&self) -> String {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -305,7 +315,8 @@ impl CefZipReader {
|
|||
// Returns the uncompressed size of the file.
|
||||
//
|
||||
pub fn get_file_size(&self) -> i64 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -318,8 +329,9 @@ impl CefZipReader {
|
|||
//
|
||||
// Returns the last modified timestamp for the file.
|
||||
//
|
||||
pub fn get_file_last_modified(&self) -> libc::time_t {
|
||||
if self.c_object.is_null() {
|
||||
pub fn get_file_last_modified(&self) -> types::cef_time_t {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -334,7 +346,8 @@ impl CefZipReader {
|
|||
// optionally be specified.
|
||||
//
|
||||
pub fn open_file(&self, password: &[u16]) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -349,7 +362,8 @@ impl CefZipReader {
|
|||
// Closes the file.
|
||||
//
|
||||
pub fn close_file(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -365,7 +379,8 @@ impl CefZipReader {
|
|||
//
|
||||
pub fn read_file(&self, buffer: &mut (),
|
||||
bufferSize: libc::size_t) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -381,7 +396,8 @@ impl CefZipReader {
|
|||
// Returns the current offset in the uncompressed file contents.
|
||||
//
|
||||
pub fn tell(&self) -> i64 {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -395,7 +411,8 @@ impl CefZipReader {
|
|||
// Returns true (1) if at end of the file contents.
|
||||
//
|
||||
pub fn eof(&self) -> libc::c_int {
|
||||
if self.c_object.is_null() {
|
||||
if self.c_object.is_null() ||
|
||||
self.c_object as usize == mem::POST_DROP_USIZE {
|
||||
panic!("called a CEF method on a null object")
|
||||
}
|
||||
unsafe {
|
||||
|
@ -435,7 +452,8 @@ impl CefWrap<*mut cef_zip_reader_t> for Option<CefZipReader> {
|
|||
}
|
||||
}
|
||||
unsafe fn to_rust(c_object: *mut cef_zip_reader_t) -> Option<CefZipReader> {
|
||||
if c_object.is_null() {
|
||||
if c_object.is_null() &&
|
||||
c_object as usize != mem::POST_DROP_USIZE {
|
||||
None
|
||||
} else {
|
||||
Some(CefZipReader::from_c_object_addref(c_object))
|
||||
|
|
|
@ -2,104 +2,69 @@
|
|||
* 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/. */
|
||||
|
||||
//! 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_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_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_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,CefScreenInfo,cef_browser_settings_t,CefBrowserSettings,cef_cursor_info_t,CefCursorInfo,cef_request_context_settings_t,CefRequestContextSettings,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 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,28 +77,35 @@ 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;
|
||||
|
@ -144,5 +116,3 @@ pub mod cef_values;
|
|||
pub mod cef_web_plugin;
|
||||
pub mod cef_xml_reader;
|
||||
pub mod cef_zip_reader;
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#![feature(collections)]
|
||||
#![feature(negate_unsigned)]
|
||||
#![feature(unicode)]
|
||||
|
||||
#![feature(unsafe_no_drop_flag, filling_drop)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#![plugin(plugins)]
|
||||
|
|
|
@ -66,7 +66,7 @@ macro_rules! full_cef_class_impl(
|
|||
// Calculate the offset of the reference count. This is the size of the
|
||||
// structure.
|
||||
let null: *const $c_interface_name = ::std::ptr::null();
|
||||
let offset: *const usize = &(*null).ref_count;
|
||||
let offset: *const u32 = &(*null).ref_count;
|
||||
let size = (offset as ::libc::size_t) - (null as ::libc::size_t);
|
||||
$interface_name::from_c_object_addref(
|
||||
::eutil::create_cef_object::<$c_interface_name,$class_name>(size))
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/zsh
|
||||
|
||||
# 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/.
|
||||
|
||||
|
||||
setopt extended_glob
|
||||
echo -e $(cat << END_MPL
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public\n
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this\n
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n
|
||||
END_MPL) >>| interfaces_mod.rs
|
||||
|
||||
# loop all files in interfaces dir
|
||||
for x in $(print interfaces/*.rs~interfaces/mod.rs)
|
||||
do
|
||||
# open the use statement
|
||||
echo -n "pub use interfaces::$(basename $x .rs)::{" >>| interfaces_mod.rs
|
||||
# append all pub struct names which do not begin with '_'
|
||||
grep -E '^pub struct [^_]' $x|sed 's/.*struct \(.*\) .*/\1/'|tr '\n' ',' >>| interfaces_mod.rs
|
||||
# append all pub types
|
||||
grep -E '^pub type ' $x|sed 's/pub type \([^ ]*\) .*/\1/'|tr '\n' ',' >>| interfaces_mod.rs
|
||||
# close the use statement
|
||||
echo '};' >>| interfaces_mod.rs
|
||||
done
|
||||
# open use statement for manually-generated types.rs
|
||||
echo -n "pub use types::{" >>| interfaces_mod.rs
|
||||
# append all pub types
|
||||
grep -E '^pub type ' types.rs|sed 's/pub type \([^ ]*\) .*/\1/'|uniq|tr '\n' ',' >>| interfaces_mod.rs
|
||||
# append all pub enums
|
||||
grep -E '^pub enum ' types.rs|sed 's/pub enum \([^ ]*\) .*/\1/'|uniq|tr '\n' ',' >>| interfaces_mod.rs
|
||||
# close use statement
|
||||
echo '};' >>| interfaces_mod.rs
|
||||
# append all pub structs beginning with "Cef" to alias them from types:: -> interfaces::
|
||||
# some generated code from cef uses interfaces:: for types that it does not generate
|
||||
grep -E '^pub struct Cef' types.rs|sed 's/pub struct \([^ ]*\) .*/pub use types::\1 as \1;/'|uniq >>| interfaces_mod.rs
|
||||
# newline separators
|
||||
echo -e '\n\n' >>| interfaces_mod.rs
|
||||
# loop all files in interfaces dir again
|
||||
for x in $(print interfaces/*.rs~interfaces/mod.rs)
|
||||
do
|
||||
# add mod statements for all interfaces
|
||||
echo "pub mod $(basename $x .rs);" >>| interfaces_mod.rs
|
||||
done
|
|
@ -2,11 +2,15 @@
|
|||
* 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 interfaces::{cef_request_context_handler_t, cef_request_context_t};
|
||||
use interfaces::{cef_request_context_handler_t, cef_request_context_t, cef_request_context_settings_t};
|
||||
|
||||
cef_stub_static_method_impls! {
|
||||
fn cef_request_context_get_global_context() -> *mut cef_request_context_t
|
||||
fn cef_request_context_create_context(_handler: *mut cef_request_context_handler_t)
|
||||
fn cef_request_context_create_context(_settings: *const cef_request_context_settings_t,
|
||||
_handler: *mut cef_request_context_handler_t)
|
||||
-> *mut cef_request_context_t
|
||||
fn cef_request_context_create_context_shared(_other: *mut cef_request_context_t,
|
||||
_handler: *mut cef_request_context_handler_t)
|
||||
-> *mut cef_request_context_t
|
||||
}
|
||||
|
||||
|
|
|
@ -17,28 +17,6 @@ pub enum cef_string_list_t {}
|
|||
pub enum cef_text_input_context_t {}
|
||||
pub enum cef_event_handle_t {}
|
||||
|
||||
//these all need to be done...
|
||||
pub enum cef_binary_value_t {}
|
||||
pub enum cef_dictionary_value_t {}
|
||||
pub enum cef_request_t {}
|
||||
pub enum cef_response_t {}
|
||||
pub enum cef_urlrequest_client_t {}
|
||||
pub enum cef_domnode_t {}
|
||||
pub enum cef_load_handler_t {}
|
||||
pub enum cef_browser_settings_t {}
|
||||
pub enum cef_v8context_t {}
|
||||
pub enum cef_v8exception_t {}
|
||||
pub enum cef_v8stack_trace_t {}
|
||||
pub enum cef_context_menu_handler_t {}
|
||||
pub enum cef_dialog_handler_t {}
|
||||
pub enum cef_download_handler_t {}
|
||||
pub enum cef_drag_handler_t {}
|
||||
pub enum cef_focus_handler_t {}
|
||||
pub enum cef_geolocation_handler_t {}
|
||||
pub enum cef_jsdialog_handler_t {}
|
||||
pub enum cef_keyboard_handler_t {}
|
||||
pub enum cef_render_handler_t {}
|
||||
pub enum cef_request_handler_t {}
|
||||
#[cfg(target_os="linux")]
|
||||
pub type cef_window_handle_t = c_ulong;
|
||||
#[cfg(target_os="macos")]
|
||||
|
@ -52,20 +30,6 @@ pub type cef_cursor_handle_t = *mut c_void; //NSCursor*
|
|||
//#[cfg(target_os="win")]
|
||||
//pub enum cef_cursor_handle_t {} //HCURSOR
|
||||
|
||||
pub enum cef_request_val {}
|
||||
pub type cef_request = *mut cef_request_val;
|
||||
pub enum cef_navigation_type_val {}
|
||||
pub type cef_navigation_type = *mut cef_navigation_type_val;
|
||||
pub enum cef_screen_info_t {}
|
||||
pub type cef_v8context = *mut cef_v8context_t;
|
||||
pub enum cef_v8exception_val {}
|
||||
pub type cef_v8exception = *mut cef_v8exception_val;
|
||||
pub enum cef_v8stack_trace_val {}
|
||||
pub type cef_v8stack_trace = *mut cef_v8stack_trace_val;
|
||||
|
||||
pub type CefBrowserSettings = cef_browser_settings_t;
|
||||
pub type CefScreenInfo = cef_screen_info_t;
|
||||
|
||||
pub type cef_string_t = cef_string_utf16; //FIXME: this is #defined...
|
||||
pub type cef_string_userfree_t = *mut cef_string_t; //FIXME: this is #defined...
|
||||
|
||||
|
@ -101,6 +65,25 @@ pub struct cef_main_args {
|
|||
|
||||
pub type cef_color_t = c_uint;
|
||||
|
||||
///
|
||||
// Represents the state of a setting.
|
||||
///
|
||||
pub enum cef_state_t {
|
||||
///
|
||||
// Use the default state for the setting.
|
||||
///
|
||||
STATE_DEFAULT = 0,
|
||||
|
||||
///
|
||||
// Enable or allow the setting.
|
||||
///
|
||||
STATE_ENABLED,
|
||||
|
||||
///
|
||||
// Disable or disallow the setting.
|
||||
///
|
||||
STATE_DISABLED,
|
||||
}
|
||||
//
|
||||
// Existing thread IDs.
|
||||
//
|
||||
|
@ -1570,3 +1553,415 @@ pub enum cef_xml_encoding_type_t {
|
|||
XML_ENCODING_ASCII,
|
||||
}
|
||||
|
||||
///
|
||||
// The manner in which a link click should be opened.
|
||||
///
|
||||
pub enum cef_window_open_disposition_t {
|
||||
WOD_UNKNOWN = 0,
|
||||
WOD_SUPPRESS_OPEN,
|
||||
WOD_CURRENT_TAB,
|
||||
WOD_SINGLETON_TAB,
|
||||
WOD_NEW_FOREGROUND_TAB,
|
||||
WOD_NEW_BACKGROUND_TAB,
|
||||
WOD_NEW_POPUP,
|
||||
WOD_NEW_WINDOW,
|
||||
WOD_SAVE_TO_DISK,
|
||||
WOD_OFF_THE_RECORD,
|
||||
WOD_IGNORE_ACTION
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
// Cursor type values.
|
||||
///
|
||||
pub enum cef_cursor_type_t {
|
||||
CT_POINTER = 0,
|
||||
CT_CROSS,
|
||||
CT_HAND,
|
||||
CT_IBEAM,
|
||||
CT_WAIT,
|
||||
CT_HELP,
|
||||
CT_EASTRESIZE,
|
||||
CT_NORTHRESIZE,
|
||||
CT_NORTHEASTRESIZE,
|
||||
CT_NORTHWESTRESIZE,
|
||||
CT_SOUTHRESIZE,
|
||||
CT_SOUTHEASTRESIZE,
|
||||
CT_SOUTHWESTRESIZE,
|
||||
CT_WESTRESIZE,
|
||||
CT_NORTHSOUTHRESIZE,
|
||||
CT_EASTWESTRESIZE,
|
||||
CT_NORTHEASTSOUTHWESTRESIZE,
|
||||
CT_NORTHWESTSOUTHEASTRESIZE,
|
||||
CT_COLUMNRESIZE,
|
||||
CT_ROWRESIZE,
|
||||
CT_MIDDLEPANNING,
|
||||
CT_EASTPANNING,
|
||||
CT_NORTHPANNING,
|
||||
CT_NORTHEASTPANNING,
|
||||
CT_NORTHWESTPANNING,
|
||||
CT_SOUTHPANNING,
|
||||
CT_SOUTHEASTPANNING,
|
||||
CT_SOUTHWESTPANNING,
|
||||
CT_WESTPANNING,
|
||||
CT_MOVE,
|
||||
CT_VERTICALTEXT,
|
||||
CT_CELL,
|
||||
CT_CONTEXTMENU,
|
||||
CT_ALIAS,
|
||||
CT_PROGRESS,
|
||||
CT_NODROP,
|
||||
CT_COPY,
|
||||
CT_NONE,
|
||||
CT_NOTALLOWED,
|
||||
CT_ZOOMIN,
|
||||
CT_ZOOMOUT,
|
||||
CT_GRAB,
|
||||
CT_GRABBING,
|
||||
CT_CUSTOM,
|
||||
}
|
||||
|
||||
///
|
||||
// Screen information used when window rendering is disabled. This structure is
|
||||
// passed as a parameter to CefRenderHandler::GetScreenInfo and should be filled
|
||||
// in by the client.
|
||||
///
|
||||
pub struct _cef_screen_info {
|
||||
///
|
||||
// Device scale factor. Specifies the ratio between physical and logical
|
||||
// pixels.
|
||||
///
|
||||
pub device_scale_factor: f32,
|
||||
|
||||
///
|
||||
// The screen depth in bits per pixel.
|
||||
///
|
||||
pub depth: i32,
|
||||
|
||||
///
|
||||
// The bits per color component. This assumes that the colors are balanced
|
||||
// equally.
|
||||
///
|
||||
pub depth_per_component: i32,
|
||||
|
||||
///
|
||||
// This can be true for black and white printers.
|
||||
///
|
||||
pub is_monochrome: i32,
|
||||
|
||||
///
|
||||
// This is set from the rcMonitor member of MONITORINFOEX, to whit:
|
||||
// "A RECT structure that specifies the display monitor rectangle,
|
||||
// expressed in virtual-screen coordinates. Note that if the monitor
|
||||
// is not the primary display monitor, some of the rectangle's
|
||||
// coordinates may be negative values."
|
||||
//
|
||||
// The |rect| and |available_rect| properties are used to determine the
|
||||
// available surface for rendering popup views.
|
||||
///
|
||||
pub rect: cef_rect_t,
|
||||
|
||||
///
|
||||
// This is set from the rcWork member of MONITORINFOEX, to whit:
|
||||
// "A RECT structure that specifies the work area rectangle of the
|
||||
// display monitor that can be used by applications, expressed in
|
||||
// virtual-screen coordinates. Windows uses this rectangle to
|
||||
// maximize an application on the monitor. The rest of the area in
|
||||
// rcMonitor contains system windows such as the task bar and side
|
||||
// bars. Note that if the monitor is not the primary display monitor,
|
||||
// some of the rectangle's coordinates may be negative values".
|
||||
//
|
||||
// The |rect| and |available_rect| properties are used to determine the
|
||||
// available surface for rendering popup views.
|
||||
///
|
||||
pub available_rect: cef_rect_t,
|
||||
}
|
||||
|
||||
pub type cef_screen_info_t = _cef_screen_info;
|
||||
pub type CefScreenInfo = cef_screen_info_t;
|
||||
|
||||
///
|
||||
// Browser initialization settings. Specify NULL or 0 to get the recommended
|
||||
// default values. The consequences of using custom values may not be well
|
||||
// tested. Many of these and other settings can also configured using command-
|
||||
// line switches.
|
||||
///
|
||||
pub struct _cef_browser_settings {
|
||||
///
|
||||
// Size of this structure.
|
||||
///
|
||||
pub size: u64,
|
||||
|
||||
///
|
||||
// The maximum rate in frames per second (fps) that CefRenderHandler::OnPaint
|
||||
// will be called for a windowless browser. The actual fps may be lower if
|
||||
// the browser cannot generate frames at the requested rate. The minimum
|
||||
// value is 1 and the maximum value is 60 (default 30).
|
||||
///
|
||||
pub windowless_frame_rate: i32,
|
||||
|
||||
// The below values map to WebPreferences settings.
|
||||
|
||||
///
|
||||
// Font settings.
|
||||
///
|
||||
pub standard_font_family: cef_string_t,
|
||||
pub fixed_font_family: cef_string_t,
|
||||
pub serif_font_family: cef_string_t,
|
||||
pub sans_serif_font_family: cef_string_t,
|
||||
pub cursive_font_family: cef_string_t,
|
||||
pub fantasy_font_family: cef_string_t,
|
||||
pub default_font_size: i32,
|
||||
pub default_fixed_font_size: i32,
|
||||
pub minimum_font_size: i32,
|
||||
pub minimum_logical_font_size: i32,
|
||||
|
||||
///
|
||||
// Default encoding for Web content. If empty "ISO-8859-1" will be used. Also
|
||||
// configurable using the "default-encoding" command-line switch.
|
||||
///
|
||||
pub default_encoding: cef_string_t,
|
||||
|
||||
///
|
||||
// Controls the loading of fonts from remote sources. Also configurable using
|
||||
// the "disable-remote-fonts" command-line switch.
|
||||
///
|
||||
pub remote_fonts: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether JavaScript can be executed. Also configurable using the
|
||||
// "disable-javascript" command-line switch.
|
||||
///
|
||||
pub javascript: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether JavaScript can be used for opening windows. Also
|
||||
// configurable using the "disable-javascript-open-windows" command-line
|
||||
// switch.
|
||||
///
|
||||
pub javascript_open_windows: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether JavaScript can be used to close windows that were not
|
||||
// opened via JavaScript. JavaScript can still be used to close windows that
|
||||
// were opened via JavaScript or that have no back/forward history. Also
|
||||
// configurable using the "disable-javascript-close-windows" command-line
|
||||
// switch.
|
||||
///
|
||||
pub javascript_close_windows: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether JavaScript can access the clipboard. Also configurable
|
||||
// using the "disable-javascript-access-clipboard" command-line switch.
|
||||
///
|
||||
pub javascript_access_clipboard: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether DOM pasting is supported in the editor via
|
||||
// execCommand("paste"). The |javascript_access_clipboard| setting must also
|
||||
// be enabled. Also configurable using the "disable-javascript-dom-paste"
|
||||
// command-line switch.
|
||||
///
|
||||
pub javascript_dom_paste: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether the caret position will be drawn. Also configurable using
|
||||
// the "enable-caret-browsing" command-line switch.
|
||||
///
|
||||
pub caret_browsing: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether the Java plugin will be loaded. Also configurable using
|
||||
// the "disable-java" command-line switch.
|
||||
///
|
||||
pub java: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether any plugins will be loaded. Also configurable using the
|
||||
// "disable-plugins" command-line switch.
|
||||
///
|
||||
pub plugins: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether file URLs will have access to all URLs. Also configurable
|
||||
// using the "allow-universal-access-from-files" command-line switch.
|
||||
///
|
||||
pub universal_access_from_file_urls: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether file URLs will have access to other file URLs. Also
|
||||
// configurable using the "allow-access-from-files" command-line switch.
|
||||
///
|
||||
pub file_access_from_file_urls: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether web security restrictions (same-origin policy) will be
|
||||
// enforced. Disabling this setting is not recommend as it will allow risky
|
||||
// security behavior such as cross-site scripting (XSS). Also configurable
|
||||
// using the "disable-web-security" command-line switch.
|
||||
///
|
||||
pub web_security: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether image URLs will be loaded from the network. A cached image
|
||||
// will still be rendered if requested. Also configurable using the
|
||||
// "disable-image-loading" command-line switch.
|
||||
///
|
||||
pub image_loading: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether standalone images will be shrunk to fit the page. Also
|
||||
// configurable using the "image-shrink-standalone-to-fit" command-line
|
||||
// switch.
|
||||
///
|
||||
pub image_shrink_standalone_to_fit: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether text areas can be resized. Also configurable using the
|
||||
// "disable-text-area-resize" command-line switch.
|
||||
///
|
||||
pub text_area_resize: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether the tab key can advance focus to links. Also configurable
|
||||
// using the "disable-tab-to-links" command-line switch.
|
||||
///
|
||||
pub tab_to_links: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether local storage can be used. Also configurable using the
|
||||
// "disable-local-storage" command-line switch.
|
||||
///
|
||||
pub local_storage: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether databases can be used. Also configurable using the
|
||||
// "disable-databases" command-line switch.
|
||||
///
|
||||
pub databases: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether the application cache can be used. Also configurable using
|
||||
// the "disable-application-cache" command-line switch.
|
||||
///
|
||||
pub application_cache: cef_state_t,
|
||||
|
||||
///
|
||||
// Controls whether WebGL can be used. Note that WebGL requires hardware
|
||||
// support and may not work on all systems even when enabled. Also
|
||||
// configurable using the "disable-webgl" command-line switch.
|
||||
///
|
||||
pub webgl: cef_state_t,
|
||||
|
||||
///
|
||||
// Opaque background color used for the browser before a document is loaded
|
||||
// and when no document color is specified. By default the background color
|
||||
// will be the same as CefSettings.background_color. Only the RGB compontents
|
||||
// of the specified value will be used. The alpha component must greater than
|
||||
// 0 to enable use of the background color but will be otherwise ignored.
|
||||
///
|
||||
pub background_color: cef_color_t,
|
||||
|
||||
///
|
||||
// Comma delimited ordered list of language codes without any whitespace that
|
||||
// will be used in the "Accept-Language" HTTP header. May be set globally
|
||||
// using the CefBrowserSettings.accept_language_list value. If both values are
|
||||
// empty then "en-US,en" will be used.
|
||||
///
|
||||
pub accept_language_list: cef_string_t,
|
||||
}
|
||||
|
||||
pub type cef_browser_settings_t = _cef_browser_settings;
|
||||
pub type CefBrowserSettings = cef_browser_settings_t;
|
||||
|
||||
|
||||
///
|
||||
// Structure representing cursor information. |buffer| will be
|
||||
// |size.width|*|size.height|*4 bytes in size and represents a BGRA image with
|
||||
// an upper-left origin.
|
||||
///
|
||||
pub struct _cef_cursor_info {
|
||||
pub hotspot: cef_point_t,
|
||||
pub image_scale_factor: f32,
|
||||
pub buffer: *mut isize,
|
||||
pub size: cef_size_t,
|
||||
}
|
||||
|
||||
pub type cef_cursor_info_t = _cef_cursor_info;
|
||||
pub type CefCursorInfo = cef_cursor_info_t;
|
||||
|
||||
///
|
||||
// Return value types.
|
||||
///
|
||||
pub enum cef_return_value_t {
|
||||
///
|
||||
// Cancel immediately.
|
||||
///
|
||||
RV_CANCEL = 0,
|
||||
|
||||
///
|
||||
// Continue immediately.
|
||||
///
|
||||
RV_CONTINUE,
|
||||
|
||||
///
|
||||
// Continue asynchronously (usually via a callback).
|
||||
///
|
||||
RV_CONTINUE_ASYNC,
|
||||
}
|
||||
|
||||
|
||||
|
||||
///
|
||||
// Request context initialization settings. Specify NULL or 0 to get the
|
||||
// recommended default values.
|
||||
///
|
||||
pub struct _cef_request_context_settings {
|
||||
///
|
||||
// Size of this structure.
|
||||
///
|
||||
pub size: size_t,
|
||||
|
||||
///
|
||||
// The location where cache data will be stored on disk. If empty then
|
||||
// browsers will be created in "incognito mode" where in-memory caches are
|
||||
// used for storage and no data is persisted to disk. HTML5 databases such as
|
||||
// localStorage will only persist across sessions if a cache path is
|
||||
// specified. To share the global browser cache and related configuration set
|
||||
// this value to match the CefSettings.cache_path value.
|
||||
///
|
||||
pub cache_path: cef_string_t,
|
||||
|
||||
///
|
||||
// To persist session cookies (cookies without an expiry date or validity
|
||||
// interval) by default when using the global cookie manager set this value to
|
||||
// true. Session cookies are generally intended to be transient and most Web
|
||||
// browsers do not persist them. Can be set globally using the
|
||||
// CefSettings.persist_session_cookies value. This value will be ignored if
|
||||
// |cache_path| is empty or if it matches the CefSettings.cache_path value.
|
||||
///
|
||||
pub persist_session_cookies: i32,
|
||||
|
||||
///
|
||||
// Set to true (1) to ignore errors related to invalid SSL certificates.
|
||||
// Enabling this setting can lead to potential security vulnerabilities like
|
||||
// "man in the middle" attacks. Applications that load content from the
|
||||
// internet should not enable this setting. Can be set globally using the
|
||||
// CefSettings.ignore_certificate_errors value. This value will be ignored if
|
||||
// |cache_path| matches the CefSettings.cache_path value.
|
||||
///
|
||||
pub ignore_certificate_errors: i32,
|
||||
|
||||
///
|
||||
// Comma delimited ordered list of language codes without any whitespace that
|
||||
// will be used in the "Accept-Language" HTTP header. Can be set globally
|
||||
// using the CefSettings.accept_language_list value or overridden on a per-
|
||||
// browser basis using the CefBrowserSettings.accept_language_list value. If
|
||||
// all values are empty then "en-US,en" will be used. This value will be
|
||||
// ignored if |cache_path| matches the CefSettings.cache_path value.
|
||||
///
|
||||
pub accept_language_list: cef_string_t,
|
||||
}
|
||||
|
||||
pub type cef_request_context_settings_t = _cef_request_context_settings;
|
||||
pub type CefRequestContextSettings = cef_request_context_settings_t;
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
* 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 interfaces::{cef_request_t, cef_urlrequest_client_t, cef_urlrequest_t};
|
||||
use interfaces::{cef_request_t, cef_request_context_t, cef_urlrequest_client_t, cef_urlrequest_t};
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn cef_urlrequest_create(_request: *mut cef_request_t,
|
||||
_client: *mut cef_urlrequest_client_t)
|
||||
_client: *mut cef_urlrequest_client_t,
|
||||
_context: *mut cef_request_context_t)
|
||||
-> *mut cef_urlrequest_t {
|
||||
0 as *mut cef_urlrequest_t
|
||||
}
|
||||
|
|
|
@ -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 interfaces::{cef_binary_value_t, cef_dictionary_value_t, cef_list_value_t};
|
||||
use interfaces::{cef_binary_value_t, cef_dictionary_value_t, cef_list_value_t, cef_value_t};
|
||||
|
||||
use libc;
|
||||
|
||||
|
@ -10,5 +10,6 @@ cef_stub_static_method_impls! {
|
|||
fn cef_binary_value_create(_data: *const (), _size: libc::size_t) -> *mut cef_binary_value_t
|
||||
fn cef_dictionary_value_create() -> *mut cef_dictionary_value_t
|
||||
fn cef_list_value_create() -> *mut cef_list_value_t
|
||||
fn cef_value_create() -> *mut cef_value_t
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use eutil::Downcast;
|
|||
use interfaces::CefBrowser;
|
||||
use render_handler::CefRenderHandlerExtensions;
|
||||
use rustc_unicode::str::Utf16Encoder;
|
||||
use types::{cef_cursor_handle_t, cef_rect_t};
|
||||
use types::{cef_cursor_handle_t, cef_cursor_type_t, cef_rect_t};
|
||||
|
||||
use compositing::compositor_task::{self, CompositorProxy, CompositorReceiver};
|
||||
use compositing::windowing::{WindowEvent, WindowMethods};
|
||||
|
@ -87,6 +87,33 @@ impl Window {
|
|||
WindowEvent::Idle
|
||||
}
|
||||
|
||||
fn cursor_type_for_cursor(&self, cursor: Cursor) -> cef_cursor_type_t {
|
||||
match cursor {
|
||||
Cursor::NoCursor => return cef_cursor_type_t::CT_NONE,
|
||||
Cursor::ContextMenuCursor => return cef_cursor_type_t::CT_CONTEXTMENU,
|
||||
Cursor::GrabbingCursor => return cef_cursor_type_t::CT_GRABBING,
|
||||
Cursor::CrosshairCursor => return cef_cursor_type_t::CT_CROSS,
|
||||
Cursor::CopyCursor => return cef_cursor_type_t::CT_COPY,
|
||||
Cursor::AliasCursor => return cef_cursor_type_t::CT_ALIAS,
|
||||
Cursor::TextCursor => return cef_cursor_type_t::CT_IBEAM,
|
||||
Cursor::GrabCursor | Cursor::AllScrollCursor =>
|
||||
return cef_cursor_type_t::CT_GRAB,
|
||||
Cursor::NoDropCursor => return cef_cursor_type_t::CT_NODROP,
|
||||
Cursor::NotAllowedCursor => return cef_cursor_type_t::CT_NOTALLOWED,
|
||||
Cursor::PointerCursor => return cef_cursor_type_t::CT_POINTER,
|
||||
Cursor::SResizeCursor => return cef_cursor_type_t::CT_SOUTHRESIZE,
|
||||
Cursor::WResizeCursor => return cef_cursor_type_t::CT_WESTRESIZE,
|
||||
Cursor::EwResizeCursor => return cef_cursor_type_t::CT_EASTWESTRESIZE,
|
||||
Cursor::ColResizeCursor => return cef_cursor_type_t::CT_COLUMNRESIZE,
|
||||
Cursor::EResizeCursor => return cef_cursor_type_t::CT_EASTRESIZE,
|
||||
Cursor::NResizeCursor => return cef_cursor_type_t::CT_NORTHRESIZE,
|
||||
Cursor::NsResizeCursor => return cef_cursor_type_t::CT_NORTHSOUTHRESIZE,
|
||||
Cursor::RowResizeCursor => return cef_cursor_type_t::CT_ROWRESIZE,
|
||||
Cursor::VerticalTextCursor => return cef_cursor_type_t::CT_VERTICALTEXT,
|
||||
_ => return cef_cursor_type_t::CT_POINTER,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the Cocoa cursor for a CSS cursor. These match Firefox, except where Firefox
|
||||
/// bundles custom resources (which we don't yet do).
|
||||
#[cfg(target_os="macos")]
|
||||
|
@ -307,15 +334,18 @@ impl WindowMethods for Window {
|
|||
}
|
||||
|
||||
fn set_cursor(&self, cursor: Cursor) {
|
||||
use types::{CefCursorInfo,cef_point_t,cef_size_t};
|
||||
let browser = self.cef_browser.borrow();
|
||||
match *browser {
|
||||
None => {}
|
||||
Some(ref browser) => {
|
||||
let cursor_handle = self.cursor_handle_for_cursor(cursor);
|
||||
let info = CefCursorInfo { hotspot: cef_point_t {x: 0, y: 0}, image_scale_factor: 0.0, buffer: 0 as *mut isize, size: cef_size_t { width: 0, height: 0 } };
|
||||
browser.get_host()
|
||||
.get_client()
|
||||
.get_render_handler()
|
||||
.on_cursor_change(browser.clone(), cursor_handle)
|
||||
.on_cursor_change(browser.clone(), cursor_handle,
|
||||
self.cursor_type_for_cursor(cursor), &info)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче