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.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "SmsMessage.h" |
michael@0 | 6 | #include "MmsMessage.h" |
michael@0 | 7 | #include "MobileMessageThread.h" |
michael@0 | 8 | #include "MobileMessageService.h" |
michael@0 | 9 | #include "SmsSegmentInfo.h" |
michael@0 | 10 | |
michael@0 | 11 | namespace mozilla { |
michael@0 | 12 | namespace dom { |
michael@0 | 13 | namespace mobilemessage { |
michael@0 | 14 | |
michael@0 | 15 | NS_IMPL_ISUPPORTS(MobileMessageService, nsIMobileMessageService) |
michael@0 | 16 | |
michael@0 | 17 | /* static */ StaticRefPtr<MobileMessageService> MobileMessageService::sSingleton; |
michael@0 | 18 | |
michael@0 | 19 | /* static */ already_AddRefed<MobileMessageService> |
michael@0 | 20 | MobileMessageService::GetInstance() |
michael@0 | 21 | { |
michael@0 | 22 | if (!sSingleton) { |
michael@0 | 23 | sSingleton = new MobileMessageService(); |
michael@0 | 24 | ClearOnShutdown(&sSingleton); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | nsRefPtr<MobileMessageService> service = sSingleton.get(); |
michael@0 | 28 | return service.forget(); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | NS_IMETHODIMP |
michael@0 | 32 | MobileMessageService::CreateSmsMessage(int32_t aId, |
michael@0 | 33 | uint64_t aThreadId, |
michael@0 | 34 | const nsAString& aIccId, |
michael@0 | 35 | const nsAString& aDelivery, |
michael@0 | 36 | const nsAString& aDeliveryStatus, |
michael@0 | 37 | const nsAString& aSender, |
michael@0 | 38 | const nsAString& aReceiver, |
michael@0 | 39 | const nsAString& aBody, |
michael@0 | 40 | const nsAString& aMessageClass, |
michael@0 | 41 | uint64_t aTimestamp, |
michael@0 | 42 | uint64_t aSentTimestamp, |
michael@0 | 43 | uint64_t aDeliveryTimestamp, |
michael@0 | 44 | bool aRead, |
michael@0 | 45 | JSContext* aCx, |
michael@0 | 46 | nsIDOMMozSmsMessage** aMessage) |
michael@0 | 47 | { |
michael@0 | 48 | return SmsMessage::Create(aId, |
michael@0 | 49 | aThreadId, |
michael@0 | 50 | aIccId, |
michael@0 | 51 | aDelivery, |
michael@0 | 52 | aDeliveryStatus, |
michael@0 | 53 | aSender, |
michael@0 | 54 | aReceiver, |
michael@0 | 55 | aBody, |
michael@0 | 56 | aMessageClass, |
michael@0 | 57 | aTimestamp, |
michael@0 | 58 | aSentTimestamp, |
michael@0 | 59 | aDeliveryTimestamp, |
michael@0 | 60 | aRead, |
michael@0 | 61 | aCx, |
michael@0 | 62 | aMessage); |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | NS_IMETHODIMP |
michael@0 | 66 | MobileMessageService::CreateMmsMessage(int32_t aId, |
michael@0 | 67 | uint64_t aThreadId, |
michael@0 | 68 | const nsAString& aIccId, |
michael@0 | 69 | const nsAString& aDelivery, |
michael@0 | 70 | JS::Handle<JS::Value> aDeliveryInfo, |
michael@0 | 71 | const nsAString& aSender, |
michael@0 | 72 | JS::Handle<JS::Value> aReceivers, |
michael@0 | 73 | uint64_t aTimestamp, |
michael@0 | 74 | uint64_t aSentTimestamp, |
michael@0 | 75 | bool aRead, |
michael@0 | 76 | const nsAString& aSubject, |
michael@0 | 77 | const nsAString& aSmil, |
michael@0 | 78 | JS::Handle<JS::Value> aAttachments, |
michael@0 | 79 | uint64_t aExpiryDate, |
michael@0 | 80 | bool aReadReportRequested, |
michael@0 | 81 | JSContext* aCx, |
michael@0 | 82 | nsIDOMMozMmsMessage** aMessage) |
michael@0 | 83 | { |
michael@0 | 84 | return MmsMessage::Create(aId, |
michael@0 | 85 | aThreadId, |
michael@0 | 86 | aIccId, |
michael@0 | 87 | aDelivery, |
michael@0 | 88 | aDeliveryInfo, |
michael@0 | 89 | aSender, |
michael@0 | 90 | aReceivers, |
michael@0 | 91 | aTimestamp, |
michael@0 | 92 | aSentTimestamp, |
michael@0 | 93 | aRead, |
michael@0 | 94 | aSubject, |
michael@0 | 95 | aSmil, |
michael@0 | 96 | aAttachments, |
michael@0 | 97 | aExpiryDate, |
michael@0 | 98 | aReadReportRequested, |
michael@0 | 99 | aCx, |
michael@0 | 100 | aMessage); |
michael@0 | 101 | } |
michael@0 | 102 | |
michael@0 | 103 | NS_IMETHODIMP |
michael@0 | 104 | MobileMessageService::CreateSmsSegmentInfo(int32_t aSegments, |
michael@0 | 105 | int32_t aCharsPerSegment, |
michael@0 | 106 | int32_t aCharsAvailableInLastSegment, |
michael@0 | 107 | nsIDOMMozSmsSegmentInfo** aSegmentInfo) |
michael@0 | 108 | { |
michael@0 | 109 | nsCOMPtr<nsIDOMMozSmsSegmentInfo> info = |
michael@0 | 110 | new SmsSegmentInfo(aSegments, aCharsPerSegment, aCharsAvailableInLastSegment); |
michael@0 | 111 | info.forget(aSegmentInfo); |
michael@0 | 112 | return NS_OK; |
michael@0 | 113 | } |
michael@0 | 114 | |
michael@0 | 115 | NS_IMETHODIMP |
michael@0 | 116 | MobileMessageService::CreateThread(uint64_t aId, |
michael@0 | 117 | JS::Handle<JS::Value> aParticipants, |
michael@0 | 118 | uint64_t aTimestamp, |
michael@0 | 119 | const nsAString& aLastMessageSubject, |
michael@0 | 120 | const nsAString& aBody, |
michael@0 | 121 | uint64_t aUnreadCount, |
michael@0 | 122 | const nsAString& aLastMessageType, |
michael@0 | 123 | JSContext* aCx, |
michael@0 | 124 | nsIDOMMozMobileMessageThread** aThread) |
michael@0 | 125 | { |
michael@0 | 126 | return MobileMessageThread::Create(aId, |
michael@0 | 127 | aParticipants, |
michael@0 | 128 | aTimestamp, |
michael@0 | 129 | aLastMessageSubject, |
michael@0 | 130 | aBody, |
michael@0 | 131 | aUnreadCount, |
michael@0 | 132 | aLastMessageType, |
michael@0 | 133 | aCx, |
michael@0 | 134 | aThread); |
michael@0 | 135 | } |
michael@0 | 136 | |
michael@0 | 137 | } // namespace mobilemessage |
michael@0 | 138 | } // namespace dom |
michael@0 | 139 | } // namespace mozilla |