dom/voicemail/Voicemail.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial