Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: ash/system/chromeos/power/tablet_power_button_controller.cc

Issue 2521103002: Ignore OnKeyEvent for VKEY_POWER because it is handled by PowerButtonEvent (Closed)
Patch Set: add tests Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/session/session_state_delegate.h" 7 #include "ash/common/session/session_state_delegate.h"
8 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 8 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
9 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 bool user_initiated) { 131 bool user_initiated) {
132 brightness_level_is_zero_ = level == 0; 132 brightness_level_is_zero_ = level == 0;
133 } 133 }
134 134
135 void TabletPowerButtonController::SuspendDone( 135 void TabletPowerButtonController::SuspendDone(
136 const base::TimeDelta& sleep_duration) { 136 const base::TimeDelta& sleep_duration) {
137 last_resume_time_ = tick_clock_->NowTicks(); 137 last_resume_time_ = tick_clock_->NowTicks();
138 } 138 }
139 139
140 void TabletPowerButtonController::OnKeyEvent(ui::KeyEvent* event) { 140 void TabletPowerButtonController::OnKeyEvent(ui::KeyEvent* event) {
141 if (event->key_code() == ui::VKEY_POWER)
Daniel Erat 2016/11/22 00:48:19 please also document why these are ignored. someth
Qiang(Joe) Xu 2016/11/22 01:02:50 Done.
142 return;
143
141 if (!IsTabletModeActive() && backlights_forced_off_) 144 if (!IsTabletModeActive() && backlights_forced_off_)
142 SetBacklightsForcedOff(false); 145 SetBacklightsForcedOff(false);
143 } 146 }
144 147
145 void TabletPowerButtonController::OnMouseEvent(ui::MouseEvent* event) { 148 void TabletPowerButtonController::OnMouseEvent(ui::MouseEvent* event) {
146 ui::EventPointerType pointer_type = event->pointer_details().pointer_type; 149 ui::EventPointerType pointer_type = event->pointer_details().pointer_type;
147 150
148 if (pointer_type != ui::EventPointerType::POINTER_TYPE_MOUSE || 151 if (pointer_type != ui::EventPointerType::POINTER_TYPE_MOUSE ||
149 (event->flags() & ui::EF_IS_SYNTHESIZED)) { 152 (event->flags() & ui::EF_IS_SYNTHESIZED)) {
150 return; 153 return;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 WmShell::Get()->GetSessionStateDelegate(); 208 WmShell::Get()->GetSessionStateDelegate();
206 if (session_state_delegate->ShouldLockScreenAutomatically() && 209 if (session_state_delegate->ShouldLockScreenAutomatically() &&
207 session_state_delegate->CanLockScreen() && 210 session_state_delegate->CanLockScreen() &&
208 !session_state_delegate->IsUserSessionBlocked() && 211 !session_state_delegate->IsUserSessionBlocked() &&
209 !controller_->LockRequested()) { 212 !controller_->LockRequested()) {
210 session_state_delegate->LockScreen(); 213 session_state_delegate->LockScreen();
211 } 214 }
212 } 215 }
213 216
214 } // namespace ash 217 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698