|
1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ |
|
2 /* vim: set ts=2 et sw=2 tw=40: */ |
|
3 /* Copyright 2012 Mozilla Foundation and Mozilla contributors |
|
4 * |
|
5 * Licensed under the Apache License, Version 2.0 (the "License"); |
|
6 * you may not use this file except in compliance with the License. |
|
7 * You may obtain a copy of the License at |
|
8 * |
|
9 * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 * |
|
11 * Unless required by applicable law or agreed to in writing, software |
|
12 * distributed under the License is distributed on an "AS IS" BASIS, |
|
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 * See the License for the specific language governing permissions and |
|
15 * limitations under the License. |
|
16 */ |
|
17 |
|
18 #ifndef mozilla_dom_system_b2g_systemworkermanager_h__ |
|
19 #define mozilla_dom_system_b2g_systemworkermanager_h__ |
|
20 |
|
21 #include "nsIInterfaceRequestor.h" |
|
22 #include "nsISystemWorkerManager.h" |
|
23 #include "nsIObserver.h" |
|
24 #include "nsAutoPtr.h" |
|
25 #include "nsCOMPtr.h" |
|
26 #include "nsXULAppAPI.h" // For XRE_GetProcessType |
|
27 |
|
28 class nsIWorkerHolder; |
|
29 |
|
30 namespace mozilla { |
|
31 |
|
32 namespace ipc { |
|
33 class KeyStore; |
|
34 } |
|
35 |
|
36 namespace dom { |
|
37 namespace gonk { |
|
38 |
|
39 class SystemWorkerManager : public nsIObserver, |
|
40 public nsIInterfaceRequestor, |
|
41 public nsISystemWorkerManager |
|
42 { |
|
43 public: |
|
44 NS_DECL_ISUPPORTS |
|
45 NS_DECL_NSIOBSERVER |
|
46 NS_DECL_NSIINTERFACEREQUESTOR |
|
47 NS_DECL_NSISYSTEMWORKERMANAGER |
|
48 |
|
49 nsresult Init(); |
|
50 void Shutdown(); |
|
51 |
|
52 static already_AddRefed<SystemWorkerManager> |
|
53 FactoryCreate(); |
|
54 |
|
55 static nsIInterfaceRequestor* |
|
56 GetInterfaceRequestor(); |
|
57 |
|
58 private: |
|
59 SystemWorkerManager(); |
|
60 ~SystemWorkerManager(); |
|
61 |
|
62 nsresult InitWifi(JSContext *cx); |
|
63 nsresult InitKeyStore(JSContext *cx); |
|
64 |
|
65 nsCOMPtr<nsIWorkerHolder> mWifiWorker; |
|
66 |
|
67 nsRefPtr<ipc::KeyStore> mKeyStore; |
|
68 |
|
69 bool mShutdown; |
|
70 }; |
|
71 |
|
72 } |
|
73 } |
|
74 } |
|
75 |
|
76 #endif // mozilla_dom_system_b2g_systemworkermanager_h__ |