OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are | |
6 * met: | |
7 * | |
8 * * Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * * Redistributions in binary form must reproduce the above | |
11 * copyright notice, this list of conditions and the following disclaimer | |
12 * in the documentation and/or other materials provided with the | |
13 * distribution. | |
14 * * Neither the name of Google Inc. nor the names of its | |
15 * contributors may be used to endorse or promote products derived from | |
16 * this software without specific prior 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 #ifndef SKY_ENGINE_PUBLIC_PLATFORM_WEBHTTPBODY_H_ | |
32 #define SKY_ENGINE_PUBLIC_PLATFORM_WEBHTTPBODY_H_ | |
33 | |
34 #include "sky/engine/public/platform/WebData.h" | |
35 #include "sky/engine/public/platform/WebNonCopyable.h" | |
36 #include "sky/engine/public/platform/WebString.h" | |
37 #include "sky/engine/public/platform/WebURL.h" | |
38 | |
39 #if INSIDE_BLINK | |
40 namespace WTF { template <typename T> class PassRefPtr; } | |
41 #endif | |
42 | |
43 namespace blink { | |
44 | |
45 class FormData; | |
46 class WebHTTPBodyPrivate; | |
47 | |
48 class WebHTTPBody { | |
49 public: | |
50 struct Element { | |
51 enum Type { TypeData } type; | |
52 WebData data; | |
53 }; | |
54 | |
55 ~WebHTTPBody() { reset(); } | |
56 | |
57 WebHTTPBody() : m_private(0) { } | |
58 WebHTTPBody(const WebHTTPBody& b) : m_private(0) { assign(b); } | |
59 WebHTTPBody& operator=(const WebHTTPBody& b) | |
60 { | |
61 assign(b); | |
62 return *this; | |
63 } | |
64 | |
65 BLINK_PLATFORM_EXPORT void initialize(); | |
66 BLINK_PLATFORM_EXPORT void reset(); | |
67 BLINK_PLATFORM_EXPORT void assign(const WebHTTPBody&); | |
68 | |
69 bool isNull() const { return !m_private; } | |
70 | |
71 // Returns the number of elements comprising the http body. | |
72 BLINK_PLATFORM_EXPORT size_t elementCount() const; | |
73 | |
74 // Sets the values of the element at the given index. Returns false if | |
75 // index is out of bounds. | |
76 BLINK_PLATFORM_EXPORT bool elementAt(size_t index, Element&) const; | |
77 | |
78 // Append to the list of elements. | |
79 BLINK_PLATFORM_EXPORT void appendData(const WebData&); | |
80 | |
81 // Identifies a particular form submission instance. A value of 0 is | |
82 // used to indicate an unspecified identifier. | |
83 BLINK_PLATFORM_EXPORT long long identifier() const; | |
84 BLINK_PLATFORM_EXPORT void setIdentifier(long long); | |
85 | |
86 BLINK_PLATFORM_EXPORT bool containsPasswordData() const; | |
87 BLINK_PLATFORM_EXPORT void setContainsPasswordData(bool); | |
88 | |
89 #if INSIDE_BLINK | |
90 BLINK_PLATFORM_EXPORT WebHTTPBody(const WTF::PassRefPtr<FormData>&); | |
91 BLINK_PLATFORM_EXPORT WebHTTPBody& operator=(const WTF::PassRefPtr<FormData>
&); | |
92 BLINK_PLATFORM_EXPORT operator WTF::PassRefPtr<FormData>() const; | |
93 #endif | |
94 | |
95 private: | |
96 BLINK_PLATFORM_EXPORT void assign(WebHTTPBodyPrivate*); | |
97 BLINK_PLATFORM_EXPORT void ensureMutable(); | |
98 | |
99 WebHTTPBodyPrivate* m_private; | |
100 }; | |
101 | |
102 } // namespace blink | |
103 | |
104 #endif // SKY_ENGINE_PUBLIC_PLATFORM_WEBHTTPBODY_H_ | |
OLD | NEW |