dom/power/PowerManager.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/. */
     5 #ifndef mozilla_dom_power_PowerManager_h
     6 #define mozilla_dom_power_PowerManager_h
     8 #include "nsCOMPtr.h"
     9 #include "nsTArray.h"
    10 #include "nsIDOMWakeLockListener.h"
    11 #include "nsIDOMWindow.h"
    12 #include "nsWeakReference.h"
    13 #include "nsCycleCollectionParticipant.h"
    14 #include "nsWrapperCache.h"
    16 class nsPIDOMWindow;
    18 namespace mozilla {
    19 class ErrorResult;
    21 namespace dom {
    23 class PowerManager MOZ_FINAL : public nsIDOMMozWakeLockListener
    24                              , public nsWrapperCache
    25 {
    26 public:
    27   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    28   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PowerManager)
    29   NS_DECL_NSIDOMMOZWAKELOCKLISTENER
    31   PowerManager()
    32   {
    33     SetIsDOMBinding();
    34   }
    36   nsresult Init(nsIDOMWindow *aWindow);
    37   nsresult Shutdown();
    39   static bool CheckPermission(nsPIDOMWindow*);
    41   static already_AddRefed<PowerManager> CreateInstance(nsPIDOMWindow*);
    43   // WebIDL
    44   nsIDOMWindow* GetParentObject() const
    45   {
    46     return mWindow;
    47   }
    48   virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    49   void Reboot(ErrorResult& aRv);
    50   void FactoryReset();
    51   void PowerOff(ErrorResult& aRv);
    52   void AddWakeLockListener(nsIDOMMozWakeLockListener* aListener);
    53   void RemoveWakeLockListener(nsIDOMMozWakeLockListener* aListener);
    54   void GetWakeLockState(const nsAString& aTopic, nsAString& aState,
    55                         ErrorResult& aRv);
    56   bool ScreenEnabled();
    57   void SetScreenEnabled(bool aEnabled);
    58   double ScreenBrightness();
    59   void SetScreenBrightness(double aBrightness, ErrorResult& aRv);
    60   bool CpuSleepAllowed();
    61   void SetCpuSleepAllowed(bool aAllowed);
    63 private:
    64   nsCOMPtr<nsIDOMWindow> mWindow;
    65   nsTArray<nsCOMPtr<nsIDOMMozWakeLockListener> > mListeners;
    66 };
    68 } // namespace dom
    69 } // namespace mozilla
    71 #endif // mozilla_dom_power_PowerManager_h

mercurial