]> git.sesse.net Git - casparcg/blob - dependencies64/cef/include/cef_request_context.h
* Merged html producer and updated to latest CEF version (does not have satisfactory...
[casparcg] / dependencies64 / cef / include / cef_request_context.h
1 // Copyright (c) 2013 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 // The contents of this file must follow a specific format in order to
33 // support the CEF translator tool. See the translator.README.txt file in the
34 // tools directory for more information.
35 //
36
37 #ifndef CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_
38 #define CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_
39 #pragma once
40
41 #include "include/cef_cookie.h"
42 #include "include/cef_request_context_handler.h"
43
44 class CefSchemeHandlerFactory;
45
46 ///
47 // A request context provides request handling for a set of related browser
48 // or URL request objects. A request context can be specified when creating a
49 // new browser via the CefBrowserHost static factory methods or when creating a
50 // new URL request via the CefURLRequest static factory methods. Browser objects
51 // with different request contexts will never be hosted in the same render
52 // process. Browser objects with the same request context may or may not be
53 // hosted in the same render process depending on the process model. Browser
54 // objects created indirectly via the JavaScript window.open function or
55 // targeted links will share the same render process and the same request
56 // context as the source browser. When running in single-process mode there is
57 // only a single render process (the main process) and so all browsers created
58 // in single-process mode will share the same request context. This will be the
59 // first request context passed into a CefBrowserHost static factory method and
60 // all other request context objects will be ignored.
61 ///
62 /*--cef(source=library,no_debugct_check)--*/
63 class CefRequestContext : public virtual CefBase {
64  public:
65   ///
66   // Returns the global context object.
67   ///
68   /*--cef()--*/
69   static CefRefPtr<CefRequestContext> GetGlobalContext();
70
71   ///
72   // Creates a new context object with the specified |settings| and optional
73   // |handler|.
74   ///
75   /*--cef(optional_param=handler)--*/
76   static CefRefPtr<CefRequestContext> CreateContext(
77       const CefRequestContextSettings& settings,
78       CefRefPtr<CefRequestContextHandler> handler);
79
80   ///
81   // Creates a new context object that shares storage with |other| and uses an
82   // optional |handler|.
83   ///
84   /*--cef(capi_name=create_context_shared,optional_param=handler)--*/
85   static CefRefPtr<CefRequestContext> CreateContext(
86       CefRefPtr<CefRequestContext> other,
87       CefRefPtr<CefRequestContextHandler> handler);
88
89   ///
90   // Returns true if this object is pointing to the same context as |that|
91   // object.
92   ///
93   /*--cef()--*/
94   virtual bool IsSame(CefRefPtr<CefRequestContext> other) =0;
95
96   ///
97   // Returns true if this object is sharing the same storage as |that| object.
98   ///
99   /*--cef()--*/
100   virtual bool IsSharingWith(CefRefPtr<CefRequestContext> other) =0;
101
102   ///
103   // Returns true if this object is the global context. The global context is
104   // used by default when creating a browser or URL request with a NULL context
105   // argument.
106   ///
107   /*--cef()--*/
108   virtual bool IsGlobal() =0;
109
110   ///
111   // Returns the handler for this context if any.
112   ///
113   /*--cef()--*/
114   virtual CefRefPtr<CefRequestContextHandler> GetHandler() =0;
115
116   ///
117   // Returns the cache path for this object. If empty an "incognito mode"
118   // in-memory cache is being used.
119   ///
120   /*--cef()--*/
121   virtual CefString GetCachePath() =0;
122
123   ///
124   // Returns the default cookie manager for this object. This will be the global
125   // cookie manager if this object is the global request context. Otherwise,
126   // this will be the default cookie manager used when this request context does
127   // not receive a value via CefRequestContextHandler::GetCookieManager(). If
128   // |callback| is non-NULL it will be executed asnychronously on the IO thread
129   // after the manager's storage has been initialized.
130   ///
131   /*--cef(optional_param=callback)--*/
132   virtual CefRefPtr<CefCookieManager> GetDefaultCookieManager(
133       CefRefPtr<CefCompletionCallback> callback) =0;
134
135   ///
136   // Register a scheme handler factory for the specified |scheme_name| and
137   // optional |domain_name|. An empty |domain_name| value for a standard scheme
138   // will cause the factory to match all domain names. The |domain_name| value
139   // will be ignored for non-standard schemes. If |scheme_name| is a built-in
140   // scheme and no handler is returned by |factory| then the built-in scheme
141   // handler factory will be called. If |scheme_name| is a custom scheme then
142   // you must also implement the CefApp::OnRegisterCustomSchemes() method in all
143   // processes. This function may be called multiple times to change or remove
144   // the factory that matches the specified |scheme_name| and optional
145   // |domain_name|. Returns false if an error occurs. This function may be
146   // called on any thread in the browser process.
147   ///
148   /*--cef(optional_param=domain_name,optional_param=factory)--*/
149   virtual bool RegisterSchemeHandlerFactory(
150       const CefString& scheme_name,
151       const CefString& domain_name,
152       CefRefPtr<CefSchemeHandlerFactory> factory) =0;
153
154   ///
155   // Clear all registered scheme handler factories. Returns false on error. This
156   // function may be called on any thread in the browser process.
157   ///
158   /*--cef()--*/
159   virtual bool ClearSchemeHandlerFactories() =0;
160 };
161
162 #endif  // CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_