|
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 file, |
|
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #ifndef mozilla_dom_IccManager_h |
|
6 #define mozilla_dom_IccManager_h |
|
7 |
|
8 #include "mozilla/DOMEventTargetHelper.h" |
|
9 #include "nsCycleCollectionParticipant.h" |
|
10 #include "nsIIccProvider.h" |
|
11 #include "nsTArrayHelpers.h" |
|
12 |
|
13 namespace mozilla { |
|
14 namespace dom { |
|
15 |
|
16 class IccListener; |
|
17 |
|
18 class IccManager MOZ_FINAL : public DOMEventTargetHelper |
|
19 { |
|
20 public: |
|
21 NS_DECL_ISUPPORTS_INHERITED |
|
22 |
|
23 NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper) |
|
24 |
|
25 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IccManager, DOMEventTargetHelper) |
|
26 |
|
27 IccManager(nsPIDOMWindow* aWindow); |
|
28 ~IccManager(); |
|
29 |
|
30 void |
|
31 Shutdown(); |
|
32 |
|
33 nsresult |
|
34 NotifyIccAdd(const nsAString& aIccId); |
|
35 |
|
36 nsresult |
|
37 NotifyIccRemove(const nsAString& aIccId); |
|
38 |
|
39 IMPL_EVENT_HANDLER(iccdetected) |
|
40 IMPL_EVENT_HANDLER(iccundetected) |
|
41 |
|
42 void |
|
43 GetIccIds(nsTArray<nsString>& aIccIds); |
|
44 |
|
45 already_AddRefed<nsISupports> |
|
46 GetIccById(const nsAString& aIccId) const; |
|
47 |
|
48 nsPIDOMWindow* |
|
49 GetParentObject() const { return GetOwner(); } |
|
50 |
|
51 virtual JSObject* |
|
52 WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
|
53 |
|
54 private: |
|
55 nsTArray<nsRefPtr<IccListener>> mIccListeners; |
|
56 }; |
|
57 |
|
58 } // namespace dom |
|
59 } // namespace mozilla |
|
60 |
|
61 #endif // mozilla_dom_IccManager_h |