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 #include "components/arc/power/arc_power_bridge.h" | 5 #include "components/arc/power/arc_power_bridge.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 ReleaseAllDisplayWakeLocks(); | 28 ReleaseAllDisplayWakeLocks(); |
29 } | 29 } |
30 | 30 |
31 void ArcPowerBridge::OnPowerInstanceReady() { | 31 void ArcPowerBridge::OnPowerInstanceReady() { |
32 PowerInstance* power_instance = arc_bridge_service()->power_instance(); | 32 PowerInstance* power_instance = arc_bridge_service()->power_instance(); |
33 if (!power_instance) { | 33 if (!power_instance) { |
34 LOG(ERROR) << "OnPowerInstanceReady called, but no power instance found"; | 34 LOG(ERROR) << "OnPowerInstanceReady called, but no power instance found"; |
35 return; | 35 return; |
36 } | 36 } |
37 | 37 |
38 PowerHostPtr host; | 38 power_instance->Init(binding_.CreateInterfacePtrAndBind()); |
39 binding_.Bind(mojo::GetProxy(&host)); | |
40 power_instance->Init(std::move(host)); | |
41 } | 39 } |
42 | 40 |
43 void ArcPowerBridge::OnAcquireDisplayWakeLock( | 41 void ArcPowerBridge::OnAcquireDisplayWakeLock( |
44 DisplayWakeLockType type) { | 42 DisplayWakeLockType type) { |
45 if (!chromeos::PowerPolicyController::IsInitialized()) { | 43 if (!chromeos::PowerPolicyController::IsInitialized()) { |
46 LOG(WARNING) << "PowerPolicyController is not available"; | 44 LOG(WARNING) << "PowerPolicyController is not available"; |
47 return; | 45 return; |
48 } | 46 } |
49 chromeos::PowerPolicyController* controller = | 47 chromeos::PowerPolicyController* controller = |
50 chromeos::PowerPolicyController::Get(); | 48 chromeos::PowerPolicyController::Get(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 chromeos::PowerPolicyController* controller = | 95 chromeos::PowerPolicyController* controller = |
98 chromeos::PowerPolicyController::Get(); | 96 chromeos::PowerPolicyController::Get(); |
99 | 97 |
100 for (const auto& it : wake_locks_) { | 98 for (const auto& it : wake_locks_) { |
101 controller->RemoveWakeLock(it.second); | 99 controller->RemoveWakeLock(it.second); |
102 } | 100 } |
103 wake_locks_.clear(); | 101 wake_locks_.clear(); |
104 } | 102 } |
105 | 103 |
106 } // namespace arc | 104 } // namespace arc |
OLD | NEW |