• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2022 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 // $hash=d9790a35d74621e985b917935a4fca74ba7db1e0$
37 //
38 
39 #ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_
40 #define CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_
41 #pragma once
42 
43 #include "include/capi/cef_base_capi.h"
44 #include "include/capi/cef_callback_capi.h"
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 struct _cef_cookie_visitor_t;
51 struct _cef_delete_cookies_callback_t;
52 struct _cef_set_cookie_callback_t;
53 
54 ///
55 // Structure used for managing cookies. The functions of this structure may be
56 // called on any thread unless otherwise indicated.
57 ///
58 typedef struct _cef_cookie_manager_t {
59   ///
60   // Base structure.
61   ///
62   cef_base_ref_counted_t base;
63 
64   ///
65   // Visit all cookies on the UI thread. The returned cookies are ordered by
66   // longest path, then by earliest creation date. Returns false (0) if cookies
67   // cannot be accessed.
68   ///
69   int(CEF_CALLBACK* visit_all_cookies)(struct _cef_cookie_manager_t* self,
70                                        struct _cef_cookie_visitor_t* visitor);
71 
72   ///
73   // Visit a subset of cookies on the UI thread. The results are filtered by the
74   // given url scheme, host, domain and path. If |includeHttpOnly| is true (1)
75   // HTTP-only cookies will also be included in the results. The returned
76   // cookies are ordered by longest path, then by earliest creation date.
77   // Returns false (0) if cookies cannot be accessed.
78   ///
79   int(CEF_CALLBACK* visit_url_cookies)(struct _cef_cookie_manager_t* self,
80                                        const cef_string_t* url,
81                                        int includeHttpOnly,
82                                        struct _cef_cookie_visitor_t* visitor);
83 
84   ///
85   // Sets a cookie given a valid URL and explicit user-provided cookie
86   // attributes. This function expects each attribute to be well-formed. It will
87   // check for disallowed characters (e.g. the ';' character is disallowed
88   // within the cookie value attribute) and fail without setting the cookie if
89   // such characters are found. If |callback| is non-NULL it will be executed
90   // asnychronously on the UI thread after the cookie has been set. Returns
91   // false (0) if an invalid URL is specified or if cookies cannot be accessed.
92   ///
93   int(CEF_CALLBACK* set_cookie)(struct _cef_cookie_manager_t* self,
94                                 const cef_string_t* url,
95                                 const struct _cef_cookie_t* cookie,
96                                 struct _cef_set_cookie_callback_t* callback);
97 
98   ///
99   // Delete all cookies that match the specified parameters. If both |url| and
100   // |cookie_name| values are specified all host and domain cookies matching
101   // both will be deleted. If only |url| is specified all host cookies (but not
102   // domain cookies) irrespective of path will be deleted. If |url| is NULL all
103   // cookies for all hosts and domains will be deleted. If |callback| is non-
104   // NULL it will be executed asnychronously on the UI thread after the cookies
105   // have been deleted. Returns false (0) if a non-NULL invalid URL is specified
106   // or if cookies cannot be accessed. Cookies can alternately be deleted using
107   // the Visit*Cookies() functions.
108   ///
109   int(CEF_CALLBACK* delete_cookies)(
110       struct _cef_cookie_manager_t* self,
111       const cef_string_t* url,
112       const cef_string_t* cookie_name,
113       struct _cef_delete_cookies_callback_t* callback);
114 
115   ///
116   // Flush the backing store (if any) to disk. If |callback| is non-NULL it will
117   // be executed asnychronously on the UI thread after the flush is complete.
118   // Returns false (0) if cookies cannot be accessed.
119   ///
120   int(CEF_CALLBACK* flush_store)(struct _cef_cookie_manager_t* self,
121                                  struct _cef_completion_callback_t* callback);
122 } cef_cookie_manager_t;
123 
124 ///
125 // Returns the global cookie manager. By default data will be stored at
126 // CefSettings.cache_path if specified or in memory otherwise. If |callback| is
127 // non-NULL it will be executed asnychronously on the UI thread after the
128 // manager's storage has been initialized. Using this function is equivalent to
129 // calling cef_request_context_t::cef_request_context_get_global_context()->GetD
130 // efaultCookieManager().
131 ///
132 CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
133     struct _cef_completion_callback_t* callback);
134 
135 ///
136 // Structure to implement for visiting cookie values. The functions of this
137 // structure will always be called on the UI thread.
138 ///
139 typedef struct _cef_cookie_visitor_t {
140   ///
141   // Base structure.
142   ///
143   cef_base_ref_counted_t base;
144 
145   ///
146   // Method that will be called once for each cookie. |count| is the 0-based
147   // index for the current cookie. |total| is the total number of cookies. Set
148   // |deleteCookie| to true (1) to delete the cookie currently being visited.
149   // Return false (0) to stop visiting cookies. This function may never be
150   // called if no cookies are found.
151   ///
152   int(CEF_CALLBACK* visit)(struct _cef_cookie_visitor_t* self,
153                            const struct _cef_cookie_t* cookie,
154                            int count,
155                            int total,
156                            int* deleteCookie);
157 } cef_cookie_visitor_t;
158 
159 ///
160 // Structure to implement to be notified of asynchronous completion via
161 // cef_cookie_manager_t::set_cookie().
162 ///
163 typedef struct _cef_set_cookie_callback_t {
164   ///
165   // Base structure.
166   ///
167   cef_base_ref_counted_t base;
168 
169   ///
170   // Method that will be called upon completion. |success| will be true (1) if
171   // the cookie was set successfully.
172   ///
173   void(CEF_CALLBACK* on_complete)(struct _cef_set_cookie_callback_t* self,
174                                   int success);
175 } cef_set_cookie_callback_t;
176 
177 ///
178 // Structure to implement to be notified of asynchronous completion via
179 // cef_cookie_manager_t::delete_cookies().
180 ///
181 typedef struct _cef_delete_cookies_callback_t {
182   ///
183   // Base structure.
184   ///
185   cef_base_ref_counted_t base;
186 
187   ///
188   // Method that will be called upon completion. |num_deleted| will be the
189   // number of cookies that were deleted.
190   ///
191   void(CEF_CALLBACK* on_complete)(struct _cef_delete_cookies_callback_t* self,
192                                   int num_deleted);
193 } cef_delete_cookies_callback_t;
194 
195 #ifdef __cplusplus
196 }
197 #endif
198 
199 #endif  // CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_
200