ports/cef: Use the CEF translator tool to generate the full set of CEF

bindings.

This replaces hand-implemented CEF bindings with proper Rust wrappers
automatically generated from the C++ headers. This means that, whenever
CEF's C++ headers change, we can easily generate both the appropriate C
API and the appropriate Rust API. It eliminates much of the hand-written
unsafe code within the CEF port, because the CEF translator tool now
knows how to generate Rust smart pointer wrappers for each class that
corrently perform reference counting.

Additionally, this commit adds utility macros (located in `macros.rs`)
that make it easier to correctly expose Rust objects as CEF objects.
They handle the marshaling of objects between Rust and CEF properly.
The net result of this is that you can write mostly-natural-looking Rust
in the CEF port and interact with it with a natural-looking C++ API on
the embedding side.

This setup relies on the branch of CEF located here:

    https://github.com/pcwalton/chromium-embedded-framework

To regenerate, follow the instructions in `ports/cef/README.md`. For
convenience, and because I don't anticipate the API to change much, I
have vendored in all of the appropriate interfaces.
This commit is contained in:
Patrick Walton 2014-11-24 17:23:30 -08:00
parent 431644bfc8
commit 3bf779cd21
82 changed files with 30917 additions and 1664 deletions

148
ports/cef/interfaces/mod.rs Normal file
View file

