Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++ tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 4 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "mozilla/dom/telephony/TelephonyParent.h" |
michael@0 | 7 | #include "nsServiceManagerUtils.h" |
michael@0 | 8 | |
michael@0 | 9 | USING_TELEPHONY_NAMESPACE |
michael@0 | 10 | |
michael@0 | 11 | /******************************************************************************* |
michael@0 | 12 | * TelephonyParent |
michael@0 | 13 | ******************************************************************************/ |
michael@0 | 14 | |
michael@0 | 15 | NS_IMPL_ISUPPORTS(TelephonyParent, nsITelephonyListener) |
michael@0 | 16 | |
michael@0 | 17 | TelephonyParent::TelephonyParent() |
michael@0 | 18 | : mActorDestroyed(false) |
michael@0 | 19 | , mRegistered(false) |
michael@0 | 20 | { |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | void |
michael@0 | 24 | TelephonyParent::ActorDestroy(ActorDestroyReason why) |
michael@0 | 25 | { |
michael@0 | 26 | // The child process could die before this asynchronous notification, in which |
michael@0 | 27 | // case ActorDestroy() was called and mActorDestroyed is set to true. Return |
michael@0 | 28 | // an error here to avoid sending a message to the dead process. |
michael@0 | 29 | mActorDestroyed = true; |
michael@0 | 30 | |
michael@0 | 31 | // Try to unregister listener if we're still registered. |
michael@0 | 32 | RecvUnregisterListener(); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | bool |
michael@0 | 36 | TelephonyParent::RecvPTelephonyRequestConstructor(PTelephonyRequestParent* aActor, |
michael@0 | 37 | const IPCTelephonyRequest& aRequest) |
michael@0 | 38 | { |
michael@0 | 39 | TelephonyRequestParent* actor = static_cast<TelephonyRequestParent*>(aActor); |
michael@0 | 40 | |
michael@0 | 41 | switch (aRequest.type()) { |
michael@0 | 42 | case IPCTelephonyRequest::TEnumerateCallsRequest: |
michael@0 | 43 | return actor->DoRequest(aRequest.get_EnumerateCallsRequest()); |
michael@0 | 44 | case IPCTelephonyRequest::TDialRequest: |
michael@0 | 45 | return actor->DoRequest(aRequest.get_DialRequest()); |
michael@0 | 46 | default: |
michael@0 | 47 | MOZ_CRASH("Unknown type!"); |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | return false; |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | PTelephonyRequestParent* |
michael@0 | 54 | TelephonyParent::AllocPTelephonyRequestParent(const IPCTelephonyRequest& aRequest) |
michael@0 | 55 | { |
michael@0 | 56 | TelephonyRequestParent* actor = new TelephonyRequestParent(); |
michael@0 | 57 | // Add an extra ref for IPDL. Will be released in |
michael@0 | 58 | // TelephonyParent::DeallocPTelephonyRequestParent(). |
michael@0 | 59 | NS_ADDREF(actor); |
michael@0 | 60 | |
michael@0 | 61 | return actor; |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | bool |
michael@0 | 65 | TelephonyParent::DeallocPTelephonyRequestParent(PTelephonyRequestParent* aActor) |
michael@0 | 66 | { |
michael@0 | 67 | // TelephonyRequestParent is refcounted, must not be freed manually. |
michael@0 | 68 | static_cast<TelephonyRequestParent*>(aActor)->Release(); |
michael@0 | 69 | return true; |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | bool |
michael@0 | 73 | TelephonyParent::Recv__delete__() |
michael@0 | 74 | { |
michael@0 | 75 | return true; // Unregister listener in TelephonyParent::ActorDestroy(). |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | bool |
michael@0 | 79 | TelephonyParent::RecvRegisterListener() |
michael@0 | 80 | { |
michael@0 | 81 | NS_ENSURE_TRUE(!mRegistered, true); |
michael@0 | 82 | |
michael@0 | 83 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 84 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 85 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 86 | |
michael@0 | 87 | mRegistered = NS_SUCCEEDED(provider->RegisterListener(this)); |
michael@0 | 88 | return true; |
michael@0 | 89 | } |
michael@0 | 90 | |
michael@0 | 91 | bool |
michael@0 | 92 | TelephonyParent::RecvUnregisterListener() |
michael@0 | 93 | { |
michael@0 | 94 | NS_ENSURE_TRUE(mRegistered, true); |
michael@0 | 95 | |
michael@0 | 96 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 97 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 98 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 99 | |
michael@0 | 100 | mRegistered = !NS_SUCCEEDED(provider->UnregisterListener(this)); |
michael@0 | 101 | return true; |
michael@0 | 102 | } |
michael@0 | 103 | |
michael@0 | 104 | bool |
michael@0 | 105 | TelephonyParent::RecvHangUpCall(const uint32_t& aClientId, |
michael@0 | 106 | const uint32_t& aCallIndex) |
michael@0 | 107 | { |
michael@0 | 108 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 109 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 110 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 111 | |
michael@0 | 112 | provider->HangUp(aClientId, aCallIndex); |
michael@0 | 113 | return true; |
michael@0 | 114 | } |
michael@0 | 115 | |
michael@0 | 116 | bool |
michael@0 | 117 | TelephonyParent::RecvAnswerCall(const uint32_t& aClientId, |
michael@0 | 118 | const uint32_t& aCallIndex) |
michael@0 | 119 | { |
michael@0 | 120 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 121 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 122 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 123 | |
michael@0 | 124 | provider->AnswerCall(aClientId, aCallIndex); |
michael@0 | 125 | return true; |
michael@0 | 126 | } |
michael@0 | 127 | |
michael@0 | 128 | bool |
michael@0 | 129 | TelephonyParent::RecvRejectCall(const uint32_t& aClientId, |
michael@0 | 130 | const uint32_t& aCallIndex) |
michael@0 | 131 | { |
michael@0 | 132 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 133 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 134 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 135 | |
michael@0 | 136 | provider->RejectCall(aClientId, aCallIndex); |
michael@0 | 137 | return true; |
michael@0 | 138 | } |
michael@0 | 139 | |
michael@0 | 140 | bool |
michael@0 | 141 | TelephonyParent::RecvHoldCall(const uint32_t& aClientId, |
michael@0 | 142 | const uint32_t& aCallIndex) |
michael@0 | 143 | { |
michael@0 | 144 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 145 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 146 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 147 | |
michael@0 | 148 | provider->HoldCall(aClientId, aCallIndex); |
michael@0 | 149 | return true; |
michael@0 | 150 | } |
michael@0 | 151 | |
michael@0 | 152 | bool |
michael@0 | 153 | TelephonyParent::RecvResumeCall(const uint32_t& aClientId, |
michael@0 | 154 | const uint32_t& aCallIndex) |
michael@0 | 155 | { |
michael@0 | 156 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 157 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 158 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 159 | |
michael@0 | 160 | provider->ResumeCall(aClientId, aCallIndex); |
michael@0 | 161 | return true; |
michael@0 | 162 | } |
michael@0 | 163 | |
michael@0 | 164 | bool |
michael@0 | 165 | TelephonyParent::RecvConferenceCall(const uint32_t& aClientId) |
michael@0 | 166 | { |
michael@0 | 167 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 168 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 169 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 170 | |
michael@0 | 171 | provider->ConferenceCall(aClientId); |
michael@0 | 172 | return true; |
michael@0 | 173 | } |
michael@0 | 174 | |
michael@0 | 175 | bool |
michael@0 | 176 | TelephonyParent::RecvSeparateCall(const uint32_t& aClientId, |
michael@0 | 177 | const uint32_t& aCallIndex) |
michael@0 | 178 | { |
michael@0 | 179 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 180 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 181 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 182 | |
michael@0 | 183 | provider->SeparateCall(aClientId, aCallIndex); |
michael@0 | 184 | return true; |
michael@0 | 185 | } |
michael@0 | 186 | |
michael@0 | 187 | bool |
michael@0 | 188 | TelephonyParent::RecvHoldConference(const uint32_t& aClientId) |
michael@0 | 189 | { |
michael@0 | 190 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 191 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 192 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 193 | |
michael@0 | 194 | provider->HoldConference(aClientId); |
michael@0 | 195 | return true; |
michael@0 | 196 | } |
michael@0 | 197 | |
michael@0 | 198 | bool |
michael@0 | 199 | TelephonyParent::RecvResumeConference(const uint32_t& aClientId) |
michael@0 | 200 | { |
michael@0 | 201 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 202 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 203 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 204 | |
michael@0 | 205 | provider->ResumeConference(aClientId); |
michael@0 | 206 | return true; |
michael@0 | 207 | } |
michael@0 | 208 | |
michael@0 | 209 | bool |
michael@0 | 210 | TelephonyParent::RecvStartTone(const uint32_t& aClientId, const nsString& aTone) |
michael@0 | 211 | { |
michael@0 | 212 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 213 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 214 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 215 | |
michael@0 | 216 | provider->StartTone(aClientId, aTone); |
michael@0 | 217 | return true; |
michael@0 | 218 | } |
michael@0 | 219 | |
michael@0 | 220 | bool |
michael@0 | 221 | TelephonyParent::RecvStopTone(const uint32_t& aClientId) |
michael@0 | 222 | { |
michael@0 | 223 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 224 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 225 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 226 | |
michael@0 | 227 | provider->StopTone(aClientId); |
michael@0 | 228 | return true; |
michael@0 | 229 | } |
michael@0 | 230 | |
michael@0 | 231 | bool |
michael@0 | 232 | TelephonyParent::RecvGetMicrophoneMuted(bool* aMuted) |
michael@0 | 233 | { |
michael@0 | 234 | *aMuted = false; |
michael@0 | 235 | |
michael@0 | 236 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 237 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 238 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 239 | |
michael@0 | 240 | provider->GetMicrophoneMuted(aMuted); |
michael@0 | 241 | return true; |
michael@0 | 242 | } |
michael@0 | 243 | |
michael@0 | 244 | bool |
michael@0 | 245 | TelephonyParent::RecvSetMicrophoneMuted(const bool& aMuted) |
michael@0 | 246 | { |
michael@0 | 247 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 248 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 249 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 250 | |
michael@0 | 251 | provider->SetMicrophoneMuted(aMuted); |
michael@0 | 252 | return true; |
michael@0 | 253 | } |
michael@0 | 254 | |
michael@0 | 255 | bool |
michael@0 | 256 | TelephonyParent::RecvGetSpeakerEnabled(bool* aEnabled) |
michael@0 | 257 | { |
michael@0 | 258 | *aEnabled = false; |
michael@0 | 259 | |
michael@0 | 260 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 261 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 262 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 263 | |
michael@0 | 264 | provider->GetSpeakerEnabled(aEnabled); |
michael@0 | 265 | return true; |
michael@0 | 266 | } |
michael@0 | 267 | |
michael@0 | 268 | bool |
michael@0 | 269 | TelephonyParent::RecvSetSpeakerEnabled(const bool& aEnabled) |
michael@0 | 270 | { |
michael@0 | 271 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 272 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 273 | NS_ENSURE_TRUE(provider, true); |
michael@0 | 274 | |
michael@0 | 275 | provider->SetSpeakerEnabled(aEnabled); |
michael@0 | 276 | return true; |
michael@0 | 277 | } |
michael@0 | 278 | |
michael@0 | 279 | // nsITelephonyListener |
michael@0 | 280 | |
michael@0 | 281 | NS_IMETHODIMP |
michael@0 | 282 | TelephonyParent::CallStateChanged(uint32_t aClientId, |
michael@0 | 283 | uint32_t aCallIndex, |
michael@0 | 284 | uint16_t aCallState, |
michael@0 | 285 | const nsAString& aNumber, |
michael@0 | 286 | bool aIsActive, |
michael@0 | 287 | bool aIsOutgoing, |
michael@0 | 288 | bool aIsEmergency, |
michael@0 | 289 | bool aIsConference, |
michael@0 | 290 | bool aIsSwitchable, |
michael@0 | 291 | bool aIsMergeable) |
michael@0 | 292 | { |
michael@0 | 293 | NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE); |
michael@0 | 294 | |
michael@0 | 295 | IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber), |
michael@0 | 296 | aIsActive, aIsOutgoing, aIsEmergency, aIsConference, |
michael@0 | 297 | aIsSwitchable, aIsMergeable); |
michael@0 | 298 | return SendNotifyCallStateChanged(aClientId, data) ? NS_OK : NS_ERROR_FAILURE; |
michael@0 | 299 | } |
michael@0 | 300 | |
michael@0 | 301 | NS_IMETHODIMP |
michael@0 | 302 | TelephonyParent::ConferenceCallStateChanged(uint16_t aCallState) |
michael@0 | 303 | { |
michael@0 | 304 | NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE); |
michael@0 | 305 | |
michael@0 | 306 | return SendNotifyConferenceCallStateChanged(aCallState) ? NS_OK |
michael@0 | 307 | : NS_ERROR_FAILURE; |
michael@0 | 308 | } |
michael@0 | 309 | |
michael@0 | 310 | NS_IMETHODIMP |
michael@0 | 311 | TelephonyParent::EnumerateCallStateComplete() |
michael@0 | 312 | { |
michael@0 | 313 | MOZ_CRASH("Not a EnumerateCalls request!"); |
michael@0 | 314 | } |
michael@0 | 315 | |
michael@0 | 316 | NS_IMETHODIMP |
michael@0 | 317 | TelephonyParent::EnumerateCallState(uint32_t aClientId, |
michael@0 | 318 | uint32_t aCallIndex, |
michael@0 | 319 | uint16_t aCallState, |
michael@0 | 320 | const nsAString& aNumber, |
michael@0 | 321 | bool aIsActive, |
michael@0 | 322 | bool aIsOutgoing, |
michael@0 | 323 | bool aIsEmergency, |
michael@0 | 324 | bool aIsConference, |
michael@0 | 325 | bool aIsSwitchable, |
michael@0 | 326 | bool aIsMergeable) |
michael@0 | 327 | { |
michael@0 | 328 | MOZ_CRASH("Not a EnumerateCalls request!"); |
michael@0 | 329 | } |
michael@0 | 330 | |
michael@0 | 331 | NS_IMETHODIMP |
michael@0 | 332 | TelephonyParent::NotifyCdmaCallWaiting(uint32_t aClientId, |
michael@0 | 333 | const nsAString& aNumber) |
michael@0 | 334 | { |
michael@0 | 335 | NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE); |
michael@0 | 336 | |
michael@0 | 337 | return SendNotifyCdmaCallWaiting(aClientId, nsString(aNumber)) |
michael@0 | 338 | ? NS_OK : NS_ERROR_FAILURE; |
michael@0 | 339 | } |
michael@0 | 340 | |
michael@0 | 341 | NS_IMETHODIMP |
michael@0 | 342 | TelephonyParent::NotifyConferenceError(const nsAString& aName, |
michael@0 | 343 | const nsAString& aMessage) |
michael@0 | 344 | { |
michael@0 | 345 | NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE); |
michael@0 | 346 | |
michael@0 | 347 | return SendNotifyConferenceError(nsString(aName), nsString(aMessage)) ? NS_OK |
michael@0 | 348 | : NS_ERROR_FAILURE; |
michael@0 | 349 | } |
michael@0 | 350 | |
michael@0 | 351 | NS_IMETHODIMP |
michael@0 | 352 | TelephonyParent::NotifyError(uint32_t aClientId, |
michael@0 | 353 | int32_t aCallIndex, |
michael@0 | 354 | const nsAString& aError) |
michael@0 | 355 | { |
michael@0 | 356 | NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE); |
michael@0 | 357 | |
michael@0 | 358 | return SendNotifyCallError(aClientId, aCallIndex, nsString(aError)) |
michael@0 | 359 | ? NS_OK : NS_ERROR_FAILURE; |
michael@0 | 360 | } |
michael@0 | 361 | |
michael@0 | 362 | NS_IMETHODIMP |
michael@0 | 363 | TelephonyParent::SupplementaryServiceNotification(uint32_t aClientId, |
michael@0 | 364 | int32_t aCallIndex, |
michael@0 | 365 | uint16_t aNotification) |
michael@0 | 366 | { |
michael@0 | 367 | NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE); |
michael@0 | 368 | |
michael@0 | 369 | return SendNotifySupplementaryService(aClientId, aCallIndex, aNotification) |
michael@0 | 370 | ? NS_OK : NS_ERROR_FAILURE; |
michael@0 | 371 | } |
michael@0 | 372 | |
michael@0 | 373 | /******************************************************************************* |
michael@0 | 374 | * TelephonyRequestParent |
michael@0 | 375 | ******************************************************************************/ |
michael@0 | 376 | |
michael@0 | 377 | NS_IMPL_ISUPPORTS(TelephonyRequestParent, |
michael@0 | 378 | nsITelephonyListener, |
michael@0 | 379 | nsITelephonyCallback) |
michael@0 | 380 | |
michael@0 | 381 | TelephonyRequestParent::TelephonyRequestParent() |
michael@0 | 382 | : mActorDestroyed(false) |
michael@0 | 383 | { |
michael@0 | 384 | } |
michael@0 | 385 | |
michael@0 | 386 | void |
michael@0 | 387 | TelephonyRequestParent::ActorDestroy(ActorDestroyReason why) |
michael@0 | 388 | { |
michael@0 | 389 | // The child process could die before this asynchronous notification, in which |
michael@0 | 390 | // case ActorDestroy() was called and mActorDestroyed is set to true. Return |
michael@0 | 391 | // an error here to avoid sending a message to the dead process. |
michael@0 | 392 | mActorDestroyed = true; |
michael@0 | 393 | } |
michael@0 | 394 | |
michael@0 | 395 | bool |
michael@0 | 396 | TelephonyRequestParent::DoRequest(const EnumerateCallsRequest& aRequest) |
michael@0 | 397 | { |
michael@0 | 398 | nsresult rv = NS_ERROR_FAILURE; |
michael@0 | 399 | |
michael@0 | 400 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 401 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 402 | if (provider) { |
michael@0 | 403 | rv = provider->EnumerateCalls(this); |
michael@0 | 404 | } |
michael@0 | 405 | |
michael@0 | 406 | if (NS_FAILED(rv)) { |
michael@0 | 407 | return NS_SUCCEEDED(EnumerateCallStateComplete()); |
michael@0 | 408 | } |
michael@0 | 409 | |
michael@0 | 410 | return true; |
michael@0 | 411 | } |
michael@0 | 412 | |
michael@0 | 413 | bool |
michael@0 | 414 | TelephonyRequestParent::DoRequest(const DialRequest& aRequest) |
michael@0 | 415 | { |
michael@0 | 416 | nsCOMPtr<nsITelephonyProvider> provider = |
michael@0 | 417 | do_GetService(TELEPHONY_PROVIDER_CONTRACTID); |
michael@0 | 418 | if (provider) { |
michael@0 | 419 | provider->Dial(aRequest.clientId(), aRequest.number(), |
michael@0 | 420 | aRequest.isEmergency(), this); |
michael@0 | 421 | } else { |
michael@0 | 422 | return NS_SUCCEEDED(NotifyDialError(NS_LITERAL_STRING("InvalidStateError"))); |
michael@0 | 423 | } |
michael@0 | 424 | |
michael@0 | 425 | return true; |
michael@0 | 426 | } |
michael@0 | 427 | |
michael@0 | 428 | // nsITelephonyListener |
michael@0 | 429 | |
michael@0 | 430 | NS_IMETHODIMP |
michael@0 | 431 | TelephonyRequestParent::CallStateChanged(uint32_t aClientId, |
michael@0 | 432 | uint32_t aCallIndex, |
michael@0 | 433 | uint16_t aCallState, |
michael@0 | 434 | const nsAString& aNumber, |
michael@0 | 435 | bool aIsActive, |
michael@0 | 436 | bool aIsOutgoing, |
michael@0 | 437 | bool aIsEmergency, |
michael@0 | 438 | bool aIsConference, |
michael@0 | 439 | bool aIsSwitchable, |
michael@0 | 440 | bool aIsMergeable) |
michael@0 | 441 | { |
michael@0 | 442 | MOZ_CRASH("Not a TelephonyParent!"); |
michael@0 | 443 | } |
michael@0 | 444 | |
michael@0 | 445 | NS_IMETHODIMP |
michael@0 | 446 | TelephonyRequestParent::ConferenceCallStateChanged(uint16_t aCallState) |
michael@0 | 447 | { |
michael@0 | 448 | MOZ_CRASH("Not a TelephonyParent!"); |
michael@0 | 449 | } |
michael@0 | 450 | |
michael@0 | 451 | NS_IMETHODIMP |
michael@0 | 452 | TelephonyRequestParent::EnumerateCallStateComplete() |
michael@0 | 453 | { |
michael@0 | 454 | NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE); |
michael@0 | 455 | |
michael@0 | 456 | return Send__delete__(this, EnumerateCallsResponse()) ? NS_OK : NS_ERROR_FAILURE; |
michael@0 | 457 | } |
michael@0 | 458 | |
michael@0 | 459 | NS_IMETHODIMP |
michael@0 | 460 | TelephonyRequestParent::EnumerateCallState(uint32_t aClientId, |
michael@0 | 461 | uint32_t aCallIndex, |
michael@0 | 462 | uint16_t aCallState, |
michael@0 | 463 | const nsAString& aNumber, |
michael@0 | 464 | bool aIsActive, |
michael@0 | 465 | bool aIsOutgoing, |
michael@0 | 466 | bool aIsEmergency, |
michael@0 | 467 | bool aIsConference, |
michael@0 | 468 | bool aIsSwitchable, |
michael@0 | 469 | bool aIsMergeable) |
michael@0 | 470 | { |
michael@0 | 471 | NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE); |
michael@0 | 472 | |
michael@0 | 473 | IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber), |
michael@0 | 474 | aIsActive, aIsOutgoing, aIsEmergency, aIsConference, |
michael@0 | 475 | aIsSwitchable, aIsMergeable); |
michael@0 | 476 | return SendNotifyEnumerateCallState(aClientId, data) ? NS_OK |
michael@0 | 477 | : NS_ERROR_FAILURE; |
michael@0 | 478 | } |
michael@0 | 479 | |
michael@0 | 480 | NS_IMETHODIMP |
michael@0 | 481 | TelephonyRequestParent::NotifyCdmaCallWaiting(uint32_t aClientId, |
michael@0 | 482 | const nsAString& aNumber) |
michael@0 | 483 | { |
michael@0 | 484 | MOZ_CRASH("Not a TelephonyParent!"); |
michael@0 | 485 | } |
michael@0 | 486 | |
michael@0 | 487 | NS_IMETHODIMP |
michael@0 | 488 | TelephonyRequestParent::NotifyConferenceError(const nsAString& aName, |
michael@0 | 489 | const nsAString& aMessage) |
michael@0 | 490 | { |
michael@0 | 491 | MOZ_CRASH("Not a TelephonyParent!"); |
michael@0 | 492 | } |
michael@0 | 493 | |
michael@0 | 494 | NS_IMETHODIMP |
michael@0 | 495 | TelephonyRequestParent::NotifyError(uint32_t aClientId, |
michael@0 | 496 | int32_t aCallIndex, |
michael@0 | 497 | const nsAString& aError) |
michael@0 | 498 | { |
michael@0 | 499 | MOZ_CRASH("Not a TelephonyParent!"); |
michael@0 | 500 | } |
michael@0 | 501 | |
michael@0 | 502 | NS_IMETHODIMP |
michael@0 | 503 | TelephonyRequestParent::SupplementaryServiceNotification(uint32_t aClientId, |
michael@0 | 504 | int32_t aCallIndex, |
michael@0 | 505 | uint16_t aNotification) |
michael@0 | 506 | { |
michael@0 | 507 | MOZ_CRASH("Not a TelephonyParent!"); |
michael@0 | 508 | } |
michael@0 | 509 | |
michael@0 | 510 | // nsITelephonyCallback |
michael@0 | 511 | |
michael@0 | 512 | NS_IMETHODIMP |
michael@0 | 513 | TelephonyRequestParent::NotifyDialError(const nsAString& aError) |
michael@0 | 514 | { |
michael@0 | 515 | NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE); |
michael@0 | 516 | |
michael@0 | 517 | return (SendNotifyDialError(nsString(aError)) && |
michael@0 | 518 | Send__delete__(this, DialResponse())) ? NS_OK : NS_ERROR_FAILURE; |
michael@0 | 519 | } |
michael@0 | 520 | |
michael@0 | 521 | NS_IMETHODIMP |
michael@0 | 522 | TelephonyRequestParent::NotifyDialSuccess() |
michael@0 | 523 | { |
michael@0 | 524 | NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE); |
michael@0 | 525 | |
michael@0 | 526 | return (SendNotifyDialSuccess() && |
michael@0 | 527 | Send__delete__(this, DialResponse())) ? NS_OK : NS_ERROR_FAILURE; |
michael@0 | 528 | } |