예제 #1
0
        public DisplayHandler(BrowserDelegate @delegate)
            : base(typeof (CefDisplayHandler))
        {
            _delegate = @delegate;
            _tooltipCallback = OnTooltip;
            _titleChangeCallback = OnTitleChange;
            _statusMessageCallback = OnStatusMessage;
            _addressChangeCallback = OnAddressChange;
            _consoleMessageCallback = OnConsoleMessage;
            _loadingStateChangedCallback = OnLoadingStateChange;

            MarshalToNative(new CefDisplayHandler {
                Base = DedicatedBase,
                OnAddressChange =
                    Marshal.GetFunctionPointerForDelegate(_addressChangeCallback),
                OnConsoleMessage =
                    Marshal.GetFunctionPointerForDelegate(_consoleMessageCallback),
                OnLoadingStateChange =
                    Marshal.GetFunctionPointerForDelegate(
                        _loadingStateChangedCallback),
                OnTitleChange =
                    Marshal.GetFunctionPointerForDelegate(_titleChangeCallback),
                OnTooltip = Marshal.GetFunctionPointerForDelegate(_tooltipCallback),
                OnStatusMessage =
                    Marshal.GetFunctionPointerForDelegate(_statusMessageCallback)
            });
        }
예제 #2
0
 public GeolocationHandler(BrowserDelegate @delegate)
     : base(typeof (CefGeolocationHandler))
 {
     _delegate = @delegate;
     _cancelGeolocationPermission = OnCancelGeolocationRequest;
     _requestGeolocationPermission = OnRequestGeolocationPermission;
     MarshalToNative(new CefGeolocationHandler {
         Base = DedicatedBase,
         OnRequestGeolocationPermission =
             Marshal.GetFunctionPointerForDelegate(
                 _requestGeolocationPermission),
         OnCancelGeolocationPermission =
             Marshal.GetFunctionPointerForDelegate(
                 _cancelGeolocationPermission)
     });
 }
예제 #3
0
        public LifeSpanHandler(BrowserDelegate @delegate)
            : base(typeof (CefLifeSpanHandler))
        {
            _delegate = @delegate;
            _doCloseCallback = OnDoClose;
            _beforePopupCallback = OnBeforePopup;
            _beforeCloseCallback = OnBeforeClose;

            MarshalToNative(new CefLifeSpanHandler {
                Base = DedicatedBase,
                OnBeforePopup =
                    Marshal.GetFunctionPointerForDelegate(_beforePopupCallback),
                OnBeforeClose =
                    Marshal.GetFunctionPointerForDelegate(_beforeCloseCallback),
                DoClose = Marshal.GetFunctionPointerForDelegate(_doCloseCallback),
            });
        }
예제 #4
0
        public JavaScriptDialogHandler(BrowserDelegate browserDelegate)
            : base(typeof (CefJsdialogHandler))
        {
            _browserDelegate = browserDelegate;
            _jsDialogCallback = OnJsDialog;
            _resetDialogStateCallback = OnResetDialogState;
            _beforeUnloadDialogCallback = OnBeforeUnloadDialog;

            MarshalToNative(new CefJsdialogHandler {
                Base = DedicatedBase,
                OnJsdialog =
                    Marshal.GetFunctionPointerForDelegate(_jsDialogCallback),
                OnResetDialogState =
                    Marshal.GetFunctionPointerForDelegate(
                        _resetDialogStateCallback),
                OnBeforeUnloadDialog =
                    Marshal.GetFunctionPointerForDelegate(
                        _beforeUnloadDialogCallback)
            });
        }
예제 #5
0
        public ContextMenuHandler(BrowserDelegate browserDelegate)
            : base(typeof (CefContextMenuHandler))
        {
            _browserDelegate = browserDelegate;
            _contextMenuCommandCallback = OnContextMenuCommand;
            _beforeContextMenuCallback = OnBeforeContextMenu;
            _contextMenuDismissedCallback = OnContextMenuDismissed;

            MarshalToNative(new CefContextMenuHandler {
                Base = DedicatedBase,
                OnBeforeContextMenu =
                    Marshal.GetFunctionPointerForDelegate(
                        _beforeContextMenuCallback),
                OnContextMenuCommand =
                    Marshal.GetFunctionPointerForDelegate(
                        _contextMenuCommandCallback),
                OnContextMenuDismissed =
                    Marshal.GetFunctionPointerForDelegate(
                        _contextMenuDismissedCallback)
            });
        }
예제 #6
0
        public ClientHandler(BrowserDelegate browserDelegate)
            : base(typeof (CefClient))
        {
            _delegate = browserDelegate;
            _displayHandler = new DisplayHandler(browserDelegate);
            _getDisplayHandlerCallback = OnGetDisplayHandler;
            _lifeSpanHandler = new LifeSpanHandler(browserDelegate);
            _getLifeSpanHandlerCallback = OnGetLifeSpanHandler;
            _loadHandler = new LoadHandler(browserDelegate);
            _getLoadHandlerCallback = OnGetLoadHandler;
            _geolocationHandler = new GeolocationHandler(browserDelegate);
            _getGeolocationHandlerCallback = OnGetGeolocationHandler;
            _javaScriptDialogHandler = new JavaScriptDialogHandler(browserDelegate);
            _getJavaScriptdialogHandler = OnGetJavaScriptHandler;
            _contextMenuHandler = new ContextMenuHandler(browserDelegate);
            _getContextMenuHandler = OnGetContextMenuHandler;

            _processMessageReceivedCallback = OnProcessMessageReceived;

            MarshalToNative(new CefClient {
                Base = DedicatedBase,
                GetDisplayHandler =
                    Marshal.GetFunctionPointerForDelegate(_getDisplayHandlerCallback),
                GetLifeSpanHandler =
                    Marshal.GetFunctionPointerForDelegate(_getLifeSpanHandlerCallback),
                GetLoadHandler =
                    Marshal.GetFunctionPointerForDelegate(_getLoadHandlerCallback),
                GetGeolocationHandler =
                    Marshal.GetFunctionPointerForDelegate(_getGeolocationHandlerCallback),
                OnProcessMessageReceived =
                    Marshal.GetFunctionPointerForDelegate(_processMessageReceivedCallback),
                GetJsdialogHandler =
                    Marshal.GetFunctionPointerForDelegate(_getJavaScriptdialogHandler),
                GetContextMenuHandler =
                    Marshal.GetFunctionPointerForDelegate(_getContextMenuHandler)
            });
        }
예제 #7
0
파일: Viewport.cs 프로젝트: kaagati/spectre
        public Viewport(IRenderTarget target, BrowserDelegate browserDelegate)
        {
            _target = target;
            _target.TargetClosing += OnTargetClosing;
            _target.TargetClosed += OnTargetClosed;
            _target.TargetSizeChanged += OnTargetSizeChanged;

            _handler = new ClientHandler(browserDelegate);

            _settings = new BrowserSettings {
                IsFileAccessfromUrlsAllowed = false,
                IsWebSecurityDisabled = false,
                IsUniversalAccessFromFileUrlsAllowed = false,
                IsUserStyleSheetEnabled = false
            };

            if (Platform.IsLinux) {
                _resizer = new LinuxWindowResizer();
            }

            if (Platform.IsWindows) {
                _resizer = new WindowsWindowResizer();
            }
        }