dom/fmradio/FMRadio.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef mozilla_dom_FMRadio_h
     7 #define mozilla_dom_FMRadio_h
     9 #include "AudioChannelAgent.h"
    10 #include "FMRadioCommon.h"
    11 #include "mozilla/DOMEventTargetHelper.h"
    12 #include "mozilla/HalTypes.h"
    13 #include "nsCycleCollectionParticipant.h"
    14 #include "nsWeakReference.h"
    16 class nsPIDOMWindow;
    17 class nsIScriptContext;
    19 BEGIN_FMRADIO_NAMESPACE
    21 class DOMRequest;
    23 class FMRadio MOZ_FINAL : public DOMEventTargetHelper
    24                         , public hal::SwitchObserver
    25                         , public FMRadioEventObserver
    26                         , public nsSupportsWeakReference
    27                         , public nsIAudioChannelAgentCallback
    28                         , public nsIDOMEventListener
    30 {
    31   friend class FMRadioRequest;
    33 public:
    34   FMRadio();
    36   NS_DECL_ISUPPORTS_INHERITED
    37   NS_DECL_NSIAUDIOCHANNELAGENTCALLBACK
    39   NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
    41   void Init(nsPIDOMWindow *aWindow);
    42   void Shutdown();
    44   /* hal::SwitchObserver */
    45   virtual void Notify(const hal::SwitchEvent& aEvent) MOZ_OVERRIDE;
    46   /* FMRadioEventObserver */
    47   virtual void Notify(const FMRadioEventType& aType) MOZ_OVERRIDE;
    49   nsPIDOMWindow* GetParentObject() const
    50   {
    51     return GetOwner();
    52   }
    54   virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    56   static bool Enabled();
    58   bool AntennaAvailable() const;
    60   Nullable<double> GetFrequency() const;
    62   double FrequencyUpperBound() const;
    64   double FrequencyLowerBound() const;
    66   double ChannelWidth() const;
    68   already_AddRefed<DOMRequest> Enable(double aFrequency);
    70   already_AddRefed<DOMRequest> Disable();
    72   already_AddRefed<DOMRequest> SetFrequency(double aFrequency);
    74   already_AddRefed<DOMRequest> SeekUp();
    76   already_AddRefed<DOMRequest> SeekDown();
    78   already_AddRefed<DOMRequest> CancelSeek();
    80   IMPL_EVENT_HANDLER(enabled);
    81   IMPL_EVENT_HANDLER(disabled);
    82   IMPL_EVENT_HANDLER(antennaavailablechange);
    83   IMPL_EVENT_HANDLER(frequencychange);
    85   // nsIDOMEventListener
    86   NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
    88 private:
    89   ~FMRadio();
    91   void SetCanPlay(bool aCanPlay);
    92   void EnableAudioChannelAgent();
    94   hal::SwitchState mHeadphoneState;
    95   bool mAudioChannelAgentEnabled;
    96   bool mHasInternalAntenna;
    97   bool mIsShutdown;
    99   nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
   100 };
   102 END_FMRADIO_NAMESPACE
   104 #endif // mozilla_dom_FMRadio_h

mercurial