dom/voicemail/Voicemail.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     2 /* vim: set ts=2 et sw=2 tw=40: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_dom_voicemail_voicemail_h__
     8 #define mozilla_dom_voicemail_voicemail_h__
    10 #include "mozilla/Attributes.h"
    11 #include "mozilla/DOMEventTargetHelper.h"
    12 #include "mozilla/ErrorResult.h"
    13 #include "nsIVoicemailProvider.h"
    15 class JSObject;
    16 struct JSContext;
    18 class nsPIDOMWindow;
    19 class nsIDOMMozVoicemailStatus;
    21 namespace mozilla {
    22 namespace dom {
    24 class Voicemail MOZ_FINAL : public DOMEventTargetHelper
    25 {
    26   /**
    27    * Class Voicemail doesn't actually inherit nsIVoicemailListener. Instead, it
    28    * owns an nsIVoicemailListener derived instance mListener and passes it to
    29    * nsIVoicemailProvider. The onreceived events are first delivered to
    30    * mListener and then forwarded to its owner, Voicemail. See also bug 775997
    31    * comment #51.
    32    */
    33   class Listener;
    35 public:
    36   NS_DECL_NSIVOICEMAILLISTENER
    38   NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
    40   Voicemail(nsPIDOMWindow* aWindow, nsIVoicemailProvider* aProvider);
    42   virtual ~Voicemail();
    44   nsPIDOMWindow*
    45   GetParentObject() const
    46   {
    47     return GetOwner();
    48   }
    50   virtual JSObject*
    51   WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    53   already_AddRefed<nsIDOMMozVoicemailStatus>
    54   GetStatus(const Optional<uint32_t>& aServiceId, ErrorResult& aRv) const;
    56   void
    57   GetNumber(const Optional<uint32_t>& aServiceId, nsString& aNumber,
    58             ErrorResult& aRv) const;
    60   void
    61   GetDisplayName(const Optional<uint32_t>& aServiceId, nsString& aDisplayName,
    62                  ErrorResult& aRv) const;
    64   IMPL_EVENT_HANDLER(statuschanged)
    66 private:
    67   nsCOMPtr<nsIVoicemailProvider> mProvider;
    68   nsRefPtr<Listener> mListener;
    70   bool
    71   IsValidServiceId(uint32_t aServiceId) const;
    73   bool
    74   PassedOrDefaultServiceId(const Optional<uint32_t>& aServiceId,
    75                            uint32_t& aResult) const;
    76 };
    78 } // namespace dom
    79 } // namespace mozilla
    81 nsresult
    82 NS_NewVoicemail(nsPIDOMWindow* aWindow,
    83                 mozilla::dom::Voicemail** aVoicemail);
    85 #endif // mozilla_dom_voicemail_voicemail_h__

mercurial