| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/wm/cursor_manager_chromeos.h" | 5 #include "ash/wm/cursor_manager_chromeos.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/keyboard/keyboard_util.h" | 8 #include "ui/keyboard/keyboard_util.h" |
| 9 #include "ui/wm/core/cursor_manager.h" | 9 #include "ui/wm/core/cursor_manager.h" |
| 10 #include "ui/wm/core/native_cursor_manager.h" | 10 #include "ui/wm/core/native_cursor_manager.h" |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 | 13 |
| 14 CursorManager::CursorManager( | 14 CursorManager::CursorManager( |
| 15 scoped_ptr< ::wm::NativeCursorManager> delegate) | 15 scoped_ptr< ::wm::NativeCursorManager> delegate) |
| 16 : ::wm::CursorManager(delegate.Pass()) { | 16 : ::wm::CursorManager(delegate.Pass()) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 CursorManager::~CursorManager() { | 19 CursorManager::~CursorManager() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 bool CursorManager::ShouldHideCursorOnKeyEvent( | 22 bool CursorManager::ShouldHideCursorOnKeyEvent( |
| 23 const ui::KeyEvent& event) const { | 23 const ui::KeyEvent& event) const { |
| 24 if (event.type() != ui::ET_KEY_PRESSED) |
| 25 return false; |
| 26 |
| 24 // Clicking on a key when the accessibility virtual keyboard is enabled should | 27 // Clicking on a key when the accessibility virtual keyboard is enabled should |
| 25 // not hide the cursor. | 28 // not hide the cursor. |
| 26 if (keyboard::GetAccessibilityKeyboardEnabled()) | 29 if (keyboard::GetAccessibilityKeyboardEnabled()) |
| 27 return false; | 30 return false; |
| 28 // All alt and control key commands are ignored. | 31 // All alt and control key commands are ignored. |
| 29 if (event.IsAltDown() || event.IsControlDown()) | 32 if (event.IsAltDown() || event.IsControlDown()) |
| 30 return false; | 33 return false; |
| 31 | 34 |
| 32 ui::KeyboardCode code = event.key_code(); | 35 ui::KeyboardCode code = event.key_code(); |
| 33 if (code >= ui::VKEY_F1 && code <= ui::VKEY_F24) | 36 if (code >= ui::VKEY_F1 && code <= ui::VKEY_F24) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 46 case ui::VKEY_BRIGHTNESS_DOWN: | 49 case ui::VKEY_BRIGHTNESS_DOWN: |
| 47 case ui::VKEY_BRIGHTNESS_UP: | 50 case ui::VKEY_BRIGHTNESS_UP: |
| 48 case ui::VKEY_KBD_BRIGHTNESS_UP: | 51 case ui::VKEY_KBD_BRIGHTNESS_UP: |
| 49 case ui::VKEY_KBD_BRIGHTNESS_DOWN: | 52 case ui::VKEY_KBD_BRIGHTNESS_DOWN: |
| 50 return false; | 53 return false; |
| 51 default: | 54 default: |
| 52 return true; | 55 return true; |
| 53 } | 56 } |
| 54 } | 57 } |
| 55 } // namespace ash | 58 } // namespace ash |
| OLD | NEW |