OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/accelerators/accelerator_controller.h" | 5 #include "ash/accelerators/accelerator_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 return true; | 527 return true; |
528 case TAKE_PARTIAL_SCREENSHOT: | 528 case TAKE_PARTIAL_SCREENSHOT: |
529 if (screenshot_delegate_.get()) { | 529 if (screenshot_delegate_.get()) { |
530 ash::PartialScreenshotView::StartPartialScreenshot( | 530 ash::PartialScreenshotView::StartPartialScreenshot( |
531 screenshot_delegate_.get()); | 531 screenshot_delegate_.get()); |
532 } | 532 } |
533 // Return true to prevent propagation of the key event because | 533 // Return true to prevent propagation of the key event because |
534 // this key combination is reserved for partial screenshot. | 534 // this key combination is reserved for partial screenshot. |
535 return true; | 535 return true; |
536 case TOGGLE_APP_LIST: | 536 case TOGGLE_APP_LIST: |
| 537 // See: case NEXT_IME. |
| 538 if (previous_event_type == ui::ET_KEY_RELEASED || |
| 539 // The LWIN binding is on release. If something else was pressed since |
| 540 // the LWIN key, then we should ignore the release of LWIN. |
| 541 (accelerator.type() == ui::ET_KEY_RELEASED && |
| 542 context_.previous_accelerator().key_code() != ui::VKEY_LWIN)) { |
| 543 // We totally ignore this accelerator. |
| 544 return false; |
| 545 } |
537 if (key_code == ui::VKEY_LWIN && shell->delegate()) | 546 if (key_code == ui::VKEY_LWIN && shell->delegate()) |
538 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_SEARCH_LWIN); | 547 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_SEARCH_LWIN); |
539 // When spoken feedback is enabled, we should neither toggle the list nor | 548 // When spoken feedback is enabled, we should neither toggle the list nor |
540 // consume the key since Search+Shift is one of the shortcuts the a11y | 549 // consume the key since Search+Shift is one of the shortcuts the a11y |
541 // feature uses. crbug.com/132296 | 550 // feature uses. crbug.com/132296 |
542 DCHECK_EQ(ui::VKEY_LWIN, accelerator.key_code()); | 551 DCHECK_EQ(ui::VKEY_LWIN, accelerator.key_code()); |
543 if (Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled()) | 552 if (Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled()) |
544 return false; | 553 return false; |
545 ash::Shell::GetInstance()->ToggleAppList(); | 554 ash::Shell::GetInstance()->ToggleAppList(); |
546 return true; | 555 return true; |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 keyboard_brightness_control_delegate) { | 878 keyboard_brightness_control_delegate) { |
870 keyboard_brightness_control_delegate_ = | 879 keyboard_brightness_control_delegate_ = |
871 keyboard_brightness_control_delegate.Pass(); | 880 keyboard_brightness_control_delegate.Pass(); |
872 } | 881 } |
873 | 882 |
874 bool AcceleratorController::CanHandleAccelerators() const { | 883 bool AcceleratorController::CanHandleAccelerators() const { |
875 return true; | 884 return true; |
876 } | 885 } |
877 | 886 |
878 } // namespace ash | 887 } // namespace ash |
OLD | NEW |