예제 #1
0
 /// <summary>
 /// Called when |server| receives a WebSocket request. |connection_id| uniquely
 /// identifies the connection, |client_address| is the requesting IPv4 or IPv6
 /// client address including port number, and |request| contains the request
 /// contents (URL, function, headers and optional POST data). Execute
 /// |callback| either synchronously or asynchronously to accept or decline the
 /// WebSocket connection. If the request is accepted then OnWebSocketConnected
 /// will be called after the WebSocket has connected and incoming messages will
 /// be delivered to the OnWebSocketMessage callback. If the request is declined
 /// then the client will be disconnected and OnClientDisconnected will be
 /// called. Call the cef_server_t::SendWebSocketMessage function after
 /// receiving the OnWebSocketConnected callback to respond with WebSocket
 /// messages.
 /// </summary>
 protected internal unsafe virtual void OnWebSocketRequest(CefServer server, int connectionId, string clientAddress, CefRequest request, CefCallback callback)
 {
 }
예제 #2
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));
        }
예제 #3
0
 /// <summary>
 /// Creates a new URL request that is not associated with a specific browser or
 /// frame.<para/>
 /// For requests originating from the browser process:
 /// <list type="bullet">
 /// <item>
 /// <description>
 /// It may be intercepted by the client via CefResourceRequestHandler or
 /// CefSchemeHandlerFactory;
 /// </description>
 /// </item>
 /// <item>
 /// <description>
 /// POST data may only contain only a single element of type
 /// <see cref="CefPostDataElementType.File"/> or <see cref="CefPostDataElementType.Bytes"/>.
 /// </description>
 /// </item>
 /// </list>
 /// For requests originating from the render process:
 /// <list type="bullet">
 /// <item>
 /// <description>
 /// It cannot be intercepted by the client so only http(s) and blob schemes
 /// are supported.
 /// </description>
 /// </item>
 /// <item>
 /// <description>
 /// POST data may only contain a single element of type <see cref="CefPostDataElementType.Bytes"/>.
 /// </description>
 /// </item>
 /// </list>
 /// </summary>
 /// <remarks>
 /// Use <see cref="CefFrame.CreateUrlRequest"/> instead if you want the request to
 /// have this association, in which case it may be handled differently (see
 /// documentation on that function). Requests may originate from the both browser
 /// process and the render process.
 /// </remarks>
 /// <param name="request">
 /// The <see cref="CefRequest"/> object. It will be marked as read-only after calling
 /// this function.
 /// </param>
 /// <param name="client">
 /// The <see cref="CefUrlRequestClient"/> object to handle the resulting response.
 /// </param>
 /// <param name="context">
 /// A request context or null, if <paramref name="context"/> is empty the global
 /// request context will be used. For requests originating from the render process
 /// this parameter must be null.
 /// </param>
 public CefUrlRequest(CefRequest request, CefUrlRequestClient client, CefRequestContext context)
     : this(CefNativeApi.cef_urlrequest_create(
                (request ?? throw new ArgumentNullException(nameof(request))).GetNativeInstance(),
예제 #4
0
 /// <summary>
 /// Called when |server| receives an HTTP request. |connection_id| uniquely
 /// identifies the connection, |client_address| is the requesting IPv4 or IPv6
 /// client address including port number, and |request| contains the request
 /// contents (URL, function, headers and optional POST data). Call cef_server_t
 /// functions either synchronously or asynchronusly to send a response.
 /// </summary>
 protected internal unsafe virtual void OnHttpRequest(CefServer server, int connectionId, string clientAddress, CefRequest request)
 {
 }
예제 #5
0
 /// <summary>
 /// Called on the UI thread before browser navigation. Return true (1) to
 /// cancel the navigation or false (0) to allow the navigation to proceed. The
 /// |request| object cannot be modified in this callback.
 /// cef_load_handler_t::OnLoadingStateChange will be called twice in all cases.
 /// If the navigation is allowed cef_load_handler_t::OnLoadStart and
 /// cef_load_handler_t::OnLoadEnd will be called. If the navigation is canceled
 /// cef_load_handler_t::OnLoadError will be called with an |errorCode| value of
 /// ERR_ABORTED. The |user_gesture| value will be true (1) if the browser
 /// navigated via explicit user gesture (e.g. clicking a link) or false (0) if
 /// it navigated automatically (e.g. via the DomContentLoaded event).
 /// </summary>
 protected internal unsafe virtual bool OnBeforeBrowse(CefBrowser browser, CefFrame frame, CefRequest request, bool userGesture, bool isRedirect)
 {
     return(default);
예제 #6
0
 /// <summary>
 /// Return a new resource handler instance to handle the request or an NULL
 /// reference to allow default handling of the request. |browser| and |frame|
 /// will be the browser window and frame respectively that originated the
 /// request or NULL if the request did not originate from a browser window (for
 /// example, if the request came from cef_urlrequest_t). The |request| object
 /// passed to this function cannot be modified.
 /// </summary>
 protected internal unsafe virtual CefResourceHandler Create(CefBrowser browser, CefFrame frame, string schemeName, CefRequest request)
 {
     return(default);
예제 #7
0
 /// <summary>
 /// Load the request represented by the |request| object.
 /// WARNING: This function will fail with &quot;bad IPC message&quot; reason
 /// INVALID_INITIATOR_ORIGIN (213) unless you first navigate to the request
 /// origin using some other mechanism (LoadURL, link click, etc).
 /// </summary>
 public unsafe virtual void LoadRequest(CefRequest request)
 {
     NativeInstance->LoadRequest((request != null) ? request.GetNativeInstance() : null);
     GC.KeepAlive(this);
 }
예제 #8
0
 /// <summary>
 /// Create a new URL request that will be treated as originating from this
 /// frame and the associated browser. This request may be intercepted by the
 /// client via cef_resource_request_handler_t or cef_scheme_handler_factory_t.
 /// Use cef_urlrequest_t::Create instead if you do not want the request to have
 /// this association, in which case it may be handled differently (see
 /// documentation on that function). Requests may originate from both the
 /// browser process and the render process.
 /// For requests originating from the browser process:
 /// - POST data may only contain a single element of type PDE_TYPE_FILE or
 /// PDE_TYPE_BYTES.
 /// For requests originating from the render process:
 /// - POST data may only contain a single element of type PDE_TYPE_BYTES.
 /// - If the response contains Content-Disposition or Mime-Type header values
 /// that would not normally be rendered then the response may receive
 /// special handling inside the browser (for example, via the file download
 /// code path instead of the URL request code path).
 /// The |request| object will be marked as read-only after calling this
 /// function.
 /// </summary>
 public unsafe virtual CefUrlRequest CreateUrlRequest(CefRequest request, CefUrlRequestClient client)
 {
     return(SafeCall(CefUrlRequest.Wrap(CefUrlRequest.Create, NativeInstance->CreateUrlRequest((request != null) ? request.GetNativeInstance() : null, (client != null) ? client.GetNativeInstance() : null))));
 }
예제 #9
0
 /// <summary>
 /// Called on the IO thread before a resource request is sent. The |browser|
 /// and |frame| values represent the source of the request, and may be NULL for
 /// requests originating from service workers or cef_urlrequest_t. |request|
 /// cannot be modified in this callback. Return true (1) if the specified
 /// cookie can be sent with the request or false (0) otherwise.
 /// </summary>
 protected internal unsafe virtual bool CanSendCookie(CefBrowser browser, CefFrame frame, CefRequest request, CefCookie cookie)
 {
     return(default);
예제 #10
0
 /// <summary>
 /// Open the response stream. To handle the request immediately set
 /// |handle_request| to true (1) and return true (1). To decide at a later time
 /// set |handle_request| to false (0), return true (1), and execute |callback|
 /// to continue or cancel the request. To cancel the request immediately set
 /// |handle_request| to true (1) and return false (0). This function will be
 /// called in sequence but not from a dedicated thread. For backwards
 /// compatibility set |handle_request| to false (0) and return false (0) and
 /// the ProcessRequest function will be called.
 /// </summary>
 protected internal unsafe virtual bool Open(CefRequest request, ref int handleRequest, CefCallback callback)
 {
     return(default);
예제 #11
0
 /// <summary>
 /// Open the response stream. To handle the request immediately set
 /// |handle_request| to true (1) and return true (1). To decide at a later time
 /// set |handle_request| to false (0), return true (1), and execute |callback|
 /// to continue or cancel the request. To cancel the request immediately set
 /// |handle_request| to true (1) and return false (0). This function will be
 /// called in sequence but not from a dedicated thread. For backwards
 /// compatibility set |handle_request| to false (0) and return false (0) and
 /// the ProcessRequest function will be called.
 /// </summary>
 public unsafe virtual bool Open(CefRequest request, ref int handleRequest, CefCallback callback)
 {
     return(default);
예제 #12
0
 /// <summary>
 /// Called on the IO thread before a resource request is sent. The |browser|
 /// and |frame| values represent the source of the request, and may be NULL for
 /// requests originating from service workers or cef_urlrequest_t. |request|
 /// cannot be modified in this callback. Return true (1) if the specified
 /// cookie can be sent with the request or false (0) otherwise.
 /// </summary>
 public unsafe virtual bool CanSendCookie(CefBrowser browser, CefFrame frame, CefRequest request, CefCookie cookie)
 {
     return(default);
예제 #13
0
 /// <summary>
 /// Called on the IO thread before a resource request is loaded. The |browser|
 /// and |frame| values represent the source of the request, and may be NULL for
 /// requests originating from service workers or cef_urlrequest_t. To
 /// optionally filter cookies for the request return a
 /// cef_cookie_access_filter_t object. The |request| object cannot not be
 /// modified in this callback.
 /// </summary>
 public unsafe virtual CefCookieAccessFilter GetCookieAccessFilter(CefBrowser browser, CefFrame frame, CefRequest request)
 {
     return(default);