github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/capi/cef_urlrequest_capi.h (about)

     1  // Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
     2  //
     3  // Redistribution and use in source and binary forms, with or without
     4  // modification, are permitted provided that the following conditions are
     5  // met:
     6  //
     7  //    * Redistributions of source code must retain the above copyright
     8  // notice, this list of conditions and the following disclaimer.
     9  //    * Redistributions in binary form must reproduce the above
    10  // copyright notice, this list of conditions and the following disclaimer
    11  // in the documentation and/or other materials provided with the
    12  // distribution.
    13  //    * Neither the name of Google Inc. nor the name Chromium Embedded
    14  // Framework nor the names of its contributors may be used to endorse
    15  // or promote products derived from this software without specific prior
    16  // written permission.
    17  //
    18  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    19  // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    20  // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    21  // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    22  // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    23  // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    24  // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    25  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    26  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    27  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    28  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    29  //
    30  // ---------------------------------------------------------------------------
    31  //
    32  // This file was generated by the CEF translator tool and should not edited
    33  // by hand. See the translator.README.txt file in the tools directory for
    34  // more information.
    35  //
    36  
    37  #ifndef CEF_INCLUDE_CAPI_CEF_URLREQUEST_CAPI_H_
    38  #define CEF_INCLUDE_CAPI_CEF_URLREQUEST_CAPI_H_
    39  #pragma once
    40  
    41  #ifdef __cplusplus
    42  extern "C" {
    43  #endif
    44  
    45  #include "include/capi/cef_auth_callback_capi.h"
    46  #include "include/capi/cef_base_capi.h"
    47  #include "include/capi/cef_request_capi.h"
    48  #include "include/capi/cef_response_capi.h"
    49  
    50  struct _cef_urlrequest_client_t;
    51  
    52  ///
    53  // Structure used to make a URL request. URL requests are not associated with a
    54  // browser instance so no cef_client_t callbacks will be executed. URL requests
    55  // can be created on any valid CEF thread in either the browser or render
    56  // process. Once created the functions of the URL request object must be
    57  // accessed on the same thread that created it.
    58  ///
    59  typedef struct _cef_urlrequest_t {
    60    ///
    61    // Base structure.
    62    ///
    63    cef_base_t base;
    64  
    65    ///
    66    // Returns the request object used to create this URL request. The returned
    67    // object is read-only and should not be modified.
    68    ///
    69    struct _cef_request_t* (CEF_CALLBACK *get_request)(
    70        struct _cef_urlrequest_t* self);
    71  
    72    ///
    73    // Returns the client.
    74    ///
    75    struct _cef_urlrequest_client_t* (CEF_CALLBACK *get_client)(
    76        struct _cef_urlrequest_t* self);
    77  
    78    ///
    79    // Returns the request status.
    80    ///
    81    cef_urlrequest_status_t (CEF_CALLBACK *get_request_status)(
    82        struct _cef_urlrequest_t* self);
    83  
    84    ///
    85    // Returns the request error if status is UR_CANCELED or UR_FAILED, or 0
    86    // otherwise.
    87    ///
    88    cef_errorcode_t (CEF_CALLBACK *get_request_error)(
    89        struct _cef_urlrequest_t* self);
    90  
    91    ///
    92    // Returns the response, or NULL if no response information is available.
    93    // Response information will only be available after the upload has completed.
    94    // The returned object is read-only and should not be modified.
    95    ///
    96    struct _cef_response_t* (CEF_CALLBACK *get_response)(
    97        struct _cef_urlrequest_t* self);
    98  
    99    ///
   100    // Cancel the request.
   101    ///
   102    void (CEF_CALLBACK *cancel)(struct _cef_urlrequest_t* self);
   103  } cef_urlrequest_t;
   104  
   105  
   106  ///
   107  // Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request
   108  // functions are supported. Multiple post data elements are not supported and
   109  // elements of type PDE_TYPE_FILE are only supported for requests originating
   110  // from the browser process. Requests originating from the render process will
   111  // receive the same handling as requests originating from Web content -- if the
   112  // response contains Content-Disposition or Mime-Type header values that would
   113  // not normally be rendered then the response may receive special handling
   114  // inside the browser (for example, via the file download code path instead of
   115  // the URL request code path). The |request| object will be marked as read-only
   116  // after calling this function.
   117  ///
   118  CEF_EXPORT cef_urlrequest_t* cef_urlrequest_create(
   119      struct _cef_request_t* request, struct _cef_urlrequest_client_t* client);
   120  
   121  
   122  ///
   123  // Structure that should be implemented by the cef_urlrequest_t client. The
   124  // functions of this structure will be called on the same thread that created
   125  // the request unless otherwise documented.
   126  ///
   127  typedef struct _cef_urlrequest_client_t {
   128    ///
   129    // Base structure.
   130    ///
   131    cef_base_t base;
   132  
   133    ///
   134    // Notifies the client that the request has completed. Use the
   135    // cef_urlrequest_t::GetRequestStatus function to determine if the request was
   136    // successful or not.
   137    ///
   138    void (CEF_CALLBACK *on_request_complete)(
   139        struct _cef_urlrequest_client_t* self,
   140        struct _cef_urlrequest_t* request);
   141  
   142    ///
   143    // Notifies the client of upload progress. |current| denotes the number of
   144    // bytes sent so far and |total| is the total size of uploading data (or -1 if
   145    // chunked upload is enabled). This function will only be called if the
   146    // UR_FLAG_REPORT_UPLOAD_PROGRESS flag is set on the request.
   147    ///
   148    void (CEF_CALLBACK *on_upload_progress)(struct _cef_urlrequest_client_t* self,
   149        struct _cef_urlrequest_t* request, uint64 current, uint64 total);
   150  
   151    ///
   152    // Notifies the client of download progress. |current| denotes the number of
   153    // bytes received up to the call and |total| is the expected total size of the
   154    // response (or -1 if not determined).
   155    ///
   156    void (CEF_CALLBACK *on_download_progress)(
   157        struct _cef_urlrequest_client_t* self, struct _cef_urlrequest_t* request,
   158        uint64 current, uint64 total);
   159  
   160    ///
   161    // Called when some part of the response is read. |data| contains the current
   162    // bytes received since the last call. This function will not be called if the
   163    // UR_FLAG_NO_DOWNLOAD_DATA flag is set on the request.
   164    ///
   165    void (CEF_CALLBACK *on_download_data)(struct _cef_urlrequest_client_t* self,
   166        struct _cef_urlrequest_t* request, const void* data,
   167        size_t data_length);
   168  
   169    ///
   170    // Called on the IO thread when the browser needs credentials from the user.
   171    // |isProxy| indicates whether the host is a proxy server. |host| contains the
   172    // hostname and |port| contains the port number. Return true (1) to continue
   173    // the request and call cef_auth_callback_t::cont() when the authentication
   174    // information is available. Return false (0) to cancel the request. This
   175    // function will only be called for requests initiated from the browser
   176    // process.
   177    ///
   178    int (CEF_CALLBACK *get_auth_credentials)(
   179        struct _cef_urlrequest_client_t* self, int isProxy,
   180        const cef_string_t* host, int port, const cef_string_t* realm,
   181        const cef_string_t* scheme, struct _cef_auth_callback_t* callback);
   182  } cef_urlrequest_client_t;
   183  
   184  
   185  #ifdef __cplusplus
   186  }
   187  #endif
   188  
   189  #endif  // CEF_INCLUDE_CAPI_CEF_URLREQUEST_CAPI_H_