| 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_BRIDGE_H_ | 5 #ifndef COMPONENTS_ARC_POWER_ARC_POWER_BRIDGE_H_ |
| 6 #define COMPONENTS_ARC_POWER_ARC_POWER_BRIDGE_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 "components/arc/arc_service.h" |
| 13 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
| 14 #include "ui/display/chromeos/display_configurator.h" | 14 #include "ui/display/chromeos/display_configurator.h" |
| 15 | 15 |
| 16 namespace arc { | 16 namespace arc { |
| 17 | 17 |
| 18 // ARC Power Client sets power management policy based on requests from | 18 // ARC Power Client sets power management policy based on requests from |
| 19 // ARC instances. | 19 // ARC instances. |
| 20 class ArcPowerBridge : public ArcService, | 20 class ArcPowerBridge : public ArcService, |
| 21 public ArcBridgeService::Observer, | 21 public ArcBridgeService::Observer, |
| 22 public ui::DisplayConfigurator::Observer, | 22 public ui::DisplayConfigurator::Observer, |
| 23 public PowerHost { | 23 public mojom::PowerHost { |
| 24 public: | 24 public: |
| 25 explicit ArcPowerBridge(ArcBridgeService* bridge_service); | 25 explicit ArcPowerBridge(ArcBridgeService* bridge_service); |
| 26 ~ArcPowerBridge() override; | 26 ~ArcPowerBridge() override; |
| 27 | 27 |
| 28 // ArcBridgeService::Observer overrides. | 28 // ArcBridgeService::Observer overrides. |
| 29 void OnPowerInstanceReady() override; | 29 void OnPowerInstanceReady() override; |
| 30 void OnPowerInstanceClosed() override; | 30 void OnPowerInstanceClosed() override; |
| 31 | 31 |
| 32 // DisplayConfigurator::Observer overrides. | 32 // DisplayConfigurator::Observer overrides. |
| 33 void OnPowerStateChanged(chromeos::DisplayPowerState power_state) override; | 33 void OnPowerStateChanged(chromeos::DisplayPowerState power_state) override; |
| 34 | 34 |
| 35 // PowerHost overrides. | 35 // mojom::PowerHost overrides. |
| 36 void OnAcquireDisplayWakeLock(DisplayWakeLockType type) override; | 36 void OnAcquireDisplayWakeLock(mojom::DisplayWakeLockType type) override; |
| 37 void OnReleaseDisplayWakeLock(DisplayWakeLockType type) override; | 37 void OnReleaseDisplayWakeLock(mojom::DisplayWakeLockType type) override; |
| 38 | 38 |
| 39 void IsDisplayOn(const IsDisplayOnCallback& callback) override; | 39 void IsDisplayOn(const IsDisplayOnCallback& callback) override; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 void ReleaseAllDisplayWakeLocks(); | 42 void ReleaseAllDisplayWakeLocks(); |
| 43 | 43 |
| 44 mojo::Binding<PowerHost> binding_; | 44 mojo::Binding<mojom::PowerHost> binding_; |
| 45 | 45 |
| 46 // Stores a mapping of type -> wake lock ID for all wake locks | 46 // Stores a mapping of type -> wake lock ID for all wake locks |
| 47 // held by ARC. | 47 // held by ARC. |
| 48 std::multimap<DisplayWakeLockType, int> wake_locks_; | 48 std::multimap<mojom::DisplayWakeLockType, int> wake_locks_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(ArcPowerBridge); | 50 DISALLOW_COPY_AND_ASSIGN(ArcPowerBridge); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace arc | 53 } // namespace arc |
| 54 | 54 |
| 55 #endif // COMPONENTS_ARC_POWER_ARC_POWER_BRIDGE_H_ | 55 #endif // COMPONENTS_ARC_POWER_ARC_POWER_BRIDGE_H_ |
| OLD | NEW |