OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_ARC_POWER_ARC_POWER_SERVICE_H_ | 5 #ifndef COMPONENTS_ARC_POWER_ARC_POWER_BRIDGE_H_ |
6 #define COMPONENTS_ARC_POWER_ARC_POWER_SERVICE_H_ | 6 #define COMPONENTS_ARC_POWER_ARC_POWER_BRIDGE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "components/arc/arc_bridge_service.h" | 11 #include "components/arc/arc_bridge_service.h" |
| 12 #include "components/arc/arc_service.h" |
12 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
13 | 14 |
14 namespace arc { | 15 namespace arc { |
15 | 16 |
16 // ARC Power Client sets power management policy based on requests from | 17 // ARC Power Client sets power management policy based on requests from |
17 // ARC instances. | 18 // ARC instances. |
18 class ArcPowerBridge : public ArcBridgeService::Observer, | 19 class ArcPowerBridge : public ArcService, |
| 20 public ArcBridgeService::Observer, |
19 public PowerHost { | 21 public PowerHost { |
20 public: | 22 public: |
21 explicit ArcPowerBridge(ArcBridgeService* arc_bridge_service); | 23 explicit ArcPowerBridge(ArcBridgeService* bridge_service); |
22 ~ArcPowerBridge() override; | 24 ~ArcPowerBridge() override; |
23 | 25 |
24 // ArcBridgeService::Observer overrides. | 26 // ArcBridgeService::Observer overrides. |
25 void OnStateChanged(ArcBridgeService::State state) override; | 27 void OnStateChanged(ArcBridgeService::State state) override; |
26 void OnPowerInstanceReady() override; | 28 void OnPowerInstanceReady() override; |
27 | 29 |
28 // PowerHost overrides. | 30 // PowerHost overrides. |
29 void OnAcquireDisplayWakeLock(DisplayWakeLockType type) override; | 31 void OnAcquireDisplayWakeLock(DisplayWakeLockType type) override; |
30 void OnReleaseDisplayWakeLock(DisplayWakeLockType type) override; | 32 void OnReleaseDisplayWakeLock(DisplayWakeLockType type) override; |
31 | 33 |
32 private: | 34 private: |
33 void ReleaseAllDisplayWakeLocks(); | 35 void ReleaseAllDisplayWakeLocks(); |
34 | 36 |
35 ArcBridgeService* arc_bridge_service_; // weak | |
36 | |
37 mojo::Binding<PowerHost> binding_; | 37 mojo::Binding<PowerHost> binding_; |
38 | 38 |
39 // Stores a mapping of type -> wake lock ID for all wake locks | 39 // Stores a mapping of type -> wake lock ID for all wake locks |
40 // held by ARC. | 40 // held by ARC. |
41 std::multimap<DisplayWakeLockType, int> wake_locks_; | 41 std::multimap<DisplayWakeLockType, int> wake_locks_; |
42 | 42 |
43 DISALLOW_COPY_AND_ASSIGN(ArcPowerBridge); | 43 DISALLOW_COPY_AND_ASSIGN(ArcPowerBridge); |
44 }; | 44 }; |
45 | 45 |
46 } // namespace arc | 46 } // namespace arc |
47 | 47 |
48 #endif // COMPONENTS_ARC_POWER_ARC_POWER_SERVICE_H_ | 48 #endif // COMPONENTS_ARC_POWER_ARC_POWER_BRIDGE_H_ |
OLD | NEW |