Beispiel #1
0
 public unsafe int Open(cef_request_t *request, int *handle_request, cef_callback_t *callback)
 {
     fixed(cef_resource_handler_t *self = &this)
     {
         return(((delegate * unmanaged[Stdcall] < cef_resource_handler_t *, cef_request_t *, int *, cef_callback_t *, int >)open)(self, request, handle_request, callback));
     }
 }
Beispiel #2
0
 public unsafe int ProcessRequest(cef_request_t *request, cef_callback_t *callback)
 {
     fixed(cef_resource_handler_t *self = &this)
     {
         return(((delegate * unmanaged[Stdcall] < cef_resource_handler_t *, cef_request_t *, cef_callback_t *, int >)process_request)(self, request, callback));
     }
 }
 internal static CefCallback FromNativeOrNull(cef_callback_t *ptr)
 {
     if (ptr == null)
     {
         return(null);
     }
     return(new CefCallback(ptr));
 }
 private CefCallback(cef_callback_t *ptr)
 {
     if (ptr == null)
     {
         throw new ArgumentNullException("ptr");
     }
     _self = ptr;
 }
Beispiel #5
0
 public void Dispose()
 {
     if (_self != null)
     {
         Release();
         _self = null;
     }
     GC.SuppressFinalize(this);
 }
 public void Dispose()
 {
     if (_self != null)
     {
         Release();
         _self = null;
     }
     GC.SuppressFinalize(this);
 }
Beispiel #7
0
        public static void cancel(cef_callback_t *self)
        {
            cancel_delegate d;
            var             p = self->_cancel;

            if (p == _p4)
            {
                d = _d4;
            }
            else
            {
                d = (cancel_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(cancel_delegate));
                if (_p4 == IntPtr.Zero)
                {
                    _d4 = d; _p4 = p;
                }
            }
            d(self);
        }
Beispiel #8
0
        public static int release(cef_callback_t *self)
        {
            release_delegate d;
            var p = self->_base._release;

            if (p == _p1)
            {
                d = _d1;
            }
            else
            {
                d = (release_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(release_delegate));
                if (_p1 == IntPtr.Zero)
                {
                    _d1 = d; _p1 = p;
                }
            }
            return(d(self));
        }
Beispiel #9
0
        public static void add_ref(cef_callback_t *self)
        {
            add_ref_delegate d;
            var p = self->_base._add_ref;

            if (p == _p0)
            {
                d = _d0;
            }
            else
            {
                d = (add_ref_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(add_ref_delegate));
                if (_p0 == IntPtr.Zero)
                {
                    _d0 = d; _p0 = p;
                }
            }
            d(self);
        }
Beispiel #10
0
        public static void cont(cef_callback_t *self)
        {
            cont_delegate d;
            var           p = self->_cont;

            if (p == _p3)
            {
                d = _d3;
            }
            else
            {
                d = (cont_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(cont_delegate));
                if (_p3 == IntPtr.Zero)
                {
                    _d3 = d; _p3 = p;
                }
            }
            d(self);
        }
Beispiel #11
0
        public static int has_one_ref(cef_callback_t *self)
        {
            has_one_ref_delegate d;
            var p = self->_base._has_one_ref;

            if (p == _p2)
            {
                d = _d2;
            }
            else
            {
                d = (has_one_ref_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(has_one_ref_delegate));
                if (_p2 == IntPtr.Zero)
                {
                    _d2 = d; _p2 = p;
                }
            }
            return(d(self));
        }
 internal static CefCallback FromNative(cef_callback_t *ptr)
 {
     return(new CefCallback(ptr));
 }
