1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/wm/cursor_manager_chromeos.h"
7 #include "base/logging.h"
8 #include "ui/events/event.h"
9 #include "ui/keyboard/keyboard_util.h"
10 #include "ui/wm/core/cursor_manager.h"
11 #include "ui/wm/core/native_cursor_manager.h"
15 CursorManager::CursorManager(
16 scoped_ptr
< ::wm::NativeCursorManager
> delegate
)
17 : ::wm::CursorManager(delegate
.Pass()) {
20 CursorManager::~CursorManager() {
23 bool CursorManager::ShouldHideCursorOnKeyEvent(
24 const ui::KeyEvent
& event
) const {
25 if (event
.type() != ui::ET_KEY_PRESSED
)
28 // Clicking on a key when the accessibility virtual keyboard is enabled should
29 // not hide the cursor.
30 if (keyboard::GetAccessibilityKeyboardEnabled())
32 // All alt and control key commands are ignored.
33 if (event
.IsAltDown() || event
.IsControlDown())
36 ui::KeyboardCode code
= event
.key_code();
37 if (code
>= ui::VKEY_F1
&& code
<= ui::VKEY_F24
)
39 if (code
>= ui::VKEY_BROWSER_BACK
&& code
<= ui::VKEY_MEDIA_LAUNCH_APP2
)
44 case ui::VKEY_CONTROL
:
46 // Search key == VKEY_LWIN.
50 case ui::VKEY_BRIGHTNESS_DOWN
:
51 case ui::VKEY_BRIGHTNESS_UP
:
52 case ui::VKEY_KBD_BRIGHTNESS_UP
:
53 case ui::VKEY_KBD_BRIGHTNESS_DOWN
: