| 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/shell_delegate.h" | 9 #include "ash/common/shell_delegate.h" |
| 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // Ignore key events generated by the power button since power button activity | 157 // Ignore key events generated by the power button since power button activity |
| 158 // is already handled by OnPowerButtonEvent(). | 158 // is already handled by OnPowerButtonEvent(). |
| 159 if (event->key_code() == ui::VKEY_POWER) | 159 if (event->key_code() == ui::VKEY_POWER) |
| 160 return; | 160 return; |
| 161 | 161 |
| 162 if (!IsTabletModeActive() && backlights_forced_off_) | 162 if (!IsTabletModeActive() && backlights_forced_off_) |
| 163 SetDisplayForcedOff(false); | 163 SetDisplayForcedOff(false); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void TabletPowerButtonController::OnMouseEvent(ui::MouseEvent* event) { | 166 void TabletPowerButtonController::OnMouseEvent(ui::MouseEvent* event) { |
| 167 ui::EventPointerType pointer_type = event->pointer_details().pointer_type; | 167 if (event->flags() & ui::EF_IS_SYNTHESIZED) |
| 168 | |
| 169 if (pointer_type != ui::EventPointerType::POINTER_TYPE_MOUSE || | |
| 170 (event->flags() & ui::EF_IS_SYNTHESIZED)) { | |
| 171 return; | 168 return; |
| 172 } | |
| 173 | 169 |
| 174 if (!IsTabletModeActive() && backlights_forced_off_) | 170 if (!IsTabletModeActive() && backlights_forced_off_) |
| 175 SetDisplayForcedOff(false); | 171 SetDisplayForcedOff(false); |
| 176 } | 172 } |
| 177 | 173 |
| 178 void TabletPowerButtonController::OnStylusStateChanged(ui::StylusState state) { | 174 void TabletPowerButtonController::OnStylusStateChanged(ui::StylusState state) { |
| 179 if (IsTabletModeSupported() && state == ui::StylusState::REMOVED && | 175 if (IsTabletModeSupported() && state == ui::StylusState::REMOVED && |
| 180 backlights_forced_off_) { | 176 backlights_forced_off_) { |
| 181 SetDisplayForcedOff(false); | 177 SetDisplayForcedOff(false); |
| 182 } | 178 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 WmShell::Get()->GetSessionStateDelegate(); | 232 WmShell::Get()->GetSessionStateDelegate(); |
| 237 if (session_state_delegate->ShouldLockScreenAutomatically() && | 233 if (session_state_delegate->ShouldLockScreenAutomatically() && |
| 238 session_state_delegate->CanLockScreen() && | 234 session_state_delegate->CanLockScreen() && |
| 239 !session_state_delegate->IsUserSessionBlocked() && | 235 !session_state_delegate->IsUserSessionBlocked() && |
| 240 !controller_->LockRequested()) { | 236 !controller_->LockRequested()) { |
| 241 session_state_delegate->LockScreen(); | 237 session_state_delegate->LockScreen(); |
| 242 } | 238 } |
| 243 } | 239 } |
| 244 | 240 |
| 245 } // namespace ash | 241 } // namespace ash |
| OLD | NEW |