dom/mobileconnection/src/MobileConnectionArray.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/mobileconnection/src/MobileConnectionArray.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set ts=8 sts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef mozilla_dom_network_MobileConnectionArray_h__
    1.11 +#define mozilla_dom_network_MobileConnectionArray_h__
    1.12 +
    1.13 +#include "nsWrapperCache.h"
    1.14 +#include "mozilla/dom/MobileConnection.h"
    1.15 +
    1.16 +class nsIDOMMozMobileConnection;
    1.17 +
    1.18 +namespace mozilla {
    1.19 +namespace dom {
    1.20 +
    1.21 +class MobileConnectionArray MOZ_FINAL : public nsISupports,
    1.22 +                                        public nsWrapperCache
    1.23 +{
    1.24 +public:
    1.25 +  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    1.26 +  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MobileConnectionArray)
    1.27 +
    1.28 +  MobileConnectionArray(nsPIDOMWindow* aWindow);
    1.29 +
    1.30 +  nsPIDOMWindow*
    1.31 +  GetParentObject() const;
    1.32 +
    1.33 +  // WrapperCache
    1.34 +  virtual JSObject*
    1.35 +  WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    1.36 +
    1.37 +  //  WebIDL
    1.38 +  nsIDOMMozMobileConnection*
    1.39 +  Item(uint32_t aIndex);
    1.40 +
    1.41 +  uint32_t
    1.42 +  Length() const;
    1.43 +
    1.44 +  nsIDOMMozMobileConnection*
    1.45 +  IndexedGetter(uint32_t aIndex, bool& aFound);
    1.46 +
    1.47 +private:
    1.48 +  ~MobileConnectionArray();
    1.49 +
    1.50 +  void
    1.51 +  Init();
    1.52 +
    1.53 +  void
    1.54 +  DropConnections();
    1.55 +
    1.56 +  bool mInitialized;
    1.57 +
    1.58 +  nsCOMPtr<nsPIDOMWindow> mWindow;
    1.59 +  nsTArray<nsRefPtr<MobileConnection>> mMobileConnections;
    1.60 +};
    1.61 +
    1.62 +} // namespace dom
    1.63 +} // namespace mozilla
    1.64 +
    1.65 +#endif // mozilla_dom_network_MobileConnectionArray_h__

mercurial