github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/capi/cef_cookie_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_COOKIE_CAPI_H_ 38 #define CEF_INCLUDE_CAPI_CEF_COOKIE_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_callback_capi.h" 47 48 struct _cef_cookie_visitor_t; 49 50 /// 51 // Structure used for managing cookies. The functions of this structure may be 52 // called on any thread unless otherwise indicated. 53 /// 54 typedef struct _cef_cookie_manager_t { 55 /// 56 // Base structure. 57 /// 58 cef_base_t base; 59 60 /// 61 // Set the schemes supported by this manager. By default only "http" and 62 // "https" schemes are supported. Must be called before any cookies are 63 // accessed. 64 /// 65 void (CEF_CALLBACK *set_supported_schemes)(struct _cef_cookie_manager_t* self, 66 cef_string_list_t schemes); 67 68 /// 69 // Visit all cookies. The returned cookies are ordered by longest path, then 70 // by earliest creation date. Returns false (0) if cookies cannot be accessed. 71 /// 72 int (CEF_CALLBACK *visit_all_cookies)(struct _cef_cookie_manager_t* self, 73 struct _cef_cookie_visitor_t* visitor); 74 75 /// 76 // Visit a subset of cookies. The results are filtered by the given url 77 // scheme, host, domain and path. If |includeHttpOnly| is true (1) HTTP-only 78 // cookies will also be included in the results. The returned cookies are 79 // ordered by longest path, then by earliest creation date. Returns false (0) 80 // if cookies cannot be accessed. 81 /// 82 int (CEF_CALLBACK *visit_url_cookies)(struct _cef_cookie_manager_t* self, 83 const cef_string_t* url, int includeHttpOnly, 84 struct _cef_cookie_visitor_t* visitor); 85 86 /// 87 // Sets a cookie given a valid URL and explicit user-provided cookie 88 // attributes. This function expects each attribute to be well-formed. It will 89 // check for disallowed characters (e.g. the ';' character is disallowed 90 // within the cookie value attribute) and will return false (0) without 91 // setting the cookie if such characters are found. This function must be 92 // called on the IO thread. 93 /// 94 int (CEF_CALLBACK *set_cookie)(struct _cef_cookie_manager_t* self, 95 const cef_string_t* url, const struct _cef_cookie_t* cookie); 96 97 /// 98 // Delete all cookies that match the specified parameters. If both |url| and 99 // values |cookie_name| are specified all host and domain cookies matching 100 // both will be deleted. If only |url| is specified all host cookies (but not 101 // domain cookies) irrespective of path will be deleted. If |url| is NULL all 102 // cookies for all hosts and domains will be deleted. Returns false (0) if a 103 // non- NULL invalid URL is specified or if cookies cannot be accessed. This 104 // function must be called on the IO thread. 105 /// 106 int (CEF_CALLBACK *delete_cookies)(struct _cef_cookie_manager_t* self, 107 const cef_string_t* url, const cef_string_t* cookie_name); 108 109 /// 110 // Sets the directory path that will be used for storing cookie data. If 111 // |path| is NULL data will be stored in memory only. Otherwise, data will be 112 // stored at the specified |path|. To persist session cookies (cookies without 113 // an expiry date or validity interval) set |persist_session_cookies| to true 114 // (1). Session cookies are generally intended to be transient and most Web 115 // browsers do not persist them. Returns false (0) if cookies cannot be 116 // accessed. 117 /// 118 int (CEF_CALLBACK *set_storage_path)(struct _cef_cookie_manager_t* self, 119 const cef_string_t* path, int persist_session_cookies); 120 121 /// 122 // Flush the backing store (if any) to disk and execute the specified 123 // |handler| on the IO thread when done. Returns false (0) if cookies cannot 124 // be accessed. 125 /// 126 int (CEF_CALLBACK *flush_store)(struct _cef_cookie_manager_t* self, 127 struct _cef_completion_handler_t* handler); 128 } cef_cookie_manager_t; 129 130 131 /// 132 // Returns the global cookie manager. By default data will be stored at 133 // CefSettings.cache_path if specified or in memory otherwise. 134 /// 135 CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(); 136 137 /// 138 // Creates a new cookie manager. If |path| is NULL data will be stored in memory 139 // only. Otherwise, data will be stored at the specified |path|. To persist 140 // session cookies (cookies without an expiry date or validity interval) set 141 // |persist_session_cookies| to true (1). Session cookies are generally intended 142 // to be transient and most Web browsers do not persist them. Returns NULL if 143 // creation fails. 144 /// 145 CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_create_manager( 146 const cef_string_t* path, int persist_session_cookies); 147 148 149 /// 150 // Structure to implement for visiting cookie values. The functions of this 151 // structure will always be called on the IO thread. 152 /// 153 typedef struct _cef_cookie_visitor_t { 154 /// 155 // Base structure. 156 /// 157 cef_base_t base; 158 159 /// 160 // Method that will be called once for each cookie. |count| is the 0-based 161 // index for the current cookie. |total| is the total number of cookies. Set 162 // |deleteCookie| to true (1) to delete the cookie currently being visited. 163 // Return false (0) to stop visiting cookies. This function may never be 164 // called if no cookies are found. 165 /// 166 int (CEF_CALLBACK *visit)(struct _cef_cookie_visitor_t* self, 167 const struct _cef_cookie_t* cookie, int count, int total, 168 int* deleteCookie); 169 } cef_cookie_visitor_t; 170 171 172 #ifdef __cplusplus 173 } 174 #endif 175 176 #endif // CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_