2014-09-21 22:34:00 -07: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-14 23:50:00 -07:00
|
|
|
#include "mozilla/dom/Promise.h"
|
|
|
|
#include "nsJSUtils.h"
|
2014-09-21 22:34:00 -07:00
|
|
|
|
|
|
|
using namespace mozilla::dom;
|
|
|
|
using namespace mozilla::dom::telephony;
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS(TelephonyCallback, nsITelephonyCallback)
|
|
|
|
|
2014-10-14 23:50:00 -07:00
|
|
|
TelephonyCallback::TelephonyCallback(Promise* aPromise)
|
|
|
|
: mPromise(aPromise)
|
2014-09-21 22:34:00 -07:00
|
|
|
{
|
2014-09-21 22:35:00 -07:00
|
|
|
}
|
|
|
|
|
2014-09-21 22:34:00 -07:00
|
|
|
// nsITelephonyCallback
|
|
|
|
|
2014-09-21 22:35:00 -07:00
|
|
|
NS_IMETHODIMP
|
2014-10-14 23:50:00 -07:00
|
|
|
TelephonyCallback::NotifySuccess()
|
2014-09-21 22:35:00 -07:00
|
|
|
{
|
2014-10-14 23:50:00 -07:00
|
|
|
mPromise->MaybeResolve(JS::UndefinedHandleValue);
|
2014-09-21 22:35:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-09-21 22:34:00 -07:00
|
|
|
NS_IMETHODIMP
|
2014-10-14 23:50:00 -07:00
|
|
|
TelephonyCallback::NotifyError(const nsAString& aError)
|
2014-09-21 22:34:00 -07:00
|
|
|
{
|
|
|
|
mPromise->MaybeRejectBrokenly(aError);
|
|
|
|
return NS_OK;
|
|
|
|
}
|