Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef mozilla_image_IProgressObserver_h
7 : #define mozilla_image_IProgressObserver_h
8 :
9 : #include "mozilla/WeakPtr.h"
10 : #include "nsISupports.h"
11 : #include "nsRect.h"
12 :
13 : namespace mozilla {
14 : namespace image {
15 :
16 : /**
17 : * An interface for observing changes to image state, as reported by
18 : * ProgressTracker.
19 : *
20 : * This is the ImageLib-internal version of imgINotificationObserver,
21 : * essentially, with implementation details that code outside of ImageLib
22 : * shouldn't see.
23 : *
24 : * XXX(seth): It's preferable to avoid adding anything to this interface if
25 : * possible. In the long term, it would be ideal to get to a place where we can
26 : * just use the imgINotificationObserver interface internally as well.
27 : */
28 137 : class IProgressObserver : public SupportsWeakPtr<IProgressObserver>
29 : {
30 : public:
31 1154 : MOZ_DECLARE_WEAKREFERENCE_TYPENAME(IProgressObserver)
32 :
33 : // Subclasses may or may not be XPCOM classes, so we just require that they
34 : // implement AddRef and Release.
35 : NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
36 :
37 : // imgINotificationObserver methods:
38 : virtual void Notify(int32_t aType, const nsIntRect* aRect = nullptr) = 0;
39 : virtual void OnLoadComplete(bool aLastPart) = 0;
40 :
41 : // imgIOnloadBlocker methods:
42 : virtual void BlockOnload() = 0;
43 : virtual void UnblockOnload() = 0;
44 :
45 : // Other, internal-only methods:
46 : virtual void SetHasImage() = 0;
47 : virtual bool NotificationsDeferred() const = 0;
48 : virtual void SetNotificationsDeferred(bool aDeferNotifications) = 0;
49 :
50 : protected:
51 29 : virtual ~IProgressObserver() { }
52 : };
53 :
54 : } // namespace image
55 : } // namespace mozilla
56 :
57 : #endif // mozilla_image_IProgressObserver_h
|