2012-04-19 21:33:25 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_network_MobileConnection_h
|
|
|
|
#define mozilla_dom_network_MobileConnection_h
|
|
|
|
|
|
|
|
#include "nsIDOMMobileConnection.h"
|
2012-04-19 21:33:25 +00:00
|
|
|
#include "nsIMobileConnectionProvider.h"
|
2012-04-19 21:33:25 +00:00
|
|
|
#include "nsDOMEventTargetHelper.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
namespace network {
|
|
|
|
|
|
|
|
class MobileConnection : public nsDOMEventTargetHelper
|
|
|
|
, public nsIDOMMozMobileConnection
|
|
|
|
{
|
2013-03-06 09:53:12 +00:00
|
|
|
/**
|
|
|
|
* Class MobileConnection doesn't actually inherit
|
|
|
|
* nsIMobileConnectionListener. Instead, it owns an
|
|
|
|
* nsIMobileConnectionListener derived instance mListener and passes it to
|
|
|
|
* nsIMobileConnectionProvider. The onreceived events are first delivered to
|
|
|
|
* mListener and then forwarded to its owner, MobileConnection. See also bug
|
|
|
|
* 775997 comment #51.
|
|
|
|
*/
|
|
|
|
class Listener;
|
|
|
|
|
2012-04-19 21:33:25 +00:00
|
|
|
public:
|
2013-03-06 09:53:12 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2012-04-19 21:33:25 +00:00
|
|
|
NS_DECL_NSIDOMMOZMOBILECONNECTION
|
2013-03-06 09:53:12 +00:00
|
|
|
NS_DECL_NSIMOBILECONNECTIONLISTENER
|
2012-04-19 21:33:25 +00:00
|
|
|
|
2013-04-16 21:16:08 +00:00
|
|
|
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper)
|
2012-04-19 21:33:25 +00:00
|
|
|
|
|
|
|
MobileConnection();
|
|
|
|
|
|
|
|
void Init(nsPIDOMWindow *aWindow);
|
|
|
|
void Shutdown();
|
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MobileConnection,
|
|
|
|
nsDOMEventTargetHelper)
|
|
|
|
|
|
|
|
private:
|
2012-04-19 21:33:25 +00:00
|
|
|
nsCOMPtr<nsIMobileConnectionProvider> mProvider;
|
2013-03-06 09:53:12 +00:00
|
|
|
nsRefPtr<Listener> mListener;
|
2013-05-03 01:37:51 +00:00
|
|
|
nsWeakPtr mWindow;
|
|
|
|
|
|
|
|
bool CheckPermission(const char* type);
|
2012-04-19 21:33:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace network
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_network_MobileConnection_h
|