OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/wm/power_button_controller.h" | 5 #include "ash/wm/power_button_controller.h" |
6 | 6 |
7 #include "ash/common/accelerators/accelerator_controller.h" | 7 #include "ash/common/accelerators/accelerator_controller.h" |
8 #include "ash/common/ash_switches.h" | 8 #include "ash/common/ash_switches.h" |
9 #include "ash/common/session/session_controller.h" | 9 #include "ash/common/session/session_controller.h" |
10 #include "ash/common/system/chromeos/audio/tray_audio.h" | 10 #include "ash/common/system/chromeos/audio/tray_audio.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // Restore volume. | 97 // Restore volume. |
98 chromeos::CrasAudioHandler* audio_handler = | 98 chromeos::CrasAudioHandler* audio_handler = |
99 chromeos::CrasAudioHandler::Get(); | 99 chromeos::CrasAudioHandler::Get(); |
100 audio_handler->SetOutputVolumePercentWithoutNotifyingObservers( | 100 audio_handler->SetOutputVolumePercentWithoutNotifyingObservers( |
101 volume_percent_before_screenshot_, | 101 volume_percent_before_screenshot_, |
102 chromeos::CrasAudioHandler::VOLUME_CHANGE_MAXIMIZE_MODE_SCREENSHOT); | 102 chromeos::CrasAudioHandler::VOLUME_CHANGE_MAXIMIZE_MODE_SCREENSHOT); |
103 return; | 103 return; |
104 } | 104 } |
105 | 105 |
106 const SessionController* const session_controller = | 106 const SessionController* const session_controller = |
107 WmShell::Get()->session_controller(); | 107 Shell::Get()->session_controller(); |
108 if (has_legacy_power_button_) { | 108 if (has_legacy_power_button_) { |
109 // If power button releases won't get reported correctly because we're not | 109 // If power button releases won't get reported correctly because we're not |
110 // running on official hardware, just lock the screen or shut down | 110 // running on official hardware, just lock the screen or shut down |
111 // immediately. | 111 // immediately. |
112 if (down) { | 112 if (down) { |
113 if (session_controller->CanLockScreen() && | 113 if (session_controller->CanLockScreen() && |
114 !session_controller->IsUserSessionBlocked() && | 114 !session_controller->IsUserSessionBlocked() && |
115 !lock_state_controller_->LockRequested()) { | 115 !lock_state_controller_->LockRequested()) { |
116 lock_state_controller_->StartLockAnimationAndLockImmediately(false); | 116 lock_state_controller_->StartLockAnimationAndLockImmediately(false); |
117 } else { | 117 } else { |
(...skipping 20 matching lines...) Expand all Loading... |
138 } | 138 } |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 void PowerButtonController::OnLockButtonEvent( | 142 void PowerButtonController::OnLockButtonEvent( |
143 bool down, | 143 bool down, |
144 const base::TimeTicks& timestamp) { | 144 const base::TimeTicks& timestamp) { |
145 lock_button_down_ = down; | 145 lock_button_down_ = down; |
146 | 146 |
147 const SessionController* const session_controller = | 147 const SessionController* const session_controller = |
148 WmShell::Get()->session_controller(); | 148 Shell::Get()->session_controller(); |
149 if (!session_controller->CanLockScreen() || | 149 if (!session_controller->CanLockScreen() || |
150 session_controller->IsScreenLocked() || | 150 session_controller->IsScreenLocked() || |
151 lock_state_controller_->LockRequested() || | 151 lock_state_controller_->LockRequested() || |
152 lock_state_controller_->ShutdownRequested()) { | 152 lock_state_controller_->ShutdownRequested()) { |
153 return; | 153 return; |
154 } | 154 } |
155 | 155 |
156 // Give the power button precedence over the lock button. | 156 // Give the power button precedence over the lock button. |
157 if (power_button_down_) | 157 if (power_button_down_) |
158 return; | 158 return; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 internal_display_off && external_display_on; | 191 internal_display_off && external_display_on; |
192 } | 192 } |
193 | 193 |
194 void PowerButtonController::PowerButtonEventReceived( | 194 void PowerButtonController::PowerButtonEventReceived( |
195 bool down, | 195 bool down, |
196 const base::TimeTicks& timestamp) { | 196 const base::TimeTicks& timestamp) { |
197 OnPowerButtonEvent(down, timestamp); | 197 OnPowerButtonEvent(down, timestamp); |
198 } | 198 } |
199 | 199 |
200 } // namespace ash | 200 } // namespace ash |
OLD | NEW |