]> git.sesse.net Git - casparcg/blob - dependencies64/cef/include/cef_request.h
* Merged html producer and updated to latest CEF version (does not have satisfactory...
[casparcg] / dependencies64 / cef / include / cef_request.h
1 // Copyright (c) 2012 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_H_
38 #define CEF_INCLUDE_CEF_REQUEST_H_
39 #pragma once
40
41 #include "include/cef_base.h"
42 #include <map>
43 #include <vector>
44
45 class CefPostData;
46 class CefPostDataElement;
47
48 ///
49 // Class used to represent a web request. The methods of this class may be
50 // called on any thread.
51 ///
52 /*--cef(source=library,no_debugct_check)--*/
53 class CefRequest : public virtual CefBase {
54  public:
55   typedef std::multimap<CefString, CefString> HeaderMap;
56   typedef cef_resource_type_t ResourceType;
57   typedef cef_transition_type_t TransitionType;
58
59   ///
60   // Create a new CefRequest object.
61   ///
62   /*--cef()--*/
63   static CefRefPtr<CefRequest> Create();
64
65   ///
66   // Returns true if this object is read-only.
67   ///
68   /*--cef()--*/
69   virtual bool IsReadOnly() =0;
70
71   ///
72   // Get the fully qualified URL.
73   ///
74   /*--cef()--*/
75   virtual CefString GetURL() =0;
76
77   ///
78   // Set the fully qualified URL.
79   ///
80   /*--cef()--*/
81   virtual void SetURL(const CefString& url) =0;
82
83   ///
84   // Get the request method type. The value will default to POST if post data
85   // is provided and GET otherwise.
86   ///
87   /*--cef()--*/
88   virtual CefString GetMethod() =0;
89
90   ///
91   // Set the request method type.
92   ///
93   /*--cef()--*/
94   virtual void SetMethod(const CefString& method) =0;
95
96   ///
97   // Get the post data.
98   ///
99   /*--cef()--*/
100   virtual CefRefPtr<CefPostData> GetPostData() =0;
101
102   ///
103   // Set the post data.
104   ///
105   /*--cef()--*/
106   virtual void SetPostData(CefRefPtr<CefPostData> postData) =0;
107
108   ///
109   // Get the header values.
110   ///
111   /*--cef()--*/
112   virtual void GetHeaderMap(HeaderMap& headerMap) =0;
113
114   ///
115   // Set the header values.
116   ///
117   /*--cef()--*/
118   virtual void SetHeaderMap(const HeaderMap& headerMap) =0;
119
120   ///
121   // Set all values at one time.
122   ///
123   /*--cef(optional_param=postData)--*/
124   virtual void Set(const CefString& url,
125                    const CefString& method,
126                    CefRefPtr<CefPostData> postData,
127                    const HeaderMap& headerMap) =0;
128
129   ///
130   // Get the flags used in combination with CefURLRequest. See
131   // cef_urlrequest_flags_t for supported values.
132   ///
133   /*--cef(default_retval=UR_FLAG_NONE)--*/
134   virtual int GetFlags() =0;
135
136   ///
137   // Set the flags used in combination with CefURLRequest.  See
138   // cef_urlrequest_flags_t for supported values.
139   ///
140   /*--cef()--*/
141   virtual void SetFlags(int flags) =0;
142
143   ///
144   // Set the URL to the first party for cookies used in combination with
145   // CefURLRequest.
146   ///
147   /*--cef()--*/
148   virtual CefString GetFirstPartyForCookies() =0;
149
150   ///
151   // Get the URL to the first party for cookies used in combination with
152   // CefURLRequest.
153   ///
154   /*--cef()--*/
155   virtual void SetFirstPartyForCookies(const CefString& url) =0;
156
157   ///
158   // Get the resource type for this request. Only available in the browser
159   // process.
160   ///
161   /*--cef(default_retval=RT_SUB_RESOURCE)--*/
162   virtual ResourceType GetResourceType() =0;
163
164   ///
165   // Get the transition type for this request. Only available in the browser
166   // process and only applies to requests that represent a main frame or
167   // sub-frame navigation.
168   ///
169   /*--cef(default_retval=TT_EXPLICIT)--*/
170   virtual TransitionType GetTransitionType() =0;
171
172   ///
173   // Returns the globally unique identifier for this request or 0 if not
174   // specified. Can be used by CefRequestHandler implementations in the browser
175   // process to track a single request across multiple callbacks.
176   ///
177   /*--cef()--*/
178   virtual uint64 GetIdentifier() =0;
179 };
180
181
182 ///
183 // Class used to represent post data for a web request. The methods of this
184 // class may be called on any thread.
185 ///
186 /*--cef(source=library,no_debugct_check)--*/
187 class CefPostData : public virtual CefBase {
188  public:
189   typedef std::vector<CefRefPtr<CefPostDataElement> > ElementVector;
190
191   ///
192   // Create a new CefPostData object.
193   ///
194   /*--cef()--*/
195   static CefRefPtr<CefPostData> Create();
196
197   ///
198   // Returns true if this object is read-only.
199   ///
200   /*--cef()--*/
201   virtual bool IsReadOnly() =0;
202
203   ///
204   // Returns the number of existing post data elements.
205   ///
206   /*--cef()--*/
207   virtual size_t GetElementCount() =0;
208
209   ///
210   // Retrieve the post data elements.
211   ///
212   /*--cef(count_func=elements:GetElementCount)--*/
213   virtual void GetElements(ElementVector& elements) =0;
214
215   ///
216   // Remove the specified post data element.  Returns true if the removal
217   // succeeds.
218   ///
219   /*--cef()--*/
220   virtual bool RemoveElement(CefRefPtr<CefPostDataElement> element) =0;
221
222   ///
223   // Add the specified post data element.  Returns true if the add succeeds.
224   ///
225   /*--cef()--*/
226   virtual bool AddElement(CefRefPtr<CefPostDataElement> element) =0;
227
228   ///
229   // Remove all existing post data elements.
230   ///
231   /*--cef()--*/
232   virtual void RemoveElements() =0;
233 };
234
235
236 ///
237 // Class used to represent a single element in the request post data. The
238 // methods of this class may be called on any thread.
239 ///
240 /*--cef(source=library,no_debugct_check)--*/
241 class CefPostDataElement : public virtual CefBase {
242  public:
243   ///
244   // Post data elements may represent either bytes or files.
245   ///
246   typedef cef_postdataelement_type_t Type;
247
248   ///
249   // Create a new CefPostDataElement object.
250   ///
251   /*--cef()--*/
252   static CefRefPtr<CefPostDataElement> Create();
253
254   ///
255   // Returns true if this object is read-only.
256   ///
257   /*--cef()--*/
258   virtual bool IsReadOnly() =0;
259
260   ///
261   // Remove all contents from the post data element.
262   ///
263   /*--cef()--*/
264   virtual void SetToEmpty() =0;
265
266   ///
267   // The post data element will represent a file.
268   ///
269   /*--cef()--*/
270   virtual void SetToFile(const CefString& fileName) =0;
271
272   ///
273   // The post data element will represent bytes.  The bytes passed
274   // in will be copied.
275   ///
276   /*--cef()--*/
277   virtual void SetToBytes(size_t size, const void* bytes) =0;
278
279   ///
280   // Return the type of this post data element.
281   ///
282   /*--cef(default_retval=PDE_TYPE_EMPTY)--*/
283   virtual Type GetType() =0;
284
285   ///
286   // Return the file name.
287   ///
288   /*--cef()--*/
289   virtual CefString GetFile() =0;
290
291   ///
292   // Return the number of bytes.
293   ///
294   /*--cef()--*/
295   virtual size_t GetBytesCount() =0;
296
297   ///
298   // Read up to |size| bytes into |bytes| and return the number of bytes
299   // actually read.
300   ///
301   /*--cef()--*/
302   virtual size_t GetBytes(size_t size, void* bytes) =0;
303 };
304
305 #endif  // CEF_INCLUDE_CEF_REQUEST_H_