github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/capi/cef_request_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_REQUEST_HANDLER_CAPI_H_
    38  #define CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_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_browser_capi.h"
    48  #include "include/capi/cef_frame_capi.h"
    49  #include "include/capi/cef_request_capi.h"
    50  #include "include/capi/cef_resource_handler_capi.h"
    51  #include "include/capi/cef_response_capi.h"
    52  #include "include/capi/cef_web_plugin_capi.h"
    53  
    54  
    55  ///
    56  // Callback structure used for asynchronous continuation of quota requests.
    57  ///
    58  typedef struct _cef_quota_callback_t {
    59    ///
    60    // Base structure.
    61    ///
    62    cef_base_t base;
    63  
    64    ///
    65    // Continue the quota request. If |allow| is true (1) the request will be
    66    // allowed. Otherwise, the request will be denied.
    67    ///
    68    void (CEF_CALLBACK *cont)(struct _cef_quota_callback_t* self, int allow);
    69  
    70    ///
    71    // Cancel the quota request.
    72    ///
    73    void (CEF_CALLBACK *cancel)(struct _cef_quota_callback_t* self);
    74  } cef_quota_callback_t;
    75  
    76  
    77  ///
    78  // Callback structure used for asynchronous continuation of url requests when
    79  // invalid SSL certificates are encountered.
    80  ///
    81  typedef struct _cef_allow_certificate_error_callback_t {
    82    ///
    83    // Base structure.
    84    ///
    85    cef_base_t base;
    86  
    87    ///
    88    // Continue the url request. If |allow| is true (1) the request will be
    89    // continued. Otherwise, the request will be canceled.
    90    ///
    91    void (CEF_CALLBACK *cont)(
    92        struct _cef_allow_certificate_error_callback_t* self, int allow);
    93  } cef_allow_certificate_error_callback_t;
    94  
    95  
    96  ///
    97  // Implement this structure to handle events related to browser requests. The
    98  // functions of this structure will be called on the thread indicated.
    99  ///
   100  typedef struct _cef_request_handler_t {
   101    ///
   102    // Base structure.
   103    ///
   104    cef_base_t base;
   105  
   106    ///
   107    // Called on the UI thread before browser navigation. Return true (1) to
   108    // cancel the navigation or false (0) to allow the navigation to proceed. The
   109    // |request| object cannot be modified in this callback.
   110    // cef_load_handler_t::OnLoadingStateChange will be called twice in all cases.
   111    // If the navigation is allowed cef_load_handler_t::OnLoadStart and
   112    // cef_load_handler_t::OnLoadEnd will be called. If the navigation is canceled
   113    // cef_load_handler_t::OnLoadError will be called with an |errorCode| value of
   114    // ERR_ABORTED.
   115    ///
   116    int (CEF_CALLBACK *on_before_browse)(struct _cef_request_handler_t* self,
   117        struct _cef_browser_t* browser, struct _cef_frame_t* frame,
   118        struct _cef_request_t* request, int is_redirect);
   119  
   120    ///
   121    // Called on the IO thread before a resource request is loaded. The |request|
   122    // object may be modified. To cancel the request return true (1) otherwise
   123    // return false (0).
   124    ///
   125    int (CEF_CALLBACK *on_before_resource_load)(
   126        struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
   127        struct _cef_frame_t* frame, struct _cef_request_t* request);
   128  
   129    ///
   130    // Called on the IO thread before a resource is loaded. To allow the resource
   131    // to load normally return NULL. To specify a handler for the resource return
   132    // a cef_resource_handler_t object. The |request| object should not be
   133    // modified in this callback.
   134    ///
   135    struct _cef_resource_handler_t* (CEF_CALLBACK *get_resource_handler)(
   136        struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
   137        struct _cef_frame_t* frame, struct _cef_request_t* request);
   138  
   139    ///
   140    // Called on the IO thread when a resource load is redirected. The |old_url|
   141    // parameter will contain the old URL. The |new_url| parameter will contain
   142    // the new URL and can be changed if desired.
   143    ///
   144    void (CEF_CALLBACK *on_resource_redirect)(struct _cef_request_handler_t* self,
   145        struct _cef_browser_t* browser, struct _cef_frame_t* frame,
   146        const cef_string_t* old_url, cef_string_t* new_url);
   147  
   148    ///
   149    // Called on the IO thread when the browser needs credentials from the user.
   150    // |isProxy| indicates whether the host is a proxy server. |host| contains the
   151    // hostname and |port| contains the port number. Return true (1) to continue
   152    // the request and call cef_auth_callback_t::cont() when the authentication
   153    // information is available. Return false (0) to cancel the request.
   154    ///
   155    int (CEF_CALLBACK *get_auth_credentials)(struct _cef_request_handler_t* self,
   156        struct _cef_browser_t* browser, struct _cef_frame_t* frame, int isProxy,
   157        const cef_string_t* host, int port, const cef_string_t* realm,
   158        const cef_string_t* scheme, struct _cef_auth_callback_t* callback);
   159  
   160    ///
   161    // Called on the IO thread when JavaScript requests a specific storage quota
   162    // size via the webkitStorageInfo.requestQuota function. |origin_url| is the
   163    // origin of the page making the request. |new_size| is the requested quota
   164    // size in bytes. Return true (1) and call cef_quota_callback_t::cont() either
   165    // in this function or at a later time to grant or deny the request. Return
   166    // false (0) to cancel the request.
   167    ///
   168    int (CEF_CALLBACK *on_quota_request)(struct _cef_request_handler_t* self,
   169        struct _cef_browser_t* browser, const cef_string_t* origin_url,
   170        int64 new_size, struct _cef_quota_callback_t* callback);
   171  
   172    ///
   173    // Called on the UI thread to handle requests for URLs with an unknown
   174    // protocol component. Set |allow_os_execution| to true (1) to attempt
   175    // execution via the registered OS protocol handler, if any. SECURITY WARNING:
   176    // YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR
   177    // OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
   178    ///
   179    void (CEF_CALLBACK *on_protocol_execution)(
   180        struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
   181        const cef_string_t* url, int* allow_os_execution);
   182  
   183    ///
   184    // Called on the UI thread to handle requests for URLs with an invalid SSL
   185    // certificate. Return true (1) and call
   186    // cef_allow_certificate_error_callback_t:: cont() either in this function or
   187    // at a later time to continue or cancel the request. Return false (0) to
   188    // cancel the request immediately. If |callback| is NULL the error cannot be
   189    // recovered from and the request will be canceled automatically. If
   190    // CefSettings.ignore_certificate_errors is set all invalid certificates will
   191    // be accepted without calling this function.
   192    ///
   193    int (CEF_CALLBACK *on_certificate_error)(struct _cef_request_handler_t* self,
   194        cef_errorcode_t cert_error, const cef_string_t* request_url,
   195        struct _cef_allow_certificate_error_callback_t* callback);
   196  
   197    ///
   198    // Called on the browser process IO thread before a plugin is loaded. Return
   199    // true (1) to block loading of the plugin.
   200    ///
   201    int (CEF_CALLBACK *on_before_plugin_load)(struct _cef_request_handler_t* self,
   202        struct _cef_browser_t* browser, const cef_string_t* url,
   203        const cef_string_t* policy_url, struct _cef_web_plugin_info_t* info);
   204  
   205    ///
   206    // Called on the browser process UI thread when a plugin has crashed.
   207    // |plugin_path| is the path of the plugin that crashed.
   208    ///
   209    void (CEF_CALLBACK *on_plugin_crashed)(struct _cef_request_handler_t* self,
   210        struct _cef_browser_t* browser, const cef_string_t* plugin_path);
   211  
   212    ///
   213    // Called on the browser process UI thread when the render process terminates
   214    // unexpectedly. |status| indicates how the process terminated.
   215    ///
   216    void (CEF_CALLBACK *on_render_process_terminated)(
   217        struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
   218        cef_termination_status_t status);
   219  } cef_request_handler_t;
   220  
   221  
   222  #ifdef __cplusplus
   223  }
   224  #endif
   225  
   226  #endif  // CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_