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

Side by Side Diff: ash/accelerators/accelerator_controller.cc

Issue 232333002: ozone: Rename XKeyboard to KeyboardController & use fake under ozone (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename to ImeKeyboard & rebase Created 6 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/system/chromeos/tray_caps_lock.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <iostream> 9 #include <iostream>
10 #include <string> 10 #include <string>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "ui/events/keycodes/keyboard_codes.h" 66 #include "ui/events/keycodes/keyboard_codes.h"
67 #include "ui/gfx/screen.h" 67 #include "ui/gfx/screen.h"
68 #include "ui/views/controls/webview/webview.h" 68 #include "ui/views/controls/webview/webview.h"
69 #include "ui/views/debug_utils.h" 69 #include "ui/views/debug_utils.h"
70 #include "ui/views/widget/widget.h" 70 #include "ui/views/widget/widget.h"
71 71
72 #if defined(OS_CHROMEOS) 72 #if defined(OS_CHROMEOS)
73 #include "ash/session_state_delegate.h" 73 #include "ash/session_state_delegate.h"
74 #include "ash/system/chromeos/keyboard_brightness_controller.h" 74 #include "ash/system/chromeos/keyboard_brightness_controller.h"
75 #include "base/sys_info.h" 75 #include "base/sys_info.h"
76 #include "chromeos/ime/ime_keyboard.h"
76 #include "chromeos/ime/input_method_manager.h" 77 #include "chromeos/ime/input_method_manager.h"
77 #include "chromeos/ime/xkeyboard.h"
78 #endif // defined(OS_CHROMEOS) 78 #endif // defined(OS_CHROMEOS)
79 79
80 namespace ash { 80 namespace ash {
81 namespace { 81 namespace {
82 82
83 using base::UserMetricsAction; 83 using base::UserMetricsAction;
84 84
85 bool DebugShortcutsEnabled() { 85 bool DebugShortcutsEnabled() {
86 #if defined(NDEBUG) 86 #if defined(NDEBUG)
87 return CommandLine::ForCurrentProcess()->HasSwitch( 87 return CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 (previous_key_code != ui::VKEY_LSHIFT && 637 (previous_key_code != ui::VKEY_LSHIFT &&
638 previous_key_code != ui::VKEY_SHIFT && 638 previous_key_code != ui::VKEY_SHIFT &&
639 previous_key_code != ui::VKEY_RSHIFT)) { 639 previous_key_code != ui::VKEY_RSHIFT)) {
640 // If something else was pressed between the Shift key being pressed 640 // If something else was pressed between the Shift key being pressed
641 // and released, then ignore the release of the Shift key. 641 // and released, then ignore the release of the Shift key.
642 return false; 642 return false;
643 } 643 }
644 base::RecordAction(UserMetricsAction("Accel_Disable_Caps_Lock")); 644 base::RecordAction(UserMetricsAction("Accel_Disable_Caps_Lock"));
645 chromeos::input_method::InputMethodManager* ime = 645 chromeos::input_method::InputMethodManager* ime =
646 chromeos::input_method::InputMethodManager::Get(); 646 chromeos::input_method::InputMethodManager::Get();
647 chromeos::input_method::XKeyboard* xkeyboard = 647 chromeos::input_method::ImeKeyboard* keyboard =
648 ime ? ime->GetXKeyboard() : NULL; 648 ime ? ime->GetImeKeyboard() : NULL;
649 if (xkeyboard && xkeyboard->CapsLockIsEnabled()) { 649 if (keyboard && keyboard->CapsLockIsEnabled()) {
650 xkeyboard->SetCapsLockEnabled(false); 650 keyboard->SetCapsLockEnabled(false);
651 return true; 651 return true;
652 } 652 }
653 return false; 653 return false;
654 } 654 }
655 655
656 bool HandleToggleCapsLock(ui::KeyboardCode key_code, 656 bool HandleToggleCapsLock(ui::KeyboardCode key_code,
657 ui::EventType previous_event_type, 657 ui::EventType previous_event_type,
658 ui::KeyboardCode previous_key_code) { 658 ui::KeyboardCode previous_key_code) {
659 if (key_code == ui::VKEY_LWIN) { 659 if (key_code == ui::VKEY_LWIN) {
660 // If something else was pressed between the Search key (LWIN) 660 // If something else was pressed between the Search key (LWIN)
661 // being pressed and released, then ignore the release of the 661 // being pressed and released, then ignore the release of the
662 // Search key. 662 // Search key.
663 // TODO(danakj): Releasing Alt first breaks this: crbug.com/166495 663 // TODO(danakj): Releasing Alt first breaks this: crbug.com/166495
664 if (previous_event_type == ui::ET_KEY_RELEASED || 664 if (previous_event_type == ui::ET_KEY_RELEASED ||
665 previous_key_code != ui::VKEY_LWIN) 665 previous_key_code != ui::VKEY_LWIN)
666 return false; 666 return false;
667 } 667 }
668 base::RecordAction(UserMetricsAction("Accel_Toggle_Caps_Lock")); 668 base::RecordAction(UserMetricsAction("Accel_Toggle_Caps_Lock"));
669 chromeos::input_method::InputMethodManager* ime = 669 chromeos::input_method::InputMethodManager* ime =
670 chromeos::input_method::InputMethodManager::Get(); 670 chromeos::input_method::InputMethodManager::Get();
671 chromeos::input_method::XKeyboard* xkeyboard = 671 chromeos::input_method::ImeKeyboard* keyboard =
672 ime ? ime->GetXKeyboard() : NULL; 672 ime ? ime->GetImeKeyboard() : NULL;
673 if (xkeyboard) 673 if (keyboard)
674 xkeyboard->SetCapsLockEnabled(!xkeyboard->CapsLockIsEnabled()); 674 keyboard->SetCapsLockEnabled(!keyboard->CapsLockIsEnabled());
675 return true; 675 return true;
676 } 676 }
677 677
678 #endif // defined(OS_CHROMEOS) 678 #endif // defined(OS_CHROMEOS)
679 679
680 // Debug print methods. 680 // Debug print methods.
681 681
682 bool HandlePrintLayerHierarchy() { 682 bool HandlePrintLayerHierarchy() {
683 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 683 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
684 for (size_t i = 0; i < root_windows.size(); ++i) { 684 for (size_t i = 0; i < root_windows.size(); ++i) {
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 keyboard_brightness_control_delegate) { 1183 keyboard_brightness_control_delegate) {
1184 keyboard_brightness_control_delegate_ = 1184 keyboard_brightness_control_delegate_ =
1185 keyboard_brightness_control_delegate.Pass(); 1185 keyboard_brightness_control_delegate.Pass();
1186 } 1186 }
1187 1187
1188 bool AcceleratorController::CanHandleAccelerators() const { 1188 bool AcceleratorController::CanHandleAccelerators() const {
1189 return true; 1189 return true;
1190 } 1190 }
1191 1191
1192 } // namespace ash 1192 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/system/chromeos/tray_caps_lock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698