OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> | 3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> |
4 * Copyright (C) 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2011 Google Inc. All rights reserved. |
5 * Copyright (C) 2012 Intel Corporation | 5 * Copyright (C) 2012 Intel Corporation |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Lesser General Public License for more details. | 15 * Lesser General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Lesser General Public | 17 * You should have received a copy of the GNU Lesser General Public |
18 * License along with this library; if not, write to the Free Software | 18 * License along with this library; if not, write to the Free Software |
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U
SA | 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U
SA |
20 */ | 20 */ |
21 | 21 |
22 #ifndef XMLHttpRequest_h | 22 #ifndef XMLHttpRequest_h |
23 #define XMLHttpRequest_h | 23 #define XMLHttpRequest_h |
24 | 24 |
| 25 #include "bindings/core/v8/ActiveScriptWrappable.h" |
25 #include "bindings/core/v8/ScriptString.h" | 26 #include "bindings/core/v8/ScriptString.h" |
26 #include "bindings/core/v8/ScriptWrappable.h" | 27 #include "bindings/core/v8/ScriptWrappable.h" |
27 #include "core/dom/ActiveDOMObject.h" | 28 #include "core/dom/ActiveDOMObject.h" |
28 #include "core/dom/DocumentParserClient.h" | 29 #include "core/dom/DocumentParserClient.h" |
29 #include "core/loader/ThreadableLoaderClient.h" | 30 #include "core/loader/ThreadableLoaderClient.h" |
30 #include "core/xmlhttprequest/XMLHttpRequestEventTarget.h" | 31 #include "core/xmlhttprequest/XMLHttpRequestEventTarget.h" |
31 #include "core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h" | 32 #include "core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.h" |
32 #include "platform/heap/Handle.h" | 33 #include "platform/heap/Handle.h" |
33 #include "platform/network/EncodedFormData.h" | 34 #include "platform/network/EncodedFormData.h" |
34 #include "platform/network/HTTPHeaderMap.h" | 35 #include "platform/network/HTTPHeaderMap.h" |
(...skipping 24 matching lines...) Expand all Loading... |
59 class ScriptState; | 60 class ScriptState; |
60 class SharedBuffer; | 61 class SharedBuffer; |
61 class Stream; | 62 class Stream; |
62 class TextResourceDecoder; | 63 class TextResourceDecoder; |
63 class ThreadableLoader; | 64 class ThreadableLoader; |
64 class WebDataConsumerHandle; | 65 class WebDataConsumerHandle; |
65 class XMLHttpRequestUpload; | 66 class XMLHttpRequestUpload; |
66 | 67 |
67 typedef int ExceptionCode; | 68 typedef int ExceptionCode; |
68 | 69 |
69 class XMLHttpRequest final : public XMLHttpRequestEventTarget, private Threadabl
eLoaderClient, public DocumentParserClient, public ActiveDOMObject { | 70 class XMLHttpRequest final : public XMLHttpRequestEventTarget, private Threadabl
eLoaderClient, public DocumentParserClient, public ActiveScriptWrappable, public
ActiveDOMObject { |
70 DEFINE_WRAPPERTYPEINFO(); | 71 DEFINE_WRAPPERTYPEINFO(); |
71 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(XMLHttpRequest); | 72 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(XMLHttpRequest); |
72 public: | 73 public: |
73 static XMLHttpRequest* create(ScriptState*); | 74 static XMLHttpRequest* create(ScriptState*); |
74 static XMLHttpRequest* create(ExecutionContext*); | 75 static XMLHttpRequest* create(ExecutionContext*); |
75 ~XMLHttpRequest() override; | 76 ~XMLHttpRequest() override; |
76 | 77 |
77 // These exact numeric values are important because JS expects them. | 78 // These exact numeric values are important because JS expects them. |
78 enum State { | 79 enum State { |
79 UNSENT = 0, | 80 UNSENT = 0, |
80 OPENED = 1, | 81 OPENED = 1, |
81 HEADERS_RECEIVED = 2, | 82 HEADERS_RECEIVED = 2, |
82 LOADING = 3, | 83 LOADING = 3, |
83 DONE = 4 | 84 DONE = 4 |
84 }; | 85 }; |
85 | 86 |
86 enum ResponseTypeCode { | 87 enum ResponseTypeCode { |
87 ResponseTypeDefault, | 88 ResponseTypeDefault, |
88 ResponseTypeText, | 89 ResponseTypeText, |
89 ResponseTypeJSON, | 90 ResponseTypeJSON, |
90 ResponseTypeDocument, | 91 ResponseTypeDocument, |
91 ResponseTypeBlob, | 92 ResponseTypeBlob, |
92 ResponseTypeArrayBuffer, | 93 ResponseTypeArrayBuffer, |
93 ResponseTypeLegacyStream, | 94 ResponseTypeLegacyStream, |
94 }; | 95 }; |
95 | 96 |
96 // ActiveDOMObject | 97 // ActiveDOMObject |
97 void contextDestroyed() override; | 98 void contextDestroyed() override; |
98 ExecutionContext* getExecutionContext() const override; | 99 ExecutionContext* getExecutionContext() const override; |
99 bool hasPendingActivity() const override; | |
100 void suspend() override; | 100 void suspend() override; |
101 void resume() override; | 101 void resume() override; |
102 void stop() override; | 102 void stop() override; |
103 | 103 |
| 104 // ActiveScriptWrappable |
| 105 bool hasPendingActivity() const final; |
| 106 |
104 // XMLHttpRequestEventTarget | 107 // XMLHttpRequestEventTarget |
105 const AtomicString& interfaceName() const override; | 108 const AtomicString& interfaceName() const override; |
106 | 109 |
107 // JavaScript attributes and methods | 110 // JavaScript attributes and methods |
108 const KURL& url() const { return m_url; } | 111 const KURL& url() const { return m_url; } |
109 String statusText() const; | 112 String statusText() const; |
110 int status() const; | 113 int status() const; |
111 State readyState() const; | 114 State readyState() const; |
112 bool withCredentials() const { return m_includeCredentials; } | 115 bool withCredentials() const { return m_includeCredentials; } |
113 void setWithCredentials(bool, ExceptionState&); | 116 void setWithCredentials(bool, ExceptionState&); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 bool m_sameOriginRequest; | 318 bool m_sameOriginRequest; |
316 // True iff the ongoing resource loading is using the downloadToFile | 319 // True iff the ongoing resource loading is using the downloadToFile |
317 // option. | 320 // option. |
318 bool m_downloadingToFile; | 321 bool m_downloadingToFile; |
319 bool m_responseTextOverflow; | 322 bool m_responseTextOverflow; |
320 }; | 323 }; |
321 | 324 |
322 } // namespace blink | 325 } // namespace blink |
323 | 326 |
324 #endif // XMLHttpRequest_h | 327 #endif // XMLHttpRequest_h |
OLD | NEW |