1 // Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
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
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.
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.
30 // ---------------------------------------------------------------------------
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
37 #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
38 #define CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
41 #include "include/capi/cef_cookie_capi.h"
42 #include "include/capi/cef_request_context_handler_capi.h"
48 struct _cef_scheme_handler_factory_t;
51 // A request context provides request handling for a set of related browser or
52 // URL request objects. A request context can be specified when creating a new
53 // browser via the cef_browser_host_t static factory functions or when creating
54 // a new URL request via the cef_urlrequest_t static factory functions. Browser
55 // objects with different request contexts will never be hosted in the same
56 // render process. Browser objects with the same request context may or may not
57 // be hosted in the same render process depending on the process model. Browser
58 // objects created indirectly via the JavaScript window.open function or
59 // targeted links will share the same render process and the same request
60 // context as the source browser. When running in single-process mode there is
61 // only a single render process (the main process) and so all browsers created
62 // in single-process mode will share the same request context. This will be the
63 // first request context passed into a cef_browser_host_t static factory
64 // function and all other request context objects will be ignored.
66 typedef struct _cef_request_context_t {
73 // Returns true (1) if this object is pointing to the same context as |that|
76 int (CEF_CALLBACK *is_same)(struct _cef_request_context_t* self,
77 struct _cef_request_context_t* other);
80 // Returns true (1) if this object is sharing the same storage as |that|
83 int (CEF_CALLBACK *is_sharing_with)(struct _cef_request_context_t* self,
84 struct _cef_request_context_t* other);
87 // Returns true (1) if this object is the global context. The global context
88 // is used by default when creating a browser or URL request with a NULL
91 int (CEF_CALLBACK *is_global)(struct _cef_request_context_t* self);
94 // Returns the handler for this context if any.
96 struct _cef_request_context_handler_t* (CEF_CALLBACK *get_handler)(
97 struct _cef_request_context_t* self);
100 // Returns the cache path for this object. If NULL an "incognito mode" in-
101 // memory cache is being used.
103 // The resulting string must be freed by calling cef_string_userfree_free().
104 cef_string_userfree_t (CEF_CALLBACK *get_cache_path)(
105 struct _cef_request_context_t* self);
108 // Returns the default cookie manager for this object. This will be the global
109 // cookie manager if this object is the global request context. Otherwise,
110 // this will be the default cookie manager used when this request context does
111 // not receive a value via cef_request_tContextHandler::get_cookie_manager().
112 // If |callback| is non-NULL it will be executed asnychronously on the IO
113 // thread after the manager's storage has been initialized.
115 struct _cef_cookie_manager_t* (CEF_CALLBACK *get_default_cookie_manager)(
116 struct _cef_request_context_t* self,
117 struct _cef_completion_callback_t* callback);
120 // Register a scheme handler factory for the specified |scheme_name| and
121 // optional |domain_name|. An NULL |domain_name| value for a standard scheme
122 // will cause the factory to match all domain names. The |domain_name| value
123 // will be ignored for non-standard schemes. If |scheme_name| is a built-in
124 // scheme and no handler is returned by |factory| then the built-in scheme
125 // handler factory will be called. If |scheme_name| is a custom scheme then
126 // you must also implement the cef_app_t::on_register_custom_schemes()
127 // function in all processes. This function may be called multiple times to
128 // change or remove the factory that matches the specified |scheme_name| and
129 // optional |domain_name|. Returns false (0) if an error occurs. This function
130 // may be called on any thread in the browser process.
132 int (CEF_CALLBACK *register_scheme_handler_factory)(
133 struct _cef_request_context_t* self, const cef_string_t* scheme_name,
134 const cef_string_t* domain_name,
135 struct _cef_scheme_handler_factory_t* factory);
138 // Clear all registered scheme handler factories. Returns false (0) on error.
139 // This function may be called on any thread in the browser process.
141 int (CEF_CALLBACK *clear_scheme_handler_factories)(
142 struct _cef_request_context_t* self);
143 } cef_request_context_t;
147 // Returns the global context object.
149 CEF_EXPORT cef_request_context_t* cef_request_context_get_global_context();
152 // Creates a new context object with the specified |settings| and optional
155 CEF_EXPORT cef_request_context_t* cef_request_context_create_context(
156 const struct _cef_request_context_settings_t* settings,
157 struct _cef_request_context_handler_t* handler);
160 // Creates a new context object that shares storage with |other| and uses an
161 // optional |handler|.
163 CEF_EXPORT cef_request_context_t* create_context_shared(
164 cef_request_context_t* other,
165 struct _cef_request_context_handler_t* handler);
172 #endif // CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_