1 /*
2 
3 Boost Software License - Version 1.0 - August 17th, 2003
4 
5 Permission is hereby granted, free of charge, to any person or organization
6 obtaining a copy of the software and accompanying documentation covered by
7 this license ( the "Software" ) to use, reproduce, display, distribute,
8 execute, and transmit the Software, and to prepare derivative works of the
9 Software, and to permit third-parties to whom the Software is furnished to
10 do so, all subject to the following:
11 
12 The copyright notices in the Software and this entire statement, including
13 the above license grant, this restriction and the following disclaimer,
14 must be included in all copies of the Software, in whole or in part, and
15 all derivative works of the Software, unless such copies or derivative
16 works are solely in the form of machine-executable object code generated by
17 a source language processor.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 DEALINGS IN THE SOFTWARE.
26 
27 */
28 module derelict.cef.cef;
29 
30 public {
31       import derelict.cef.functions,
32              derelict.cef.types;
33       import derelict.util.loader;
34 }
35 
36 private {
37       import derelict.util.exception,
38              derelict.util.system;
39 
40       static if( Derelict_OS_Windows )
41             enum libNames = "libcef.dll";
42       else static if( Derelict_OS_Mac )
43             enum libNames = "../Frameworks/Chromium Embedded Framework.framework, /Library/Frameworks/Chromium Embedded Framework.framework, /System/Library/Frameworks/Chromium Embedded Framework.framework";
44       else static if( Derelict_OS_Linux )
45             enum libNames = "libcef.so";
46       else
47             static assert( 0, "Need to implement Chromium Embedded Framework libNames for this operating system." );
48 }
49 
50 class DerelictCEFLoader : SharedLibLoader {
51       public this() {
52             super( libNames );
53       }
54 
55       protected override void loadSymbols() {
56             bindFunc( cast( void** )&cef_get_min_log_level, "cef_get_min_log_level" );
57             bindFunc( cast( void** )&cef_get_vlog_level, "cef_get_vlog_level" );
58             bindFunc( cast( void** )&cef_log, "cef_log" );
59             bindFunc( cast( void** )&cef_string_list_alloc, "cef_string_list_alloc" );
60             bindFunc( cast( void** )&cef_string_list_size, "cef_string_list_size" );
61             bindFunc( cast( void** )&cef_string_list_value, "cef_string_list_value" );
62             bindFunc( cast( void** )&cef_string_list_append, "cef_string_list_append" );
63             bindFunc( cast( void** )&cef_string_list_clear, "cef_string_list_clear" );
64             bindFunc( cast( void** )&cef_string_list_free, "cef_string_list_free" );
65             bindFunc( cast( void** )&cef_string_list_copy, "cef_string_list_copy" );
66             bindFunc( cast( void** )&cef_string_map_alloc, "cef_string_map_alloc" );
67             bindFunc( cast( void** )&cef_string_map_size, "cef_string_map_size" );
68             bindFunc( cast( void** )&cef_string_map_find, "cef_string_map_find" );
69             bindFunc( cast( void** )&cef_string_map_key, "cef_string_map_key" );
70             bindFunc( cast( void** )&cef_string_map_value, "cef_string_map_value" );
71             bindFunc( cast( void** )&cef_string_map_append, "cef_string_map_append" );
72             bindFunc( cast( void** )&cef_string_map_clear, "cef_string_map_clear" );
73             bindFunc( cast( void** )&cef_string_map_free, "cef_string_map_free" );
74             bindFunc( cast( void** )&cef_string_multimap_alloc, "cef_string_multimap_alloc" );
75             bindFunc( cast( void** )&cef_string_multimap_size, "cef_string_multimap_size" );
76             bindFunc( cast( void** )&cef_string_multimap_find_count, "cef_string_multimap_find_count" );
77             bindFunc( cast( void** )&cef_string_multimap_enumerate, "cef_string_multimap_enumerate" );
78             bindFunc( cast( void** )&cef_string_multimap_key, "cef_string_multimap_key" );
79             bindFunc( cast( void** )&cef_string_multimap_value, "cef_string_multimap_value" );
80             bindFunc( cast( void** )&cef_string_multimap_append, "cef_string_multimap_append" );
81             bindFunc( cast( void** )&cef_string_multimap_clear, "cef_string_multimap_clear" );
82             bindFunc( cast( void** )&cef_string_multimap_free, "cef_string_multimap_free" );
83             bindFunc( cast( void** )&cef_string_wide_set, "cef_string_wide_set" );
84             bindFunc( cast( void** )&cef_string_utf8_set, "cef_string_utf8_set" );
85             bindFunc( cast( void** )&cef_string_utf16_set, "cef_string_utf16_set" );
86             bindFunc( cast( void** )&cef_string_wide_clear, "cef_string_wide_clear" );
87             bindFunc( cast( void** )&cef_string_utf8_clear, "cef_string_utf8_clear" );
88             bindFunc( cast( void** )&cef_string_utf16_clear, "cef_string_utf16_clear" );
89             bindFunc( cast( void** )&cef_string_wide_cmp, "cef_string_wide_cmp" );
90             bindFunc( cast( void** )&cef_string_utf8_cmp, "cef_string_utf8_cmp" );
91             bindFunc( cast( void** )&cef_string_utf16_cmp, "cef_string_utf16_cmp" );
92             bindFunc( cast( void** )&cef_string_wide_to_utf8, "cef_string_wide_to_utf8" );
93             bindFunc( cast( void** )&cef_string_utf8_to_wide, "cef_string_utf8_to_wide" );
94             bindFunc( cast( void** )&cef_string_wide_to_utf16, "cef_string_wide_to_utf16" );
95             bindFunc( cast( void** )&cef_string_utf16_to_wide, "cef_string_utf16_to_wide" );
96             bindFunc( cast( void** )&cef_string_utf8_to_utf16, "cef_string_utf8_to_utf16" );
97             bindFunc( cast( void** )&cef_string_utf16_to_utf8, "cef_string_utf16_to_utf8" );
98             bindFunc( cast( void** )&cef_string_ascii_to_wide, "cef_string_ascii_to_wide" );
99             bindFunc( cast( void** )&cef_string_ascii_to_utf16, "cef_string_ascii_to_utf16" );
100             bindFunc( cast( void** )&cef_string_userfree_wide_alloc, "cef_string_userfree_wide_alloc" );
101             bindFunc( cast( void** )&cef_string_userfree_utf8_alloc, "cef_string_userfree_utf8_alloc" );
102             bindFunc( cast( void** )&cef_string_userfree_utf16_alloc, "cef_string_userfree_utf16_alloc" );
103             bindFunc( cast( void** )&cef_string_userfree_wide_free, "cef_string_userfree_wide_free" );
104             bindFunc( cast( void** )&cef_string_userfree_utf8_free, "cef_string_userfree_utf8_free" );
105             bindFunc( cast( void** )&cef_string_userfree_utf16_free, "cef_string_userfree_utf16_free" );
106             bindFunc( cast( void** )&cef_get_current_platform_thread_id, "cef_get_current_platform_thread_id" );
107             bindFunc( cast( void** )&cef_get_current_platform_thread_handle, "cef_get_current_platform_thread_handle" );
108             bindFunc( cast( void** )&cef_time_to_timet, "cef_time_to_timet" );
109             bindFunc( cast( void** )&cef_time_from_timet, "cef_time_from_timet" );
110             bindFunc( cast( void** )&cef_time_to_doublet, "cef_time_to_doublet" );
111             bindFunc( cast( void** )&cef_time_from_doublet, "cef_time_from_doublet" );
112             bindFunc( cast( void** )&cef_time_now, "cef_time_now" );
113             bindFunc( cast( void** )&cef_time_delta, "cef_time_delta" );
114             bindFunc( cast( void** )&cef_trace_event_instant, "cef_trace_event_instant" );
115             bindFunc( cast( void** )&cef_trace_event_begin, "cef_trace_event_begin" );
116             bindFunc( cast( void** )&cef_trace_event_end, "cef_trace_event_end" );
117             bindFunc( cast( void** )&cef_trace_counter, "cef_trace_counter" );
118             bindFunc( cast( void** )&cef_trace_counter_id, "cef_trace_counter_id" );
119             bindFunc( cast( void** )&cef_trace_event_async_begin, "cef_trace_event_async_begin" );
120             bindFunc( cast( void** )&cef_trace_event_async_step_into, "cef_trace_event_async_step_into" );
121             bindFunc( cast( void** )&cef_trace_event_async_step_past, "cef_trace_event_async_step_past" );
122             bindFunc( cast( void** )&cef_trace_event_async_end, "cef_trace_event_async_end" );
123             bindFunc( cast( void** )&cef_execute_process, "cef_execute_process" );
124             bindFunc( cast( void** )&cef_initialize, "cef_initialize" );
125             bindFunc( cast( void** )&cef_shutdown, "cef_shutdown" );
126             bindFunc( cast( void** )&cef_do_message_loop_work, "cef_do_message_loop_work" );
127             bindFunc( cast( void** )&cef_run_message_loop, "cef_run_message_loop" );
128             bindFunc( cast( void** )&cef_quit_message_loop, "cef_quit_message_loop" );
129             bindFunc( cast( void** )&cef_set_osmodal_loop, "cef_set_osmodal_loop" );
130             bindFunc( cast( void** )&cef_enable_highdpi_support, "cef_enable_highdpi_support" );
131             bindFunc( cast( void** )&cef_browser_host_create_browser, "cef_browser_host_create_browser" );
132             bindFunc( cast( void** )&cef_browser_host_create_browser_sync, "cef_browser_host_create_browser_sync" );
133             bindFunc( cast( void** )&cef_command_line_create, "cef_command_line_create" );
134             bindFunc( cast( void** )&cef_command_line_get_global, "cef_command_line_get_global" );
135             bindFunc( cast( void** )&cef_cookie_manager_get_global_manager, "cef_cookie_manager_get_global_manager" );
136             bindFunc( cast( void** )&cef_cookie_manager_create_manager, "cef_cookie_manager_create_manager" );
137             bindFunc( cast( void** )&cef_crash_reporting_enabled, "cef_crash_reporting_enabled" );
138             bindFunc( cast( void** )&cef_set_crash_key_value, "cef_set_crash_key_value" );
139             bindFunc( cast( void** )&cef_drag_data_create, "cef_drag_data_create" );
140             bindFunc( cast( void** )&cef_create_directory, "cef_create_directory" );
141             bindFunc( cast( void** )&cef_get_temp_directory, "cef_get_temp_directory" );
142             bindFunc( cast( void** )&cef_create_new_temp_directory, "cef_create_new_temp_directory" );
143             bindFunc( cast( void** )&cef_create_temp_directory_in_directory, "cef_create_temp_directory_in_directory" );
144             bindFunc( cast( void** )&cef_directory_exists, "cef_directory_exists" );
145             bindFunc( cast( void** )&cef_delete_file, "cef_delete_file" );
146             bindFunc( cast( void** )&cef_zip_directory, "cef_zip_directory" );
147             bindFunc( cast( void** )&cef_load_crlsets_file, "cef_load_crlsets_file" );
148             bindFunc( cast( void** )&cef_image_create, "cef_image_create" );
149             bindFunc( cast( void** )&cef_menu_model_create, "cef_menu_model_create" );
150             bindFunc( cast( void** )&cef_add_cross_origin_whitelist_entry, "cef_add_cross_origin_whitelist_entry" );
151             bindFunc( cast( void** )&cef_remove_cross_origin_whitelist_entry, "cef_remove_cross_origin_whitelist_entry" );
152             bindFunc( cast( void** )&cef_clear_cross_origin_whitelist, "cef_clear_cross_origin_whitelist" );
153             bindFunc( cast( void** )&cef_parse_url, "cef_parse_url" );
154             bindFunc( cast( void** )&cef_create_url, "cef_create_url" );
155             bindFunc( cast( void** )&cef_format_url_for_security_display, "cef_format_url_for_security_display" );
156             bindFunc( cast( void** )&cef_get_mime_type, "cef_get_mime_type" );
157             bindFunc( cast( void** )&cef_get_extensions_for_mime_type, "cef_get_extensions_for_mime_type" );
158             bindFunc( cast( void** )&cef_base64encode, "cef_base64encode" );
159             bindFunc( cast( void** )&cef_base64decode, "cef_base64decode" );
160             bindFunc( cast( void** )&cef_uriencode, "cef_uriencode" );
161             bindFunc( cast( void** )&cef_uridecode, "cef_uridecode" );
162             bindFunc( cast( void** )&cef_parse_json, "cef_parse_json" );
163             bindFunc( cast( void** )&cef_parse_jsonand_return_error, "cef_parse_jsonand_return_error" );
164             bindFunc( cast( void** )&cef_write_json, "cef_write_json" );
165             bindFunc( cast( void** )&cef_get_path, "cef_get_path" );
166             bindFunc( cast( void** )&cef_print_settings_create, "cef_print_settings_create" );
167             bindFunc( cast( void** )&cef_process_message_create, "cef_process_message_create" );
168             bindFunc( cast( void** )&cef_launch_process, "cef_launch_process" );
169             bindFunc( cast( void** )&cef_request_create, "cef_request_create" );
170             bindFunc( cast( void** )&cef_post_data_create, "cef_post_data_create" );
171             bindFunc( cast( void** )&cef_post_data_element_create, "cef_post_data_element_create" );
172             bindFunc( cast( void** )&cef_request_context_get_global_context, "cef_request_context_get_global_context" );
173             bindFunc( cast( void** )&cef_request_context_create_context, "cef_request_context_create_context" );
174             bindFunc( cast( void** )&cef_create_context_shared, "cef_create_context_shared" );
175             bindFunc( cast( void** )&cef_resource_bundle_get_global, "cef_resource_bundle_get_global" );
176             bindFunc( cast( void** )&cef_response_create, "cef_response_create" );
177             bindFunc( cast( void** )&cef_register_scheme_handler_factory, "cef_register_scheme_handler_factory" );
178             bindFunc( cast( void** )&cef_clear_scheme_handler_factories, "cef_clear_scheme_handler_factories" );
179             bindFunc( cast( void** )&cef_server_create, "cef_server_create" );
180             bindFunc( cast( void** )&cef_is_cert_status_error, "cef_is_cert_status_error" );
181             bindFunc( cast( void** )&cef_is_cert_status_minor_error, "cef_is_cert_status_minor_error" );
182             bindFunc( cast( void** )&cef_stream_reader_create_for_file, "cef_stream_reader_create_for_file" );
183             bindFunc( cast( void** )&cef_stream_reader_create_for_data, "cef_stream_reader_create_for_data" );
184             bindFunc( cast( void** )&cef_stream_reader_create_for_handler, "cef_stream_reader_create_for_handler" );
185             bindFunc( cast( void** )&cef_stream_writer_create_for_file, "cef_stream_writer_create_for_file" );
186             bindFunc( cast( void** )&cef_stream_writer_create_for_handler, "cef_stream_writer_create_for_handler" );
187             bindFunc( cast( void** )&cef_task_runner_get_for_current_thread, "cef_task_runner_get_for_current_thread" );
188             bindFunc( cast( void** )&cef_task_runner_get_for_thread, "cef_task_runner_get_for_thread" );
189             bindFunc( cast( void** )&cef_currently_on, "cef_currently_on" );
190             bindFunc( cast( void** )&cef_post_task, "cef_post_task" );
191             bindFunc( cast( void** )&cef_post_delayed_task, "cef_post_delayed_task" );
192             bindFunc( cast( void** )&cef_thread_create, "cef_thread_create" );
193             bindFunc( cast( void** )&cef_begin_tracing, "cef_begin_tracing" );
194             bindFunc( cast( void** )&cef_end_tracing, "cef_end_tracing" );
195             bindFunc( cast( void** )&cef_now_from_system_trace_time, "cef_now_from_system_trace_time" );
196             bindFunc( cast( void** )&cef_urlrequest_create, "cef_urlrequest_create" );
197             bindFunc( cast( void** )&cef_v8context_get_current_context, "cef_v8context_get_current_context" );
198             bindFunc( cast( void** )&cef_v8context_get_entered_context, "cef_v8context_get_entered_context" );
199             bindFunc( cast( void** )&cef_v8context_in_context, "cef_v8context_in_context" );
200             bindFunc( cast( void** )&cef_v8value_create_undefined, "cef_v8value_create_undefined" );
201             bindFunc( cast( void** )&cef_v8value_create_null, "cef_v8value_create_null" );
202             bindFunc( cast( void** )&cef_v8value_create_bool, "cef_v8value_create_bool" );
203             bindFunc( cast( void** )&cef_v8value_create_int, "cef_v8value_create_int" );
204             bindFunc( cast( void** )&cef_v8value_create_uint, "cef_v8value_create_uint" );
205             bindFunc( cast( void** )&cef_v8value_create_double, "cef_v8value_create_double" );
206             bindFunc( cast( void** )&cef_v8value_create_date, "cef_v8value_create_date" );
207             bindFunc( cast( void** )&cef_v8value_create_string, "cef_v8value_create_string" );
208             bindFunc( cast( void** )&cef_v8value_create_object, "cef_v8value_create_object" );
209             bindFunc( cast( void** )&cef_v8value_create_array, "cef_v8value_create_array" );
210             bindFunc( cast( void** )&cef_v8value_create_array_buffer, "cef_v8value_create_array_buffer" );
211             bindFunc( cast( void** )&cef_v8value_create_function, "cef_v8value_create_function" );
212             bindFunc( cast( void** )&cef_v8stack_trace_get_current, "cef_v8stack_trace_get_current" );
213             bindFunc( cast( void** )&cef_register_extension, "cef_register_extension" );
214             bindFunc( cast( void** )&cef_value_create, "cef_value_create" );
215             bindFunc( cast( void** )&cef_binary_value_create, "cef_binary_value_create" );
216             bindFunc( cast( void** )&cef_dictionary_value_create, "cef_dictionary_value_create" );
217             bindFunc( cast( void** )&cef_list_value_create, "cef_list_value_create" );
218             bindFunc( cast( void** )&cef_waitable_event_create, "cef_waitable_event_create" );
219             bindFunc( cast( void** )&cef_visit_web_plugin_info, "cef_visit_web_plugin_info" );
220             bindFunc( cast( void** )&cef_refresh_web_plugins, "cef_refresh_web_plugins" );
221             bindFunc( cast( void** )&cef_unregister_internal_web_plugin, "cef_unregister_internal_web_plugin" );
222             bindFunc( cast( void** )&cef_register_web_plugin_crash, "cef_register_web_plugin_crash" );
223             bindFunc( cast( void** )&cef_is_web_plugin_unstable, "cef_is_web_plugin_unstable" );
224             bindFunc( cast( void** )&cef_register_widevine_cdm, "cef_register_widevine_cdm" );
225             bindFunc( cast( void** )&cef_xml_reader_create, "cef_xml_reader_create" );
226             bindFunc( cast( void** )&cef_zip_reader_create, "cef_zip_reader_create" );
227             bindFunc( cast( void** )&cef_execute_java_script_with_user_gesture_for_tests, "cef_execute_java_script_with_user_gesture_for_tests" );
228             bindFunc( cast( void** )&cef_translator_test_create, "cef_translator_test_create" );
229             bindFunc( cast( void** )&cef_translator_test_ref_ptr_library_create, "cef_translator_test_ref_ptr_library_create" );
230             bindFunc( cast( void** )&cef_translator_test_ref_ptr_library_child_create, "cef_translator_test_ref_ptr_library_child_create" );
231             bindFunc( cast( void** )&cef_translator_test_ref_ptr_library_child_child_create, "cef_translator_test_ref_ptr_library_child_child_create" );
232             bindFunc( cast( void** )&cef_translator_test_scoped_library_create, "cef_translator_test_scoped_library_create" );
233             bindFunc( cast( void** )&cef_translator_test_scoped_library_child_create, "cef_translator_test_scoped_library_child_create" );
234             bindFunc( cast( void** )&cef_translator_test_scoped_library_child_child_create, "cef_translator_test_scoped_library_child_child_create" );
235             bindFunc( cast( void** )&cef_browser_view_create, "cef_browser_view_create" );
236             bindFunc( cast( void** )&cef_browser_view_get_for_browser, "cef_browser_view_get_for_browser" );
237             bindFunc( cast( void** )&cef_display_get_primary, "cef_display_get_primary" );
238             bindFunc( cast( void** )&cef_display_get_nearest_point, "cef_display_get_nearest_point" );
239             bindFunc( cast( void** )&cef_display_get_matching_bounds, "cef_display_get_matching_bounds" );
240             bindFunc( cast( void** )&cef_display_get_count, "cef_display_get_count" );
241             bindFunc( cast( void** )&cef_display_get_alls, "cef_display_get_alls" );
242             bindFunc( cast( void** )&cef_label_button_create, "cef_label_button_create" );
243             bindFunc( cast( void** )&cef_menu_button_create, "cef_menu_button_create" );
244             bindFunc( cast( void** )&cef_panel_create, "cef_panel_create" );
245             bindFunc( cast( void** )&cef_scroll_view_create, "cef_scroll_view_create" );
246             bindFunc( cast( void** )&cef_textfield_create, "cef_textfield_create" );
247             bindFunc( cast( void** )&cef_window_create_top_level, "cef_window_create_top_level" );
248       }
249 }
250 
251 __gshared DerelictCEFLoader DerelictCEF;
252 
253 shared static this() {
254     DerelictCEF = new DerelictCEFLoader();
255 }