2014-09-22 09:34:00 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "TelephonyCallback.h"
|
|
|
|
|
2014-10-15 10:50:00 +04:00
|
|
|
#include "mozilla/dom/Promise.h"
|
|
|
|
#include "nsJSUtils.h"
|
2014-09-22 09:34:00 +04:00
|
|
|
|
|
|
|
using namespace mozilla::dom;
|
|
|
|
using namespace mozilla::dom::telephony;
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS(TelephonyCallback, nsITelephonyCallback)
|
|
|
|
|
2014-10-15 10:50:00 +04:00
|
|
|
TelephonyCallback::TelephonyCallback(Promise* aPromise)
|
|
|
|
: mPromise(aPromise)
|
2014-09-22 09:34:00 +04:00
|
|
|
{
|
2014-09-22 09:35:00 +04:00
|
|
|
}
|
|
|
|
|
2014-09-22 09:34:00 +04:00
|
|
|
// nsITelephonyCallback
|
|
|
|
|
2014-09-22 09:35:00 +04:00
|
|
|
NS_IMETHODIMP
|
2014-10-15 10:50:00 +04:00
|
|
|
TelephonyCallback::NotifySuccess()
|
2014-09-22 09:35:00 +04:00
|
|
|
{
|
2014-10-15 10:50:00 +04:00
|
|
|
mPromise->MaybeResolve(JS::UndefinedHandleValue);
|
2014-09-22 09:35:00 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-09-22 09:34:00 +04:00
|
|
|
NS_IMETHODIMP
|
2014-10-15 10:50:00 +04:00
|
|
|
TelephonyCallback::NotifyError(const nsAString& aError)
|
2014-09-22 09:34:00 +04:00
|
|
|
{
|
|
|
|
mPromise->MaybeRejectBrokenly(aError);
|
|
|
|
return NS_OK;
|
|
|
|
}
|