@ -0,0 +1,148 @@
/* 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/. */
//! This file is currently *not* autogenerated, but maybe it should be. (It's a little complicated
//! because we need to reexport a bunch of types in `types.rs`.)
pub use interfaces::cef_app::{CefApp, cef_app_t};
pub use interfaces::cef_auth_callback::{CefAuthCallback, cef_auth_callback_t};
pub use interfaces::cef_browser::{CefBrowser, CefBrowserHost, CefRunFileDialogCallback};
pub use interfaces::cef_browser::{cef_browser_host_t, cef_browser_t};
pub use interfaces::cef_browser::{cef_run_file_dialog_callback_t};
pub use interfaces::cef_browser_process_handler::{CefBrowserProcessHandler};
pub use interfaces::cef_browser_process_handler::{cef_browser_process_handler_t};
pub use interfaces::cef_callback::{CefCallback, CefCompletionCallback, cef_callback_t};
pub use interfaces::cef_callback::{cef_completion_callback_t};
pub use interfaces::cef_client::{CefClient, cef_client_t};
pub use interfaces::cef_command_line::{CefCommandLine, cef_command_line_t};
pub use interfaces::cef_context_menu_handler::{CefContextMenuHandler, CefContextMenuParams};
pub use interfaces::cef_context_menu_handler::{cef_context_menu_handler_t};
pub use interfaces::cef_context_menu_handler::{cef_context_menu_params_t};
pub use interfaces::cef_cookie::{CefCookieManager, CefCookieVisitor, cef_cookie_manager_t};
pub use interfaces::cef_cookie::{cef_cookie_visitor_t};
pub use interfaces::cef_dialog_handler::{CefDialogHandler, CefFileDialogCallback};
pub use interfaces::cef_dialog_handler::{cef_dialog_handler_t, cef_file_dialog_callback_t};
pub use interfaces::cef_display_handler::{CefDisplayHandler, cef_display_handler_t};
pub use interfaces::cef_dom::{CefDOMDocument, CefDOMNode, CefDOMVisitor, cef_domdocument_t};
pub use interfaces::cef_dom::{cef_domnode_t, cef_domvisitor_t};
pub use interfaces::cef_download_handler::{CefBeforeDownloadCallback, CefDownloadHandler};
pub use interfaces::cef_download_handler::{CefDownloadItemCallback};
pub use interfaces::cef_download_handler::{cef_before_download_callback_t};
pub use interfaces::cef_download_handler::{cef_download_handler_t, cef_download_item_callback_t};
pub use interfaces::cef_download_item::{CefDownloadItem, cef_download_item_t};
pub use interfaces::cef_drag_data::{CefDragData, cef_drag_data_t};
pub use interfaces::cef_drag_handler::{CefDragHandler, cef_drag_handler_t};
pub use interfaces::cef_focus_handler::{CefFocusHandler, cef_focus_handler_t};
pub use interfaces::cef_frame::{CefFrame, cef_frame_t};
pub use interfaces::cef_geolocation::{CefGetGeolocationCallback, cef_get_geolocation_callback_t};
pub use interfaces::cef_geolocation_handler::{CefGeolocationCallback, CefGeolocationHandler};
pub use interfaces::cef_geolocation_handler::{cef_geolocation_callback_t};
pub use interfaces::cef_geolocation_handler::{cef_geolocation_handler_t};
pub use interfaces::cef_jsdialog_handler::{CefJSDialogCallback, CefJSDialogHandler};
pub use interfaces::cef_jsdialog_handler::{cef_jsdialog_callback_t, cef_jsdialog_handler_t};
pub use interfaces::cef_keyboard_handler::{CefKeyboardHandler, cef_keyboard_handler_t};
pub use interfaces::cef_life_span_handler::{CefLifeSpanHandler, cef_life_span_handler_t};
pub use interfaces::cef_load_handler::{CefLoadHandler, cef_load_handler_t};
pub use interfaces::cef_menu_model::{CefMenuModel, cef_menu_model_t};
pub use interfaces::cef_print_handler::{CefPrintDialogCallback, CefPrintHandler};
pub use interfaces::cef_print_handler::{CefPrintJobCallback, cef_print_dialog_callback_t};
pub use interfaces::cef_print_handler::{cef_print_handler_t, cef_print_job_callback_t};
pub use interfaces::cef_print_settings::{CefPrintSettings, cef_print_settings_t};
pub use interfaces::cef_process_message::{CefProcessMessage, cef_process_message_t};
pub use interfaces::cef_render_handler::{CefRenderHandler, cef_render_handler_t};
pub use interfaces::cef_render_process_handler::{CefRenderProcessHandler};
pub use interfaces::cef_render_process_handler::{cef_render_process_handler_t};
pub use interfaces::cef_request::{CefPostData, CefPostDataElement, CefRequest};
pub use interfaces::cef_request::{cef_post_data_element_t, cef_post_data_t, cef_request_t};
pub use interfaces::cef_request_context::{CefRequestContext, cef_request_context_t};
pub use interfaces::cef_request_context_handler::{CefRequestContextHandler};
pub use interfaces::cef_request_context_handler::{cef_request_context_handler_t};
pub use interfaces::cef_request_handler::{CefAllowCertificateErrorCallback, CefQuotaCallback};
pub use interfaces::cef_request_handler::{CefRequestHandler};
pub use interfaces::cef_request_handler::{cef_allow_certificate_error_callback_t};
pub use interfaces::cef_request_handler::{cef_quota_callback_t, cef_request_handler_t};
pub use interfaces::cef_resource_bundle_handler::{CefResourceBundleHandler};
pub use interfaces::cef_resource_bundle_handler::{cef_resource_bundle_handler_t};
pub use interfaces::cef_resource_handler::{CefResourceHandler, cef_resource_handler_t};
pub use interfaces::cef_response::{CefResponse, cef_response_t};
pub use interfaces::cef_scheme::{CefSchemeHandlerFactory, CefSchemeRegistrar};
pub use interfaces::cef_scheme::{cef_scheme_handler_factory_t, cef_scheme_registrar_t};
pub use interfaces::cef_stream::{CefReadHandler, CefStreamReader, CefStreamWriter};
pub use interfaces::cef_stream::{CefWriteHandler, cef_read_handler_t, cef_stream_reader_t};
pub use interfaces::cef_stream::{cef_stream_writer_t, cef_write_handler_t};
pub use interfaces::cef_string_visitor::{CefStringVisitor, cef_string_visitor_t};
pub use interfaces::cef_task::{CefTask, CefTaskRunner, cef_task_runner_t, cef_task_t};
pub use interfaces::cef_trace::{CefEndTracingCallback, cef_end_tracing_callback_t};
pub use interfaces::cef_urlrequest::{CefURLRequest, CefURLRequestClient, cef_urlrequest_client_t};
pub use interfaces::cef_urlrequest::{cef_urlrequest_t};
pub use interfaces::cef_v8::{CefV8Accessor, CefV8Context, CefV8Exception, CefV8Handler};
pub use interfaces::cef_v8::{CefV8StackFrame, CefV8StackTrace, CefV8Value, cef_v8accessor_t};
pub use interfaces::cef_v8::{cef_v8context_t, cef_v8exception_t, cef_v8handler_t};
pub use interfaces::cef_v8::{cef_v8stack_frame_t, cef_v8stack_trace_t, cef_v8value_t};
pub use interfaces::cef_values::{CefBinaryValue, CefDictionaryValue, CefListValue};
pub use interfaces::cef_values::{cef_binary_value_t, cef_dictionary_value_t, cef_list_value_t};
pub use interfaces::cef_web_plugin::{CefWebPluginInfo, CefWebPluginInfoVisitor};
pub use interfaces::cef_web_plugin::{CefWebPluginUnstableCallback, cef_web_plugin_info_t};
pub use interfaces::cef_web_plugin::{cef_web_plugin_info_visitor_t};
pub use interfaces::cef_web_plugin::{cef_web_plugin_unstable_callback_t};
pub use interfaces::cef_xml_reader::{CefXmlReader, cef_xml_reader_t};
pub use interfaces::cef_zip_reader::{CefZipReader, cef_zip_reader_t};
pub use types::{CefBase, CefBrowserSettings, CefCookie, CefGeoposition, CefKeyEvent};
pub use types::{CefMouseEvent, CefPopupFeatures, CefProcessId, CefScreenInfo};
pub use types::{CefValueType, CefWindowInfo, cef_base_t};
pub use types::{cef_browser_settings_t, cef_cookie_t, cef_geoposition_t, cef_key_event_t};
pub use types::{cef_mouse_event_t, cef_point_t, cef_popup_features_t};
pub use types::{cef_process_id_t, cef_screen_info_t, cef_string_map_t};
pub use types::{cef_time_t, cef_value_type_t, cef_window_info_t};
pub mod cef_app;
pub mod cef_auth_callback;
pub mod cef_browser;
pub mod cef_browser_process_handler;
pub mod cef_callback;
pub mod cef_client;
pub mod cef_command_line;
pub mod cef_context_menu_handler;
pub mod cef_cookie;
pub mod cef_dialog_handler;
pub mod cef_display_handler;
pub mod cef_dom;
pub mod cef_download_handler;
pub mod cef_download_item;
pub mod cef_drag_data;
pub mod cef_drag_handler;
pub mod cef_focus_handler;
pub mod cef_frame;
pub mod cef_geolocation;
pub mod cef_geolocation_handler;
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_print_handler;
pub mod cef_print_settings;
pub mod cef_process_message;
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_handler;
pub mod cef_resource_bundle_handler;
pub mod cef_resource_handler;
pub mod cef_response;
pub mod cef_scheme;
pub mod cef_stream;
pub mod cef_string_visitor;
pub mod cef_task;
pub mod cef_trace;
pub mod cef_urlrequest;
pub mod cef_v8;
pub mod cef_values;
pub mod cef_web_plugin;
pub mod cef_xml_reader;
pub mod cef_zip_reader;