Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_dom_FetchObserver_h
8 : #define mozilla_dom_FetchObserver_h
9 :
10 : #include "mozilla/DOMEventTargetHelper.h"
11 : #include "mozilla/dom/FetchObserverBinding.h"
12 : #include "mozilla/dom/FetchSignal.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : class FetchObserver final : public DOMEventTargetHelper
18 : , public FetchSignal::Follower
19 : {
20 : public:
21 : NS_DECL_ISUPPORTS_INHERITED
22 0 : NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FetchObserver, DOMEventTargetHelper)
23 :
24 : static bool
25 : IsEnabled(JSContext* aCx, JSObject* aGlobal);
26 :
27 : FetchObserver(nsIGlobalObject* aGlobal, FetchSignal* aSignal);
28 :
29 : JSObject*
30 : WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
31 :
32 : FetchState
33 : State() const;
34 :
35 0 : IMPL_EVENT_HANDLER(statechange);
36 0 : IMPL_EVENT_HANDLER(requestprogress);
37 0 : IMPL_EVENT_HANDLER(responseprogress);
38 :
39 : void
40 : Aborted() override;
41 :
42 : void
43 : SetState(FetchState aState);
44 :
45 : private:
46 0 : ~FetchObserver() = default;
47 :
48 : FetchState mState;
49 : };
50 :
51 : } // dom namespace
52 : } // mozilla namespace
53 :
54 : #endif // mozilla_dom_FetchObserver_h
|