123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- namespace Xilium.CefGlue
- {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Runtime.InteropServices;
- using Xilium.CefGlue.Interop;
- public abstract unsafe partial class CefClient
- {
- private cef_audio_handler_t* get_audio_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetAudioHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for audio rendering events.
- /// </summary>
- protected virtual CefAudioHandler GetAudioHandler()
- {
- return null;
- }
- private cef_context_menu_handler_t* get_context_menu_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetContextMenuHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for context menus. If no handler is provided the default
- /// implementation will be used.
- /// </summary>
- protected virtual CefContextMenuHandler GetContextMenuHandler()
- {
- return null;
- }
- private cef_dialog_handler_t* get_dialog_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetDialogHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for dialogs. If no handler is provided the default
- /// implementation will be used.
- /// </summary>
- protected virtual CefDialogHandler GetDialogHandler()
- {
- return null;
- }
- private cef_display_handler_t* get_display_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetDisplayHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for browser display state events.
- /// </summary>
- protected virtual CefDisplayHandler GetDisplayHandler()
- {
- return null;
- }
- private cef_download_handler_t* get_download_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetDownloadHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for download events. If no handler is returned downloads
- /// will not be allowed.
- /// </summary>
- protected virtual CefDownloadHandler GetDownloadHandler()
- {
- return null;
- }
- private cef_drag_handler_t* get_drag_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetDragHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for drag events.
- /// </summary>
- protected virtual CefDragHandler GetDragHandler()
- {
- return null;
- }
- private cef_find_handler_t* get_find_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetFindHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for find result events.
- /// </summary>
- protected virtual CefFindHandler GetFindHandler()
- {
- return null;
- }
- private cef_focus_handler_t* get_focus_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetFocusHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for focus events.
- /// </summary>
- protected virtual CefFocusHandler GetFocusHandler()
- {
- return null;
- }
- private cef_jsdialog_handler_t* get_jsdialog_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetJSDialogHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for JavaScript dialogs. If no handler is provided the
- /// default implementation will be used.
- /// </summary>
- protected virtual CefJSDialogHandler GetJSDialogHandler()
- {
- return null;
- }
- private cef_keyboard_handler_t* get_keyboard_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetKeyboardHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for keyboard events.
- /// </summary>
- protected virtual CefKeyboardHandler GetKeyboardHandler()
- {
- return null;
- }
- private cef_life_span_handler_t* get_life_span_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetLifeSpanHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for browser life span events.
- /// </summary>
- protected virtual CefLifeSpanHandler GetLifeSpanHandler()
- {
- return null;
- }
- private cef_load_handler_t* get_load_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetLoadHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for browser load status events.
- /// </summary>
- protected virtual CefLoadHandler GetLoadHandler()
- {
- return null;
- }
- private cef_print_handler_t* get_print_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetPrintHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for printing on Linux. If a print handler is not
- /// provided then printing will not be supported on the Linux platform.
- /// </summary>
- protected virtual CefPrintHandler GetPrintHandler()
- {
- return null;
- }
- private cef_render_handler_t* get_render_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetRenderHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for off-screen rendering events.
- /// </summary>
- protected virtual CefRenderHandler GetRenderHandler()
- {
- return null;
- }
- private cef_request_handler_t* get_request_handler(cef_client_t* self)
- {
- CheckSelf(self);
- var result = GetRequestHandler();
- return result != null ? result.ToNative() : null;
- }
- /// <summary>
- /// Return the handler for browser request events.
- /// </summary>
- protected virtual CefRequestHandler GetRequestHandler()
- {
- return null;
- }
- private int on_process_message_received(cef_client_t* self, cef_browser_t* browser, cef_frame_t* frame, CefProcessId source_process, cef_process_message_t* message)
- {
- CheckSelf(self);
- var m_browser = CefBrowser.FromNative(browser);
- var m_frame = CefFrame.FromNative(frame);
- using (var m_message = CefProcessMessage.FromNative(message))
- {
- var result = OnProcessMessageReceived(m_browser, m_frame, source_process, m_message);
- return result ? 1 : 0;
- }
- }
- /// <summary>
- /// Called when a new message is received from a different process. Return true
- /// if the message was handled or false otherwise. Do not keep a reference to
- /// or attempt to access the message outside of this callback.
- /// </summary>
- protected virtual bool OnProcessMessageReceived(CefBrowser browser, CefFrame frame, CefProcessId sourceProcess, CefProcessMessage message)
- {
- return false;
- }
- }
- }
|