|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef mozilla_dom_mobilemessage_MobileMessageManager_h |
|
7 #define mozilla_dom_mobilemessage_MobileMessageManager_h |
|
8 |
|
9 #include "mozilla/DOMEventTargetHelper.h" |
|
10 #include "nsIDOMMobileMessageManager.h" |
|
11 #include "nsIObserver.h" |
|
12 |
|
13 class nsIDOMMozSmsMessage; |
|
14 class nsIDOMMozMmsMessage; |
|
15 |
|
16 namespace mozilla { |
|
17 namespace dom { |
|
18 |
|
19 class MobileMessageManager : public DOMEventTargetHelper |
|
20 , public nsIDOMMozMobileMessageManager |
|
21 , public nsIObserver |
|
22 { |
|
23 public: |
|
24 NS_DECL_ISUPPORTS_INHERITED |
|
25 NS_DECL_NSIOBSERVER |
|
26 NS_DECL_NSIDOMMOZMOBILEMESSAGEMANAGER |
|
27 |
|
28 NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper) |
|
29 |
|
30 void Init(nsPIDOMWindow *aWindow); |
|
31 void Shutdown(); |
|
32 |
|
33 private: |
|
34 /** |
|
35 * Internal Send() method used to send one message. |
|
36 */ |
|
37 nsresult Send(JSContext* aCx, JS::Handle<JSObject*> aGlobal, |
|
38 uint32_t aServiceId, |
|
39 JS::Handle<JSString*> aNumber, |
|
40 const nsAString& aMessage, |
|
41 JS::Value* aRequest); |
|
42 |
|
43 nsresult DispatchTrustedSmsEventToSelf(const char* aTopic, |
|
44 const nsAString& aEventName, |
|
45 nsISupports* aMsg); |
|
46 |
|
47 /** |
|
48 * Helper to get message ID from SMS/MMS Message object |
|
49 */ |
|
50 nsresult GetMessageId(JSContext* aCx, const JS::Value& aMessage, |
|
51 int32_t* aId); |
|
52 }; |
|
53 |
|
54 } // namespace dom |
|
55 } // namespace mozilla |
|
56 |
|
57 #endif // mozilla_dom_mobilemessage_MobileMessageManager_h |