Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_dom_network_MobileConnection_h
6 #define mozilla_dom_network_MobileConnection_h
8 #include "mozilla/DOMEventTargetHelper.h"
9 #include "nsIDOMMobileConnection.h"
10 #include "nsIMobileConnectionProvider.h"
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsWeakPtr.h"
14 namespace mozilla {
15 namespace dom {
17 class MobileConnection : public DOMEventTargetHelper
18 , public nsIDOMMozMobileConnection
19 {
20 /**
21 * Class MobileConnection doesn't actually inherit
22 * nsIMobileConnectionListener. Instead, it owns an
23 * nsIMobileConnectionListener derived instance mListener and passes it to
24 * nsIMobileConnectionProvider. The onreceived events are first delivered to
25 * mListener and then forwarded to its owner, MobileConnection. See also bug
26 * 775997 comment #51.
27 */
28 class Listener;
30 public:
31 NS_DECL_ISUPPORTS_INHERITED
32 NS_DECL_NSIDOMMOZMOBILECONNECTION
33 NS_DECL_NSIMOBILECONNECTIONLISTENER
35 NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
37 MobileConnection(uint32_t aClientId);
39 void Init(nsPIDOMWindow *aWindow);
40 void Shutdown();
42 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MobileConnection,
43 DOMEventTargetHelper)
45 private:
46 nsCOMPtr<nsIMobileConnectionProvider> mProvider;
47 nsRefPtr<Listener> mListener;
48 nsWeakPtr mWindow;
50 uint32_t mClientId;
52 bool CheckPermission(const char* aType);
53 };
55 } // namespace dom
56 } // namespace mozilla
58 #endif // mozilla_dom_network_MobileConnection_h