github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/capi/cef_origin_whitelist_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_ORIGIN_WHITELIST_CAPI_H_
    38  #define CEF_INCLUDE_CAPI_CEF_ORIGIN_WHITELIST_CAPI_H_
    39  #pragma once
    40  
    41  #ifdef __cplusplus
    42  extern "C" {
    43  #endif
    44  
    45  #include "include/capi/cef_base_capi.h"
    46  
    47  
    48  ///
    49  // Add an entry to the cross-origin access whitelist.
    50  //
    51  // The same-origin policy restricts how scripts hosted from different origins
    52  // (scheme + domain + port) can communicate. By default, scripts can only access
    53  // resources with the same origin. Scripts hosted on the HTTP and HTTPS schemes
    54  // (but no other schemes) can use the "Access-Control-Allow-Origin" header to
    55  // allow cross-origin requests. For example, https://source.example.com can make
    56  // XMLHttpRequest requests on http://target.example.com if the
    57  // http://target.example.com request returns an "Access-Control-Allow-Origin:
    58  // https://source.example.com" response header.
    59  //
    60  // Scripts in separate frames or iframes and hosted from the same protocol and
    61  // domain suffix can execute cross-origin JavaScript if both pages set the
    62  // document.domain value to the same domain suffix. For example,
    63  // scheme://foo.example.com and scheme://bar.example.com can communicate using
    64  // JavaScript if both domains set document.domain="example.com".
    65  //
    66  // This function is used to allow access to origins that would otherwise violate
    67  // the same-origin policy. Scripts hosted underneath the fully qualified
    68  // |source_origin| URL (like http://www.example.com) will be allowed access to
    69  // all resources hosted on the specified |target_protocol| and |target_domain|.
    70  // If |target_domain| is non-NULL and |allow_target_subdomains| if false (0)
    71  // only exact domain matches will be allowed. If |target_domain| contains a top-
    72  // level domain component (like "example.com") and |allow_target_subdomains| is
    73  // true (1) sub-domain matches will be allowed. If |target_domain| is NULL and
    74  // |allow_target_subdomains| if true (1) all domains and IP addresses will be
    75  // allowed.
    76  //
    77  // This function cannot be used to bypass the restrictions on local or display
    78  // isolated schemes. See the comments on CefRegisterCustomScheme for more
    79  // information.
    80  //
    81  // This function may be called on any thread. Returns false (0) if
    82  // |source_origin| is invalid or the whitelist cannot be accessed.
    83  ///
    84  CEF_EXPORT int cef_add_cross_origin_whitelist_entry(
    85      const cef_string_t* source_origin, const cef_string_t* target_protocol,
    86      const cef_string_t* target_domain, int allow_target_subdomains);
    87  
    88  ///
    89  // Remove an entry from the cross-origin access whitelist. Returns false (0) if
    90  // |source_origin| is invalid or the whitelist cannot be accessed.
    91  ///
    92  CEF_EXPORT int cef_remove_cross_origin_whitelist_entry(
    93      const cef_string_t* source_origin, const cef_string_t* target_protocol,
    94      const cef_string_t* target_domain, int allow_target_subdomains);
    95  
    96  ///
    97  // Remove all entries from the cross-origin access whitelist. Returns false (0)
    98  // if the whitelist cannot be accessed.
    99  ///
   100  CEF_EXPORT int cef_clear_cross_origin_whitelist();
   101  
   102  #ifdef __cplusplus
   103  }
   104  #endif
   105  
   106  #endif  // CEF_INCLUDE_CAPI_CEF_ORIGIN_WHITELIST_CAPI_H_