| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BatteryManager_h | 5 #ifndef BatteryManager_h |
| 6 #define BatteryManager_h | 6 #define BatteryManager_h |
| 7 | 7 |
| 8 #include "core/dom/ContextLifecycleObserver.h" | 8 #include "core/dom/ContextLifecycleObserver.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/events/EventTarget.h" | 10 #include "core/events/EventTarget.h" |
| 11 #include "heap/Handle.h" |
| 11 #include "modules/battery/BatteryStatus.h" | 12 #include "modules/battery/BatteryStatus.h" |
| 12 | 13 |
| 13 namespace WebCore { | 14 namespace WebCore { |
| 14 | 15 |
| 15 class Navigator; | 16 class Navigator; |
| 16 | 17 |
| 17 class BatteryManager FINAL : public ContextLifecycleObserver, public RefCounted<
BatteryManager>, public EventTargetWithInlineData { | 18 class BatteryManager FINAL : public RefCountedWillBeRefCountedGarbageCollected<B
atteryManager>, public ContextLifecycleObserver, public EventTargetWithInlineDat
a { |
| 18 REFCOUNTED_EVENT_TARGET(BatteryManager); | 19 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<B
atteryManager>); |
| 19 public: | 20 public: |
| 20 virtual ~BatteryManager(); | 21 virtual ~BatteryManager(); |
| 21 static PassRefPtr<BatteryManager> create(ExecutionContext*); | 22 static PassRefPtrWillBeRawPtr<BatteryManager> create(ExecutionContext*); |
| 22 | 23 |
| 23 // EventTarget implementation. | 24 // EventTarget implementation. |
| 24 virtual const WTF::AtomicString& interfaceName() const OVERRIDE { return Eve
ntTargetNames::BatteryManager; } | 25 virtual const WTF::AtomicString& interfaceName() const OVERRIDE { return Eve
ntTargetNames::BatteryManager; } |
| 25 virtual ExecutionContext* executionContext() const OVERRIDE { return Context
LifecycleObserver::executionContext(); } | 26 virtual ExecutionContext* executionContext() const OVERRIDE { return Context
LifecycleObserver::executionContext(); } |
| 26 | 27 |
| 27 bool charging(); | 28 bool charging(); |
| 28 double chargingTime(); | 29 double chargingTime(); |
| 29 double dischargingTime(); | 30 double dischargingTime(); |
| 30 double level(); | 31 double level(); |
| 31 | 32 |
| 32 DEFINE_ATTRIBUTE_EVENT_LISTENER(chargingchange); | 33 DEFINE_ATTRIBUTE_EVENT_LISTENER(chargingchange); |
| 33 DEFINE_ATTRIBUTE_EVENT_LISTENER(chargingtimechange); | 34 DEFINE_ATTRIBUTE_EVENT_LISTENER(chargingtimechange); |
| 34 DEFINE_ATTRIBUTE_EVENT_LISTENER(dischargingtimechange); | 35 DEFINE_ATTRIBUTE_EVENT_LISTENER(dischargingtimechange); |
| 35 DEFINE_ATTRIBUTE_EVENT_LISTENER(levelchange); | 36 DEFINE_ATTRIBUTE_EVENT_LISTENER(levelchange); |
| 36 | 37 |
| 37 void didChangeBatteryStatus(PassRefPtr<Event>, PassOwnPtr<BatteryStatus>); | 38 void didChangeBatteryStatus(PassRefPtr<Event>, PassOwnPtr<BatteryStatus>); |
| 38 | 39 |
| 40 void trace(Visitor*) { } |
| 41 |
| 39 private: | 42 private: |
| 40 explicit BatteryManager(ExecutionContext*); | 43 explicit BatteryManager(ExecutionContext*); |
| 41 | 44 |
| 42 OwnPtr<BatteryStatus> m_batteryStatus; | 45 OwnPtr<BatteryStatus> m_batteryStatus; |
| 43 }; | 46 }; |
| 44 | 47 |
| 45 } | 48 } |
| 46 | 49 |
| 47 #endif // BatteryManager_h | 50 #endif // BatteryManager_h |
| 48 | 51 |
| OLD | NEW |