OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 30 matching lines...) Expand all Loading... |
41 namespace WTF { template <typename T> class PassRefPtr; } | 41 namespace WTF { template <typename T> class PassRefPtr; } |
42 #endif | 42 #endif |
43 | 43 |
44 namespace WebKit { | 44 namespace WebKit { |
45 | 45 |
46 class WebHTTPBodyPrivate; | 46 class WebHTTPBodyPrivate; |
47 | 47 |
48 class WebHTTPBody { | 48 class WebHTTPBody { |
49 public: | 49 public: |
50 struct Element { | 50 struct Element { |
51 enum Type { TypeData, TypeFile, TypeBlob, TypeURL } type; | 51 enum Type { TypeData, TypeFile, TypeBlob, TypeFileSystemURL } type; |
52 WebData data; | 52 WebData data; |
53 WebString filePath; | 53 WebString filePath; |
54 long long fileStart; | 54 long long fileStart; |
55 long long fileLength; // -1 means to the end of the file. | 55 long long fileLength; // -1 means to the end of the file. |
56 double modificationTime; | 56 double modificationTime; |
57 WebURL url; // For TypeBlob or TypeURL. | 57 WebURL fileSystemURL; |
58 | 58 WebString blobUUID; |
59 // FIXME: deprecate this. | |
60 WebURL blobURL; | |
61 }; | 59 }; |
62 | 60 |
63 ~WebHTTPBody() { reset(); } | 61 ~WebHTTPBody() { reset(); } |
64 | 62 |
65 WebHTTPBody() : m_private(0) { } | 63 WebHTTPBody() : m_private(0) { } |
66 WebHTTPBody(const WebHTTPBody& b) : m_private(0) { assign(b); } | 64 WebHTTPBody(const WebHTTPBody& b) : m_private(0) { assign(b); } |
67 WebHTTPBody& operator=(const WebHTTPBody& b) | 65 WebHTTPBody& operator=(const WebHTTPBody& b) |
68 { | 66 { |
69 assign(b); | 67 assign(b); |
70 return *this; | 68 return *this; |
(...skipping 10 matching lines...) Expand all Loading... |
81 | 79 |
82 // Sets the values of the element at the given index. Returns false if | 80 // Sets the values of the element at the given index. Returns false if |
83 // index is out of bounds. | 81 // index is out of bounds. |
84 WEBKIT_EXPORT bool elementAt(size_t index, Element&) const; | 82 WEBKIT_EXPORT bool elementAt(size_t index, Element&) const; |
85 | 83 |
86 // Append to the list of elements. | 84 // Append to the list of elements. |
87 WEBKIT_EXPORT void appendData(const WebData&); | 85 WEBKIT_EXPORT void appendData(const WebData&); |
88 WEBKIT_EXPORT void appendFile(const WebString&); | 86 WEBKIT_EXPORT void appendFile(const WebString&); |
89 // Passing -1 to fileLength means to the end of the file. | 87 // Passing -1 to fileLength means to the end of the file. |
90 WEBKIT_EXPORT void appendFileRange(const WebString&, long long fileStart, lo
ng long fileLength, double modificationTime); | 88 WEBKIT_EXPORT void appendFileRange(const WebString&, long long fileStart, lo
ng long fileLength, double modificationTime); |
91 WEBKIT_EXPORT void appendBlob(const WebURL&); | 89 WEBKIT_EXPORT void appendBlob(const WebString& blobUUID); |
92 | 90 |
93 // Append a resource which is identified by URL. Currently we only support F
ileSystem URL. | 91 // Append a resource which is identified by URL. Currently we only support F
ileSystem URL. |
94 WEBKIT_EXPORT void appendURLRange(const WebURL&, long long start, long long
length, double modificationTime); | 92 WEBKIT_EXPORT void appendURLRange(const WebURL&, long long start, long long
length, double modificationTime); |
95 | 93 |
96 // Identifies a particular form submission instance. A value of 0 is | 94 // Identifies a particular form submission instance. A value of 0 is |
97 // used to indicate an unspecified identifier. | 95 // used to indicate an unspecified identifier. |
98 WEBKIT_EXPORT long long identifier() const; | 96 WEBKIT_EXPORT long long identifier() const; |
99 WEBKIT_EXPORT void setIdentifier(long long); | 97 WEBKIT_EXPORT void setIdentifier(long long); |
100 | 98 |
101 WEBKIT_EXPORT bool containsPasswordData() const; | 99 WEBKIT_EXPORT bool containsPasswordData() const; |
102 WEBKIT_EXPORT void setContainsPasswordData(bool); | 100 WEBKIT_EXPORT void setContainsPasswordData(bool); |
103 | 101 |
104 #if WEBKIT_IMPLEMENTATION | 102 #if WEBKIT_IMPLEMENTATION |
105 WebHTTPBody(const WTF::PassRefPtr<WebCore::FormData>&); | 103 WebHTTPBody(const WTF::PassRefPtr<WebCore::FormData>&); |
106 WebHTTPBody& operator=(const WTF::PassRefPtr<WebCore::FormData>&); | 104 WebHTTPBody& operator=(const WTF::PassRefPtr<WebCore::FormData>&); |
107 operator WTF::PassRefPtr<WebCore::FormData>() const; | 105 operator WTF::PassRefPtr<WebCore::FormData>() const; |
108 #endif | 106 #endif |
109 | 107 |
110 private: | 108 private: |
111 void assign(WebHTTPBodyPrivate*); | 109 void assign(WebHTTPBodyPrivate*); |
112 void ensureMutable(); | 110 void ensureMutable(); |
113 WebHTTPBodyPrivate* m_private; | 111 WebHTTPBodyPrivate* m_private; |
114 }; | 112 }; |
115 | 113 |
116 } // namespace WebKit | 114 } // namespace WebKit |
117 | 115 |
118 #endif | 116 #endif |
OLD | NEW |