| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/system/chromeos/power/tablet_power_button_controller.h" | 5 #include "ash/system/chromeos/power/tablet_power_button_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/accessibility_delegate.h" | 7 #include "ash/common/accessibility_delegate.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 bool user_initiated) { | 132 bool user_initiated) { |
| 133 brightness_level_is_zero_ = level == 0; | 133 brightness_level_is_zero_ = level == 0; |
| 134 } | 134 } |
| 135 | 135 |
| 136 void TabletPowerButtonController::SuspendDone( | 136 void TabletPowerButtonController::SuspendDone( |
| 137 const base::TimeDelta& sleep_duration) { | 137 const base::TimeDelta& sleep_duration) { |
| 138 last_resume_time_ = tick_clock_->NowTicks(); | 138 last_resume_time_ = tick_clock_->NowTicks(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void TabletPowerButtonController::OnKeyEvent(ui::KeyEvent* event) { | 141 void TabletPowerButtonController::OnKeyEvent(ui::KeyEvent* event) { |
| 142 // Ignore key events generated by the power button since power button activity |
| 143 // is already handled by OnPowerButtonEvent(). |
| 144 if (event->key_code() == ui::VKEY_POWER) |
| 145 return; |
| 146 |
| 142 if (!IsTabletModeActive() && backlights_forced_off_) | 147 if (!IsTabletModeActive() && backlights_forced_off_) |
| 143 SetBacklightsForcedOff(false); | 148 SetBacklightsForcedOff(false); |
| 144 } | 149 } |
| 145 | 150 |
| 146 void TabletPowerButtonController::OnMouseEvent(ui::MouseEvent* event) { | 151 void TabletPowerButtonController::OnMouseEvent(ui::MouseEvent* event) { |
| 147 ui::EventPointerType pointer_type = event->pointer_details().pointer_type; | 152 ui::EventPointerType pointer_type = event->pointer_details().pointer_type; |
| 148 | 153 |
| 149 if (pointer_type != ui::EventPointerType::POINTER_TYPE_MOUSE || | 154 if (pointer_type != ui::EventPointerType::POINTER_TYPE_MOUSE || |
| 150 (event->flags() & ui::EF_IS_SYNTHESIZED)) { | 155 (event->flags() & ui::EF_IS_SYNTHESIZED)) { |
| 151 return; | 156 return; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 WmShell::Get()->GetSessionStateDelegate(); | 215 WmShell::Get()->GetSessionStateDelegate(); |
| 211 if (session_state_delegate->ShouldLockScreenAutomatically() && | 216 if (session_state_delegate->ShouldLockScreenAutomatically() && |
| 212 session_state_delegate->CanLockScreen() && | 217 session_state_delegate->CanLockScreen() && |
| 213 !session_state_delegate->IsUserSessionBlocked() && | 218 !session_state_delegate->IsUserSessionBlocked() && |
| 214 !controller_->LockRequested()) { | 219 !controller_->LockRequested()) { |
| 215 session_state_delegate->LockScreen(); | 220 session_state_delegate->LockScreen(); |
| 216 } | 221 } |
| 217 } | 222 } |
| 218 | 223 |
| 219 } // namespace ash | 224 } // namespace ash |
| OLD | NEW |