Beispiel #13
0
        private static unsafe void OnWebSocketRequestImpl(cef_server_handler_t *self, cef_server_t *server, int connection_id, cef_string_t *client_address, cef_request_t *request, cef_callback_t *callback)
        {
            var instance = GetInstance((IntPtr)self) as CefServerHandler;

            if (instance == null || ((ICefServerHandlerPrivate)instance).AvoidOnWebSocketRequest())
            {
                ReleaseIfNonNull((cef_base_ref_counted_t *)server);
                ReleaseIfNonNull((cef_base_ref_counted_t *)request);
                ReleaseIfNonNull((cef_base_ref_counted_t *)callback);
                return;
            }
            instance.OnWebSocketRequest(CefServer.Wrap(CefServer.Create, server), connection_id, CefString.Read(client_address), CefRequest.Wrap(CefRequest.Create, request), CefCallback.Wrap(CefCallback.Create, callback));
        }
        private int read_response(cef_resource_handler_t *self, void *data_out, int bytes_to_read, int *bytes_read, cef_callback_t *callback)
        {
            CheckSelf(self);

            var m_callback = CefCallback.FromNative(callback);

            using (var m_stream = new UnmanagedMemoryStream((byte *)data_out, bytes_to_read, bytes_to_read, FileAccess.Write))
            {
                int m_bytesRead;
                var result     = ReadResponse(m_stream, bytes_to_read, out m_bytesRead, m_callback);
                *   bytes_read = m_bytesRead;
                return(result ? 1 : 0);
            }
        }
        private int process_request(cef_resource_handler_t *self, cef_request_t *request, cef_callback_t *callback)
        {
            CheckSelf(self);

            var m_request  = CefRequest.FromNative(request);
            var m_callback = CefCallback.FromNative(callback);

            var result = ProcessRequest(m_request, m_callback);

            return(result ? 1 : 0);
        }
Beispiel #16
0
 public CefCallback(cef_callback_t *instance)
     : base((cef_base_ref_counted_t *)instance)
 {
 }
        private int open(cef_resource_handler_t *self, cef_request_t *request, int *handle_request, cef_callback_t *callback)
        {
            CheckSelf(self);

            var m_request  = CefRequest.FromNative(request);
            var m_callback = CefCallback.FromNative(callback);

            var m_result = Open(m_request, out var m_handleRequest, m_callback);

            *handle_request = m_handleRequest ? 1 : 0;

            return(m_result ? 1 : 0);
        }
        private int read_response(cef_resource_handler_t *self, void *data_out, int bytes_to_read, int *bytes_read, cef_callback_t *callback)
        {
            CheckSelf(self);

            var m_callback = CefCallback.FromNative(callback);

            using (var m_stream = new UnmanagedMemoryStream((byte *)data_out, bytes_to_read, bytes_to_read, FileAccess.Write))
            {
                int m_bytesRead;
#pragma warning disable CS0618 // Type or member is obsolete
                var result = ReadResponse(m_stream, bytes_to_read, out m_bytesRead, m_callback);
#pragma warning restore CS0618 // Type or member is obsolete
                *bytes_read = m_bytesRead;
                return(result ? 1 : 0);
            }
        }
        private void on_web_socket_request(cef_server_handler_t *self, cef_server_t *server, int connection_id, cef_string_t *client_address, cef_request_t *request, cef_callback_t *callback)
        {
            CheckSelf(self);

            var mServer        = CefServer.FromNative(server);
            var mClientAddress = cef_string_t.ToString(client_address);
            var mRequest       = CefRequest.FromNative(request);
            var mCallback      = CefCallback.FromNative(callback);

            OnWebSocketRequest(mServer, connection_id, mClientAddress, mRequest, mCallback);
        }
Beispiel #20
0
 private CefCallback(cef_callback_t* ptr)
 {
     if (ptr == null) throw new ArgumentNullException("ptr");
     _self = ptr;
 }
        private int process_request(cef_resource_handler_t *self, cef_request_t *request, cef_callback_t *callback)
        {
            CheckSelf(self);

            var m_request  = CefRequest.FromNative(request);
            var m_callback = CefCallback.FromNative(callback);

            //////string url = m_request.Url;
            //////Debug.WriteLine(url);

            var result = ProcessRequest(m_request, m_callback);

            return(result ? 1 : 0);
        }
        /// <summary>
        /// Retrieve response header information. If the response length is not known
        /// set |response_length| to -1 and ReadResponse() will be called until it
        /// returns false. If the response length is known set |response_length|
        /// to a positive value and ReadResponse() will be called until it returns
        /// false or the specified number of bytes have been read. Use the |response|
        /// object to set the mime type, http status code and other optional header
        /// values. To redirect the request to a new URL set |redirectUrl| to the new
        /// URL.
        /// </summary>
        // protected abstract void GetResponseHeaders(cef_response_t* response, long* response_length, cef_string_t* redirectUrl);

        private int read_response(cef_resource_handler_t *self, void *data_out, int bytes_to_read, int *bytes_read, cef_callback_t *callback)
        {
            CheckSelf(self);
            throw new NotImplementedException(); // TODO: CefResourceHandler.ReadResponse
        }
 private int process_request(cef_resource_handler_t *self, cef_request_t *request, cef_callback_t *callback)
 {
     CheckSelf(self);
     throw new NotImplementedException(); // TODO: CefResourceHandler.ProcessRequest
 }
