dom/mobileconnection/src/MobileConnection.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/mobileconnection/src/MobileConnection.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,58 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef mozilla_dom_network_MobileConnection_h
     1.9 +#define mozilla_dom_network_MobileConnection_h
    1.10 +
    1.11 +#include "mozilla/DOMEventTargetHelper.h"
    1.12 +#include "nsIDOMMobileConnection.h"
    1.13 +#include "nsIMobileConnectionProvider.h"
    1.14 +#include "nsCycleCollectionParticipant.h"
    1.15 +#include "nsWeakPtr.h"
    1.16 +
    1.17 +namespace mozilla {
    1.18 +namespace dom {
    1.19 +
    1.20 +class MobileConnection : public DOMEventTargetHelper
    1.21 +                       , public nsIDOMMozMobileConnection
    1.22 +{
    1.23 +  /**
    1.24 +   * Class MobileConnection doesn't actually inherit
    1.25 +   * nsIMobileConnectionListener. Instead, it owns an
    1.26 +   * nsIMobileConnectionListener derived instance mListener and passes it to
    1.27 +   * nsIMobileConnectionProvider. The onreceived events are first delivered to
    1.28 +   * mListener and then forwarded to its owner, MobileConnection. See also bug
    1.29 +   * 775997 comment #51.
    1.30 +   */
    1.31 +  class Listener;
    1.32 +
    1.33 +public:
    1.34 +  NS_DECL_ISUPPORTS_INHERITED
    1.35 +  NS_DECL_NSIDOMMOZMOBILECONNECTION
    1.36 +  NS_DECL_NSIMOBILECONNECTIONLISTENER
    1.37 +
    1.38 +  NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
    1.39 +
    1.40 +  MobileConnection(uint32_t aClientId);
    1.41 +
    1.42 +  void Init(nsPIDOMWindow *aWindow);
    1.43 +  void Shutdown();
    1.44 +
    1.45 +  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MobileConnection,
    1.46 +                                           DOMEventTargetHelper)
    1.47 +
    1.48 +private:
    1.49 +  nsCOMPtr<nsIMobileConnectionProvider> mProvider;
    1.50 +  nsRefPtr<Listener> mListener;
    1.51 +  nsWeakPtr mWindow;
    1.52 +
    1.53 +  uint32_t mClientId;
    1.54 +
    1.55 +  bool CheckPermission(const char* aType);
    1.56 +};
    1.57 +
    1.58 +} // namespace dom
    1.59 +} // namespace mozilla
    1.60 +
    1.61 +#endif // mozilla_dom_network_MobileConnection_h

mercurial