LCOV - code coverage report
Current view: top level - dom/battery - BatteryManager.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 7 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       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/. */
       6             : 
       7             : #ifndef mozilla_dom_battery_BatteryManager_h
       8             : #define mozilla_dom_battery_BatteryManager_h
       9             : 
      10             : #include "Types.h"
      11             : #include "mozilla/DOMEventTargetHelper.h"
      12             : #include "mozilla/Observer.h"
      13             : #include "nsCycleCollectionParticipant.h"
      14             : 
      15             : namespace mozilla {
      16             : 
      17             : namespace hal {
      18             : class BatteryInformation;
      19             : } // namespace hal
      20             : 
      21             : namespace dom {
      22             : namespace battery {
      23             : 
      24           0 : class BatteryManager : public DOMEventTargetHelper
      25             :                      , public BatteryObserver
      26             : {
      27             : public:
      28             :   explicit BatteryManager(nsPIDOMWindowInner* aWindow);
      29             : 
      30             :   void Init();
      31             :   void Shutdown();
      32             : 
      33             :   // For IObserver.
      34             :   void Notify(const hal::BatteryInformation& aBatteryInfo) override;
      35             : 
      36             :   /**
      37             :    * WebIDL Interface
      38             :    */
      39             : 
      40           0 :   nsPIDOMWindowInner* GetParentObject() const
      41             :   {
      42           0 :      return GetOwner();
      43             :   }
      44             : 
      45             :   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      46             : 
      47             :   bool Charging() const;
      48             : 
      49             :   double ChargingTime() const;
      50             : 
      51             :   double DischargingTime() const;
      52             : 
      53             :   double Level() const;
      54             : 
      55           0 :   IMPL_EVENT_HANDLER(chargingchange)
      56           0 :   IMPL_EVENT_HANDLER(chargingtimechange)
      57           0 :   IMPL_EVENT_HANDLER(dischargingtimechange)
      58           0 :   IMPL_EVENT_HANDLER(levelchange)
      59             : 
      60             : private:
      61             :   /**
      62             :    * Update the battery information stored in the battery manager object using
      63             :    * a battery information object.
      64             :    */
      65             :   void UpdateFromBatteryInfo(const hal::BatteryInformation& aBatteryInfo);
      66             : 
      67             :   /**
      68             :    * Represents the battery level, ranging from 0.0 (dead or removed?)
      69             :    * to 1.0 (fully charged)
      70             :    */
      71             :   double mLevel;
      72             :   bool   mCharging;
      73             :   /**
      74             :    * Represents the discharging time or the charging time, depending on the
      75             :    * current battery status (charging or not).
      76             :    */
      77             :   double mRemainingTime;
      78             : };
      79             : 
      80             : } // namespace battery
      81             : } // namespace dom
      82             : } // namespace mozilla
      83             : 
      84             : #endif // mozilla_dom_battery_BatteryManager_h

Generated by: LCOV version 1.13