Beispiel #24
0
 public unsafe void OnWebSocketRequest(cef_server_t *server, int connection_id, [Immutable] cef_string_t *client_address, cef_request_t *request, cef_callback_t *callback)
 {
     fixed(cef_server_handler_t *self = &this)
     {
         ((delegate * unmanaged[Stdcall] < cef_server_handler_t *, cef_server_t *, int, cef_string_t *, cef_request_t *, cef_callback_t *, void >)on_web_socket_request)(self, server, connection_id, client_address, request, callback);
     }
 }
        private int process_request(cef_resource_handler_t *self, cef_request_t *request, cef_callback_t *callback)
        {
            CheckSelf(self);

            var m_request  = CefRequest.FromNative(request);
            var m_callback = CefCallback.FromNative(callback);

#pragma warning disable CS0618 // Type or member is obsolete
            var result = ProcessRequest(m_request, m_callback);
#pragma warning restore CS0618 // Type or member is obsolete
            return(result ? 1 : 0);
        }
 public unsafe extern int Open(cef_request_t *request, int *handle_request, cef_callback_t *callback);
 public unsafe extern int ProcessRequest(cef_request_t *request, cef_callback_t *callback);
Beispiel #28
0
 public unsafe extern void OnWebSocketRequest(cef_server_t *server, int connection_id, [Immutable] cef_string_t *client_address, cef_request_t *request, cef_callback_t *callback);
Beispiel #29
0
        private CefReturnValue on_before_resource_load(cef_resource_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, cef_callback_t *callback)
        {
            CheckSelf(self);

            var m_browser  = CefBrowser.FromNativeOrNull(browser);
            var m_frame    = CefFrame.FromNativeOrNull(frame);
            var m_request  = CefRequest.FromNative(request);
            var m_callback = CefCallback.FromNative(callback);

            var result = OnBeforeResourceLoad(m_browser, m_frame, m_request, m_callback);

            if (result != CefReturnValue.ContinueAsync)
            {
                m_browser.Dispose();
                m_frame.Dispose();
                m_request.Dispose();
                m_callback.Dispose();
            }

            return(result);
        }
Beispiel #30
0
 public unsafe int ReadResponse(void *data_out, int bytes_to_read, int *bytes_read, cef_callback_t *callback)
 {
     fixed(cef_resource_handler_t *self = &this)
     {
         return(((delegate * unmanaged[Stdcall] < cef_resource_handler_t *, void *, int, int *, cef_callback_t *, int >)read_response)(self, data_out, bytes_to_read, bytes_read, callback));
     }
 }
 public unsafe extern int ReadResponse(void *data_out, int bytes_to_read, int *bytes_read, cef_callback_t *callback);
        private int on_certificate_error(cef_request_handler_t *self, cef_browser_t *browser, CefErrorCode cert_error, cef_string_t *request_url, cef_sslinfo_t *ssl_info, cef_callback_t *callback)
        {
            CheckSelf(self);

            var m_browser     = CefBrowser.FromNative(browser);
            var m_request_url = cef_string_t.ToString(request_url);
            var m_ssl_info    = CefSslInfo.FromNative(ssl_info);
            var m_callback    = CefCallback.FromNativeOrNull(callback);

            var result = OnCertificateError(m_browser, cert_error, m_request_url, m_ssl_info, m_callback);

            return(result ? 1 : 0);
        }