| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" | 5 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/app_mode/app_mode_utils.h" | 9 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 127 } |
| 128 | 128 |
| 129 bool ExclusiveAccessManager::HandleUserKeyPress( | 129 bool ExclusiveAccessManager::HandleUserKeyPress( |
| 130 const content::NativeWebKeyboardEvent& event) { | 130 const content::NativeWebKeyboardEvent& event) { |
| 131 if (event.windowsKeyCode != ui::VKEY_ESCAPE) { | 131 if (event.windowsKeyCode != ui::VKEY_ESCAPE) { |
| 132 OnUserInput(); | 132 OnUserInput(); |
| 133 return false; | 133 return false; |
| 134 } | 134 } |
| 135 | 135 |
| 136 if (IsExperimentalKeyboardLockUIEnabled()) { | 136 if (IsExperimentalKeyboardLockUIEnabled()) { |
| 137 if (event.type == content::NativeWebKeyboardEvent::KeyUp && | 137 if (event.type() == content::NativeWebKeyboardEvent::KeyUp && |
| 138 hold_timer_.IsRunning()) { | 138 hold_timer_.IsRunning()) { |
| 139 // Seeing a key up event on Esc with the hold timer running cancels the | 139 // Seeing a key up event on Esc with the hold timer running cancels the |
| 140 // timer and doesn't exit. This means the user pressed Esc, but not long | 140 // timer and doesn't exit. This means the user pressed Esc, but not long |
| 141 // enough to trigger an exit | 141 // enough to trigger an exit |
| 142 hold_timer_.Stop(); | 142 hold_timer_.Stop(); |
| 143 } else if (event.type == content::NativeWebKeyboardEvent::RawKeyDown && | 143 } else if (event.type() == content::NativeWebKeyboardEvent::RawKeyDown && |
| 144 !hold_timer_.IsRunning()) { | 144 !hold_timer_.IsRunning()) { |
| 145 // Seeing a key down event on Esc when the hold timer is stopped starts | 145 // Seeing a key down event on Esc when the hold timer is stopped starts |
| 146 // the timer. When the timer reaches 0, the callback will trigger an exit | 146 // the timer. When the timer reaches 0, the callback will trigger an exit |
| 147 // from fullscreen/mouselock. | 147 // from fullscreen/mouselock. |
| 148 hold_timer_.Start( | 148 hold_timer_.Start( |
| 149 FROM_HERE, base::TimeDelta::FromMilliseconds(kHoldEscapeTimeMs), | 149 FROM_HERE, base::TimeDelta::FromMilliseconds(kHoldEscapeTimeMs), |
| 150 base::Bind(&ExclusiveAccessManager::HandleUserHeldEscape, | 150 base::Bind(&ExclusiveAccessManager::HandleUserHeldEscape, |
| 151 base::Unretained(this))); | 151 base::Unretained(this))); |
| 152 } | 152 } |
| 153 // We never handle the keyboard event. | 153 // We never handle the keyboard event. |
| 154 return false; | 154 return false; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 if (fullscreen) | 199 if (fullscreen) |
| 200 fullscreen_controller_.RecordBubbleReshownUMA(); | 200 fullscreen_controller_.RecordBubbleReshownUMA(); |
| 201 if (mouselock) | 201 if (mouselock) |
| 202 mouse_lock_controller_.RecordBubbleReshownUMA(); | 202 mouse_lock_controller_.RecordBubbleReshownUMA(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void ExclusiveAccessManager::HandleUserHeldEscape() { | 205 void ExclusiveAccessManager::HandleUserHeldEscape() { |
| 206 fullscreen_controller_.HandleUserPressedEscape(); | 206 fullscreen_controller_.HandleUserPressedEscape(); |
| 207 mouse_lock_controller_.HandleUserPressedEscape(); | 207 mouse_lock_controller_.HandleUserPressedEscape(); |
| 208 } | 208 } |
| OLD | NEW |