github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/capi/cef_scheme_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_SCHEME_CAPI_H_
    38  #define CEF_INCLUDE_CAPI_CEF_SCHEME_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_frame_capi.h"
    48  #include "include/capi/cef_request_capi.h"
    49  #include "include/capi/cef_resource_handler_capi.h"
    50  #include "include/capi/cef_response_capi.h"
    51  
    52  struct _cef_scheme_handler_factory_t;
    53  
    54  ///
    55  // Structure that manages custom scheme registrations.
    56  ///
    57  typedef struct _cef_scheme_registrar_t {
    58    ///
    59    // Base structure.
    60    ///
    61    cef_base_t base;
    62  
    63    ///
    64    // Register a custom scheme. This function should not be called for the built-
    65    // in HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes.
    66    //
    67    // If |is_standard| is true (1) the scheme will be treated as a standard
    68    // scheme. Standard schemes are subject to URL canonicalization and parsing
    69    // rules as defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1
    70    // available at http://www.ietf.org/rfc/rfc1738.txt
    71    //
    72    // In particular, the syntax for standard scheme URLs must be of the form:
    73    // <pre>
    74    //  [scheme]://[username]:[password]@[host]:[port]/[url-path]
    75    // </pre> Standard scheme URLs must have a host component that is a fully
    76    // qualified domain name as defined in Section 3.5 of RFC 1034 [13] and
    77    // Section 2.1 of RFC 1123. These URLs will be canonicalized to
    78    // "scheme://host/path" in the simplest case and
    79    // "scheme://username:password@host:port/path" in the most explicit case. For
    80    // example, "scheme:host/path" and "scheme:///host/path" will both be
    81    // canonicalized to "scheme://host/path". The origin of a standard scheme URL
    82    // is the combination of scheme, host and port (i.e., "scheme://host:port" in
    83    // the most explicit case).
    84    //
    85    // For non-standard scheme URLs only the "scheme:" component is parsed and
    86    // canonicalized. The remainder of the URL will be passed to the handler as-
    87    // is. For example, "scheme:///some%20text" will remain the same. Non-standard
    88    // scheme URLs cannot be used as a target for form submission.
    89    //
    90    // If |is_local| is true (1) the scheme will be treated as local (i.e., with
    91    // the same security rules as those applied to "file" URLs). Normal pages
    92    // cannot link to or access local URLs. Also, by default, local URLs can only
    93    // perform XMLHttpRequest calls to the same URL (origin + path) that
    94    // originated the request. To allow XMLHttpRequest calls from a local URL to
    95    // other URLs with the same origin set the
    96    // CefSettings.file_access_from_file_urls_allowed value to true (1). To allow
    97    // XMLHttpRequest calls from a local URL to all origins set the
    98    // CefSettings.universal_access_from_file_urls_allowed value to true (1).
    99    //
   100    // If |is_display_isolated| is true (1) the scheme will be treated as display-
   101    // isolated. This means that pages cannot display these URLs unless they are
   102    // from the same scheme. For example, pages in another origin cannot create
   103    // iframes or hyperlinks to URLs with this scheme.
   104    //
   105    // This function may be called on any thread. It should only be called once
   106    // per unique |scheme_name| value. If |scheme_name| is already registered or
   107    // if an error occurs this function will return false (0).
   108    ///
   109    int (CEF_CALLBACK *add_custom_scheme)(struct _cef_scheme_registrar_t* self,
   110        const cef_string_t* scheme_name, int is_standard, int is_local,
   111        int is_display_isolated);
   112  } cef_scheme_registrar_t;
   113  
   114  
   115  ///
   116  // Structure that creates cef_resource_handler_t instances for handling scheme
   117  // requests. The functions of this structure will always be called on the IO
   118  // thread.
   119  ///
   120  typedef struct _cef_scheme_handler_factory_t {
   121    ///
   122    // Base structure.
   123    ///
   124    cef_base_t base;
   125  
   126    ///
   127    // Return a new resource handler instance to handle the request or an NULL
   128    // reference to allow default handling of the request. |browser| and |frame|
   129    // will be the browser window and frame respectively that originated the
   130    // request or NULL if the request did not originate from a browser window (for
   131    // example, if the request came from cef_urlrequest_t). The |request| object
   132    // passed to this function will not contain cookie data.
   133    ///
   134    struct _cef_resource_handler_t* (CEF_CALLBACK *create)(
   135        struct _cef_scheme_handler_factory_t* self,
   136        struct _cef_browser_t* browser, struct _cef_frame_t* frame,
   137        const cef_string_t* scheme_name, struct _cef_request_t* request);
   138  } cef_scheme_handler_factory_t;
   139  
   140  
   141  ///
   142  // Register a scheme handler factory for the specified |scheme_name| and
   143  // optional |domain_name|. An NULL |domain_name| value for a standard scheme
   144  // will cause the factory to match all domain names. The |domain_name| value
   145  // will be ignored for non-standard schemes. If |scheme_name| is a built-in
   146  // scheme and no handler is returned by |factory| then the built-in scheme
   147  // handler factory will be called. If |scheme_name| is a custom scheme then also
   148  // implement the cef_app_t::on_register_custom_schemes() function in all
   149  // processes. This function may be called multiple times to change or remove the
   150  // factory that matches the specified |scheme_name| and optional |domain_name|.
   151  // Returns false (0) if an error occurs. This function may be called on any
   152  // thread in the browser process.
   153  ///
   154  CEF_EXPORT int cef_register_scheme_handler_factory(
   155      const cef_string_t* scheme_name, const cef_string_t* domain_name,
   156      cef_scheme_handler_factory_t* factory);
   157  
   158  ///
   159  // Clear all registered scheme handler factories. Returns false (0) on error.
   160  // This function may be called on any thread in the browser process.
   161  ///
   162  CEF_EXPORT int cef_clear_scheme_handler_factories();
   163  
   164  #ifdef __cplusplus
   165  }
   166  #endif
   167  
   168  #endif  // CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_