2014-10-14 23:51:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_USSDSession_h
|
|
|
|
#define mozilla_dom_USSDSession_h
|
|
|
|
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
#include "mozilla/dom/BindingDeclarations.h"
|
|
|
|
#include "mozilla/dom/Promise.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsITelephonyService.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
|
|
|
|
struct JSContext;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
class USSDSession final : public nsISupports,
|
2015-03-27 11:52:19 -07:00
|
|
|
public nsWrapperCache
|
2014-10-14 23:51:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(USSDSession)
|
|
|
|
|
|
|
|
USSDSession(nsPIDOMWindow* aWindow, nsITelephonyService* aService,
|
|
|
|
uint32_t aServiceId);
|
|
|
|
|
|
|
|
nsPIDOMWindow*
|
|
|
|
GetParentObject() const;
|
|
|
|
|
|
|
|
virtual JSObject*
|
2015-03-21 09:28:04 -07:00
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2014-10-14 23:51:00 -07:00
|
|
|
|
|
|
|
// WebIDL
|
|
|
|
static already_AddRefed<USSDSession>
|
|
|
|
Constructor(const GlobalObject& aGlobal, uint32_t aServiceId,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
already_AddRefed<Promise>
|
|
|
|
Send(const nsAString& aUssd, ErrorResult& aRv);
|
|
|
|
|
2015-01-06 23:28:44 -08:00
|
|
|
already_AddRefed<Promise>
|
|
|
|
Cancel(ErrorResult& aRv);
|
|
|
|
|
2014-10-14 23:51:00 -07:00
|
|
|
private:
|
|
|
|
~USSDSession();
|
|
|
|
|
2015-01-06 23:28:44 -08:00
|
|
|
already_AddRefed<Promise>
|
|
|
|
CreatePromise(ErrorResult& aRv);
|
|
|
|
|
2014-10-14 23:51:00 -07:00
|
|
|
nsCOMPtr<nsPIDOMWindow> mWindow;
|
|
|
|
nsCOMPtr<nsITelephonyService> mService;
|
|
|
|
uint32_t mServiceId;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_USSDSession_h
|