internal static CfxUrlRequest Wrap(IntPtr nativePtr) { if (nativePtr == IntPtr.Zero) { return(null); } lock (weakCache) { var wrapper = (CfxUrlRequest)weakCache.Get(nativePtr); if (wrapper == null) { wrapper = new CfxUrlRequest(nativePtr); weakCache.Add(wrapper); } else { CfxApi.cfx_release(nativePtr); } return(wrapper); } }
/// <summary> /// Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request /// functions are supported. Multiple post data elements are not supported and /// elements of type PDE_TYPE_FILE are only supported for requests originating /// from the browser process. Requests originating from the render process will /// receive the same handling as requests originating from Web content -- 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. In the browser process if |requestContext| is /// NULL the global request context will be used. In the render process /// |requestContext| must be NULL and the context associated with the current /// renderer process' browser will be used. /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_urlrequest_capi.h">cef/include/capi/cef_urlrequest_capi.h</see>. /// </remarks> public static CfxUrlRequest Create(CfxRequest request, CfxUrlRequestClient client, CfxRequestContext requestContext) { return(CfxUrlRequest.Wrap(CfxApi.UrlRequest.cfx_urlrequest_create(CfxRequest.Unwrap(request), CfxUrlRequestClient.Unwrap(client), CfxRequestContext.Unwrap(requestContext)))); }
/// <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 CfxResourceRequestHandler or CfxSchemeHandlerFactory. /// Use CfxUrlRequest.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> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_frame_capi.h">cef/include/capi/cef_frame_capi.h</see>. /// </remarks> public CfxUrlRequest CreateUrlRequest(CfxRequest request, CfxUrlRequestClient client) { return(CfxUrlRequest.Wrap(CfxApi.Frame.cfx_frame_create_urlrequest(NativePtr, CfxRequest.Unwrap(request), CfxUrlRequestClient.Unwrap(client)))); }