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 "bindings/core/v8/ActiveScriptWrappable.h" |
8 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptPromiseProperty.h" | 10 #include "bindings/core/v8/ScriptPromiseProperty.h" |
10 #include "core/dom/ActiveDOMObject.h" | 11 #include "core/dom/ActiveDOMObject.h" |
11 #include "core/dom/ContextLifecycleObserver.h" | 12 #include "core/dom/ContextLifecycleObserver.h" |
12 #include "core/frame/PlatformEventController.h" | 13 #include "core/frame/PlatformEventController.h" |
13 #include "modules/EventTargetModules.h" | 14 #include "modules/EventTargetModules.h" |
14 #include "platform/battery/battery_status.h" | 15 #include "platform/battery/battery_status.h" |
15 #include "platform/heap/Handle.h" | 16 #include "platform/heap/Handle.h" |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 class BatteryManager final : public RefCountedGarbageCollectedEventTargetWithInl
ineData<BatteryManager>, public ActiveDOMObject, public PlatformEventController
{ | 20 class BatteryManager final : public RefCountedGarbageCollectedEventTargetWithInl
ineData<BatteryManager>, public ActiveScriptWrappable, public ActiveDOMObject, p
ublic PlatformEventController { |
20 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(BatteryManager); | 21 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(BatteryManager); |
21 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
22 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(BatteryManager); | 23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(BatteryManager); |
23 public: | 24 public: |
24 static BatteryManager* create(ExecutionContext*); | 25 static BatteryManager* create(ExecutionContext*); |
25 ~BatteryManager() override; | 26 ~BatteryManager() override; |
26 | 27 |
27 // Returns a promise object that will be resolved with this BatteryManager. | 28 // Returns a promise object that will be resolved with this BatteryManager. |
28 ScriptPromise startRequest(ScriptState*); | 29 ScriptPromise startRequest(ScriptState*); |
29 | 30 |
(...skipping 14 matching lines...) Expand all Loading... |
44 // Inherited from PlatformEventController. | 45 // Inherited from PlatformEventController. |
45 void didUpdateData() override; | 46 void didUpdateData() override; |
46 void registerWithDispatcher() override; | 47 void registerWithDispatcher() override; |
47 void unregisterWithDispatcher() override; | 48 void unregisterWithDispatcher() override; |
48 bool hasLastData() override; | 49 bool hasLastData() override; |
49 | 50 |
50 // ActiveDOMObject implementation. | 51 // ActiveDOMObject implementation. |
51 void suspend() override; | 52 void suspend() override; |
52 void resume() override; | 53 void resume() override; |
53 void stop() override; | 54 void stop() override; |
54 bool hasPendingActivity() const override; | 55 |
| 56 // ActiveScriptWrappable implementation. |
| 57 bool hasPendingActivity() const final; |
55 | 58 |
56 DECLARE_VIRTUAL_TRACE(); | 59 DECLARE_VIRTUAL_TRACE(); |
57 | 60 |
58 private: | 61 private: |
59 explicit BatteryManager(ExecutionContext*); | 62 explicit BatteryManager(ExecutionContext*); |
60 | 63 |
61 using BatteryProperty = ScriptPromiseProperty<Member<BatteryManager>, Member
<BatteryManager>, Member<DOMException>>; | 64 using BatteryProperty = ScriptPromiseProperty<Member<BatteryManager>, Member
<BatteryManager>, Member<DOMException>>; |
62 Member<BatteryProperty> m_batteryProperty; | 65 Member<BatteryProperty> m_batteryProperty; |
63 BatteryStatus m_batteryStatus; | 66 BatteryStatus m_batteryStatus; |
64 }; | 67 }; |
65 | 68 |
66 } // namespace blink | 69 } // namespace blink |
67 | 70 |
68 #endif // BatteryManager_h | 71 #endif // BatteryManager_h |
OLD | NEW |