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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 DisplayWakeLockType type) { | 46 DisplayWakeLockType type) { |
47 if (!chromeos::PowerPolicyController::IsInitialized()) { | 47 if (!chromeos::PowerPolicyController::IsInitialized()) { |
48 LOG(WARNING) << "PowerPolicyController is not available"; | 48 LOG(WARNING) << "PowerPolicyController is not available"; |
49 return; | 49 return; |
50 } | 50 } |
51 chromeos::PowerPolicyController* controller = | 51 chromeos::PowerPolicyController* controller = |
52 chromeos::PowerPolicyController::Get(); | 52 chromeos::PowerPolicyController::Get(); |
53 | 53 |
54 int wake_lock_id = -1; | 54 int wake_lock_id = -1; |
55 switch (type) { | 55 switch (type) { |
56 case DISPLAY_WAKE_LOCK_TYPE_BRIGHT: | 56 case DisplayWakeLockType::BRIGHT: |
57 wake_lock_id = controller->AddScreenWakeLock( | 57 wake_lock_id = controller->AddScreenWakeLock( |
58 chromeos::PowerPolicyController::REASON_OTHER, "ARC"); | 58 chromeos::PowerPolicyController::REASON_OTHER, "ARC"); |
59 break; | 59 break; |
60 case DISPLAY_WAKE_LOCK_TYPE_DIM: | 60 case DisplayWakeLockType::DIM: |
61 wake_lock_id = controller->AddDimWakeLock( | 61 wake_lock_id = controller->AddDimWakeLock( |
62 chromeos::PowerPolicyController::REASON_OTHER, "ARC"); | 62 chromeos::PowerPolicyController::REASON_OTHER, "ARC"); |
63 break; | 63 break; |
64 default: | 64 default: |
65 LOG(WARNING) << "Tried to take invalid wake lock type " | 65 LOG(WARNING) << "Tried to take invalid wake lock type " |
66 << static_cast<int>(type); | 66 << static_cast<int>(type); |
67 return; | 67 return; |
68 } | 68 } |
69 wake_locks_.insert(std::make_pair(type, wake_lock_id)); | 69 wake_locks_.insert(std::make_pair(type, wake_lock_id)); |
70 } | 70 } |
(...skipping 28 matching lines...) Expand all Loading... |
99 chromeos::PowerPolicyController* controller = | 99 chromeos::PowerPolicyController* controller = |
100 chromeos::PowerPolicyController::Get(); | 100 chromeos::PowerPolicyController::Get(); |
101 | 101 |
102 for (const auto& it : wake_locks_) { | 102 for (const auto& it : wake_locks_) { |
103 controller->RemoveWakeLock(it.second); | 103 controller->RemoveWakeLock(it.second); |
104 } | 104 } |
105 wake_locks_.clear(); | 105 wake_locks_.clear(); |
106 } | 106 } |
107 | 107 |
108 } // namespace arc | 108 } // namespace arc |
OLD | NEW |