forked from cztomczak/cef2go
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcefApp.c
91 lines (82 loc) · 3.59 KB
/
cefApp.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// Copyright (c) 2014 The cefcapi authors. All rights reserved.
// License: BSD 3-clause.
// Website: https://github.com/CzarekTomczak/cefcapi
#include "cefBase.h"
#include "include/capi/cef_app_capi.h"
// ----------------------------------------------------------------------------
// cef_app_t
// ----------------------------------------------------------------------------
///
// Implement this structure to provide handler implementations. Methods will be
// called by the process and/or thread indicated.
///
///
// Provides an opportunity to view and/or modify command-line arguments before
// processing by CEF and Chromium. The |process_type| value will be NULL for
// the browser process. Do not keep a reference to the cef_command_line_t
// object passed to this function. The CefSettings.command_line_args_disabled
// value can be used to start with an NULL command-line object. Any values
// specified in CefSettings that equate to command-line arguments will be set
// before this function is called. Be cautious when using this function to
// modify command-line arguments for non-browser processes as this may result
// in undefined behavior including crashes.
///
void CEF_CALLBACK on_before_command_line_processing(
struct _cef_app_t* self, const cef_string_t* process_type,
struct _cef_command_line_t* command_line) {
releaseVoid((void *) command_line);
goDebugLog("on_before_command_line_processing\n");
}
///
// Provides an opportunity to register custom schemes. Do not keep a reference
// to the |registrar| object. This function is called on the main thread for
// each process and the registered schemes should be the same across all
// processes.
///
void CEF_CALLBACK on_register_custom_schemes(
struct _cef_app_t* self,
struct _cef_scheme_registrar_t* registrar) {
releaseVoid((void *) registrar);
goDebugLog("on_register_custom_schemes\n");
}
///
// Return the handler for resource bundle events. If
// CefSettings.pack_loading_disabled is true (1) a handler must be returned.
// If no handler is returned resources will be loaded from pack files. This
// function is called by the browser and render processes on multiple threads.
///
struct _cef_resource_bundle_handler_t*
CEF_CALLBACK get_resource_bundle_handler(struct _cef_app_t* self) {
goDebugLog("get_resource_bundle_handler\n");
return NULL;
}
///
// Return the handler for functionality specific to the browser process. This
// function is called on multiple threads in the browser process.
///
struct _cef_browser_process_handler_t*
CEF_CALLBACK get_browser_process_handler(struct _cef_app_t* self) {
goDebugLog("get_browser_process_handler\n");
return go_GetBrowserProcessHandler(self);
}
///
// Return the handler for functionality specific to the render process. This
// function is called on the render process main thread.
///
struct _cef_render_process_handler_t*
CEF_CALLBACK get_render_process_handler(struct _cef_app_t* self) {
goDebugLog("get_render_process_handler\n");
return NULL;
}
void initialize_app_handler(cef_app_t* app) {
goDebugLog("initialize_app_handler\n");
app->base.size = sizeof(cef_app_t);
initialize_cef_base((cef_base_t*) app, "app_handler");
go_AddRef((cef_base_t*) app);
// callbacks
app->on_before_command_line_processing = on_before_command_line_processing;
app->on_register_custom_schemes = on_register_custom_schemes;
app->get_resource_bundle_handler = get_resource_bundle_handler;
app->get_browser_process_handler = get_browser_process_handler;
app->get_render_process_handler = get_render_process_handler;
}