github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/capi/cef_resource_handler_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_RESOURCE_HANDLER_CAPI_H_
    38  #define CEF_INCLUDE_CAPI_CEF_RESOURCE_HANDLER_CAPI_H_
    39  #pragma once
    40  
    41  #ifdef __cplusplus
    42  extern "C" {
    43  #endif
    44  
    45  #include "include/capi/cef_base_capi.h"
    46  #include "include/capi/cef_browser_capi.h"
    47  #include "include/capi/cef_callback_capi.h"
    48  #include "include/capi/cef_cookie_capi.h"
    49  #include "include/capi/cef_request_capi.h"
    50  #include "include/capi/cef_response_capi.h"
    51  
    52  
    53  ///
    54  // Structure used to implement a custom request handler structure. The functions
    55  // of this structure will always be called on the IO thread.
    56  ///
    57  typedef struct _cef_resource_handler_t {
    58    ///
    59    // Base structure.
    60    ///
    61    cef_base_t base;
    62  
    63    ///
    64    // Begin processing the request. To handle the request return true (1) and
    65    // call cef_callback_t::cont() once the response header information is
    66    // available (cef_callback_t::cont() can also be called from inside this
    67    // function if header information is available immediately). To cancel the
    68    // request return false (0).
    69    ///
    70    int (CEF_CALLBACK *process_request)(struct _cef_resource_handler_t* self,
    71        struct _cef_request_t* request, struct _cef_callback_t* callback);
    72  
    73    ///
    74    // Retrieve response header information. If the response length is not known
    75    // set |response_length| to -1 and read_response() will be called until it
    76    // returns false (0). If the response length is known set |response_length| to
    77    // a positive value and read_response() will be called until it returns false
    78    // (0) or the specified number of bytes have been read. Use the |response|
    79    // object to set the mime type, http status code and other optional header
    80    // values. To redirect the request to a new URL set |redirectUrl| to the new
    81    // URL.
    82    ///
    83    void (CEF_CALLBACK *get_response_headers)(
    84        struct _cef_resource_handler_t* self, struct _cef_response_t* response,
    85        int64* response_length, cef_string_t* redirectUrl);
    86  
    87    ///
    88    // Read response data. If data is available immediately copy up to
    89    // |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of
    90    // bytes copied, and return true (1). To read the data at a later time set
    91    // |bytes_read| to 0, return true (1) and call cef_callback_t::cont() when the
    92    // data is available. To indicate response completion return false (0).
    93    ///
    94    int (CEF_CALLBACK *read_response)(struct _cef_resource_handler_t* self,
    95        void* data_out, int bytes_to_read, int* bytes_read,
    96        struct _cef_callback_t* callback);
    97  
    98    ///
    99    // Return true (1) if the specified cookie can be sent with the request or
   100    // false (0) otherwise. If false (0) is returned for any cookie then no
   101    // cookies will be sent with the request.
   102    ///
   103    int (CEF_CALLBACK *can_get_cookie)(struct _cef_resource_handler_t* self,
   104        const struct _cef_cookie_t* cookie);
   105  
   106    ///
   107    // Return true (1) if the specified cookie returned with the response can be
   108    // set or false (0) otherwise.
   109    ///
   110    int (CEF_CALLBACK *can_set_cookie)(struct _cef_resource_handler_t* self,
   111        const struct _cef_cookie_t* cookie);
   112  
   113    ///
   114    // Request processing has been canceled.
   115    ///
   116    void (CEF_CALLBACK *cancel)(struct _cef_resource_handler_t* self);
   117  } cef_resource_handler_t;
   118  
   119  
   120  #ifdef __cplusplus
   121  }
   122  #endif
   123  
   124  #endif  // CEF_INCLUDE_CAPI_CEF_RESOURCE_HANDLER_CAPI_H_