Line data Source code
1 : /* This Source Code Form is subject to the terms of the Mozilla Public
2 : * License, v. 2.0. If a copy of the MPL was not distributed with this
3 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 :
5 : #ifndef mozilla_AlertNotification_h__
6 : #define mozilla_AlertNotification_h__
7 :
8 : #include "imgINotificationObserver.h"
9 : #include "nsIAlertsService.h"
10 : #include "nsCOMPtr.h"
11 : #include "nsCycleCollectionParticipant.h"
12 : #include "nsICancelable.h"
13 : #include "nsIPrincipal.h"
14 : #include "nsString.h"
15 : #include "nsITimer.h"
16 :
17 : namespace mozilla {
18 :
19 : class AlertImageRequest final : public imgINotificationObserver,
20 : public nsICancelable,
21 : public nsITimerCallback
22 : {
23 : public:
24 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
25 0 : NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(AlertImageRequest,
26 : imgINotificationObserver)
27 : NS_DECL_IMGINOTIFICATIONOBSERVER
28 : NS_DECL_NSICANCELABLE
29 : NS_DECL_NSITIMERCALLBACK
30 :
31 : AlertImageRequest(nsIURI* aURI, nsIPrincipal* aPrincipal,
32 : bool aInPrivateBrowsing, uint32_t aTimeout,
33 : nsIAlertNotificationImageListener* aListener,
34 : nsISupports* aUserData);
35 :
36 : nsresult Start();
37 :
38 : private:
39 : virtual ~AlertImageRequest();
40 :
41 : nsresult NotifyMissing();
42 : nsresult NotifyComplete();
43 :
44 : nsCOMPtr<nsIURI> mURI;
45 : nsCOMPtr<nsIPrincipal> mPrincipal;
46 : bool mInPrivateBrowsing;
47 : uint32_t mTimeout;
48 : nsCOMPtr<nsIAlertNotificationImageListener> mListener;
49 : nsCOMPtr<nsISupports> mUserData;
50 : nsCOMPtr<nsITimer> mTimer;
51 : nsCOMPtr<imgIRequest> mRequest;
52 : };
53 :
54 : class AlertNotification final : public nsIAlertNotification
55 : {
56 : public:
57 : NS_DECL_ISUPPORTS
58 : NS_DECL_NSIALERTNOTIFICATION
59 : AlertNotification();
60 :
61 : protected:
62 : virtual ~AlertNotification();
63 :
64 : private:
65 : nsString mName;
66 : nsString mImageURL;
67 : nsString mTitle;
68 : nsString mText;
69 : bool mTextClickable;
70 : nsString mCookie;
71 : nsString mDir;
72 : nsString mLang;
73 : bool mRequireInteraction;
74 : nsString mData;
75 : nsCOMPtr<nsIPrincipal> mPrincipal;
76 : bool mInPrivateBrowsing;
77 : };
78 :
79 : } // namespace mozilla
80 :
81 : #endif /* mozilla_AlertNotification_h__ */
|