|
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_network_MobileConnectionArray_h__ |
|
8 #define mozilla_dom_network_MobileConnectionArray_h__ |
|
9 |
|
10 #include "nsWrapperCache.h" |
|
11 #include "mozilla/dom/MobileConnection.h" |
|
12 |
|
13 class nsIDOMMozMobileConnection; |
|
14 |
|
15 namespace mozilla { |
|
16 namespace dom { |
|
17 |
|
18 class MobileConnectionArray MOZ_FINAL : public nsISupports, |
|
19 public nsWrapperCache |
|
20 { |
|
21 public: |
|
22 NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
|
23 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MobileConnectionArray) |
|
24 |
|
25 MobileConnectionArray(nsPIDOMWindow* aWindow); |
|
26 |
|
27 nsPIDOMWindow* |
|
28 GetParentObject() const; |
|
29 |
|
30 // WrapperCache |
|
31 virtual JSObject* |
|
32 WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
|
33 |
|
34 // WebIDL |
|
35 nsIDOMMozMobileConnection* |
|
36 Item(uint32_t aIndex); |
|
37 |
|
38 uint32_t |
|
39 Length() const; |
|
40 |
|
41 nsIDOMMozMobileConnection* |
|
42 IndexedGetter(uint32_t aIndex, bool& aFound); |
|
43 |
|
44 private: |
|
45 ~MobileConnectionArray(); |
|
46 |
|
47 void |
|
48 Init(); |
|
49 |
|
50 void |
|
51 DropConnections(); |
|
52 |
|
53 bool mInitialized; |
|
54 |
|
55 nsCOMPtr<nsPIDOMWindow> mWindow; |
|
56 nsTArray<nsRefPtr<MobileConnection>> mMobileConnections; |
|
57 }; |
|
58 |
|
59 } // namespace dom |
|
60 } // namespace mozilla |
|
61 |
|
62 #endif // mozilla_dom_network_MobileConnectionArray_h__ |