Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / mobileconnection / MobileNetworkInfo.h
blob3c6b408248c6c1762e4ed4780bbc9b1f5be052f1
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/. */
7 #ifndef mozilla_dom_MobileNetworkInfo_h
8 #define mozilla_dom_MobileNetworkInfo_h
10 #include "mozilla/dom/MozMobileNetworkInfoBinding.h"
11 #include "nsIMobileNetworkInfo.h"
12 #include "nsPIDOMWindow.h"
13 #include "nsWrapperCache.h"
15 namespace mozilla {
16 namespace dom {
18 class GlobalObject;
20 class MobileNetworkInfo MOZ_FINAL : public nsIMobileNetworkInfo
21 , public nsWrapperCache
23 public:
24 NS_DECL_NSIMOBILENETWORKINFO
25 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
26 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MobileNetworkInfo)
28 MobileNetworkInfo(nsPIDOMWindow* aWindow);
30 void
31 Update(nsIMobileNetworkInfo* aInfo);
33 nsPIDOMWindow*
34 GetParentObject() const
36 return mWindow;
39 virtual JSObject*
40 WrapObject(JSContext* aCx) MOZ_OVERRIDE;
42 // WebIDL interface
43 static already_AddRefed<MobileNetworkInfo>
44 Constructor(const GlobalObject& aGlobal, const nsAString& aShortName,
45 const nsAString& aLongName, const nsAString& aMcc,
46 const nsAString& aMnc, const nsAString& aState,
47 ErrorResult& aRv);
49 Nullable<MobileNetworkState>
50 GetState() const
52 uint32_t i = 0;
53 for (const EnumEntry* entry = MobileNetworkStateValues::strings;
54 entry->value;
55 ++entry, ++i) {
56 if (mState.EqualsASCII(entry->value)) {
57 return Nullable<MobileNetworkState>(static_cast<MobileNetworkState>(i));
61 return Nullable<MobileNetworkState>();
64 private:
65 ~MobileNetworkInfo() {}
67 private:
68 nsCOMPtr<nsPIDOMWindow> mWindow;
69 nsString mShortName;
70 nsString mLongName;
71 nsString mMcc;
72 nsString mMnc;
73 nsString mState;
76 } // namespace dom
77 } // namespace mozilla
79 #endif // mozilla_dom_MobileNetworkInfo_h