blob: 3ef2a6698d4e697585ea96a27fabc211814bbd54 [file] [log] [blame]
weinig@apple.coma244b912008-07-30 02:39:48 +00001/*
2 * Copyright (C) 2008 Apple 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
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
commit-queue@webkit.org553e8d32016-11-12 08:57:21 +000026#pragma once
weinig@apple.coma244b912008-07-30 02:39:48 +000027
ggaren@apple.com4e21a1e2011-04-25 00:47:17 +000028#include "XMLHttpRequest.h"
barraclough@apple.comd218c2d2010-08-10 00:38:14 +000029#include <wtf/Forward.h>
weinig@apple.coma244b912008-07-30 02:39:48 +000030#include <wtf/RefCounted.h>
31#include <wtf/RefPtr.h>
weinig@apple.coma244b912008-07-30 02:39:48 +000032
33namespace WebCore {
34
ap@webkit.orgf319b262008-11-01 07:11:09 +000035 class ScriptExecutionContext;
weinig@apple.coma244b912008-07-30 02:39:48 +000036 class XMLHttpRequest;
37
cdumez@apple.com071dd002016-02-15 22:03:04 +000038 class XMLHttpRequestUpload final : public XMLHttpRequestEventTarget {
cdumez@apple.coma738a882016-04-19 18:39:09 +000039 WTF_MAKE_FAST_ALLOCATED;
weinig@apple.coma244b912008-07-30 02:39:48 +000040 public:
zandobersek@gmail.com0bd1bda2013-11-13 06:52:14 +000041 explicit XMLHttpRequestUpload(XMLHttpRequest*);
weinig@apple.coma244b912008-07-30 02:39:48 +000042
ggaren@apple.com4e21a1e2011-04-25 00:47:17 +000043 void ref() { m_xmlHttpRequest->ref(); }
44 void deref() { m_xmlHttpRequest->deref(); }
45 XMLHttpRequest* xmlHttpRequest() const { return m_xmlHttpRequest; }
weinig@apple.coma244b912008-07-30 02:39:48 +000046
darin@apple.com11ff47c2016-03-04 16:47:55 +000047 EventTargetInterface eventTargetInterface() const override { return XMLHttpRequestUploadEventTargetInterfaceType; }
48 ScriptExecutionContext* scriptExecutionContext() const override { return m_xmlHttpRequest->scriptExecutionContext(); }
weinig@apple.com42d87a62008-10-01 00:39:19 +000049
commit-queue@webkit.orgfceceae2014-01-10 21:22:18 +000050 void dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total);
51 void dispatchProgressEvent(const AtomicString &type);
commit-queue@webkit.org2cef4ea2011-12-22 08:55:04 +000052
weinig@apple.coma244b912008-07-30 02:39:48 +000053 private:
darin@apple.com49cc03e2016-03-04 17:20:46 +000054 void refEventTarget() final { ref(); }
55 void derefEventTarget() final { deref(); }
weinig@apple.coma244b912008-07-30 02:39:48 +000056
57 XMLHttpRequest* m_xmlHttpRequest;
commit-queue@webkit.orgfceceae2014-01-10 21:22:18 +000058 bool m_lengthComputable;
59 unsigned long long m_loaded;
60 unsigned long long m_total;
weinig@apple.coma244b912008-07-30 02:39:48 +000061 };
62
63} // namespace WebCore