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

Side by Side Diff: ui/base/ime/input_method_chromeos.cc

Issue 1559163002: Clean up event flags a bit: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 4 years, 11 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
OLDNEW
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 "ui/base/ime/input_method_chromeos.h" 5 #include "ui/base/ime/input_method_chromeos.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cstring> 10 #include <cstring>
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 // For linux_chromeos, the ime keyboard cannot track the caps lock state by 103 // For linux_chromeos, the ime keyboard cannot track the caps lock state by
104 // itself, so need to call SetCapsLockEnabled() method to reflect the caps 104 // itself, so need to call SetCapsLockEnabled() method to reflect the caps
105 // lock state by the key event. 105 // lock state by the key event.
106 if (!base::SysInfo::IsRunningOnChromeOS()) { 106 if (!base::SysInfo::IsRunningOnChromeOS()) {
107 chromeos::input_method::InputMethodManager* manager = 107 chromeos::input_method::InputMethodManager* manager =
108 chromeos::input_method::InputMethodManager::Get(); 108 chromeos::input_method::InputMethodManager::Get();
109 if (manager) { 109 if (manager) {
110 chromeos::input_method::ImeKeyboard* keyboard = manager->GetImeKeyboard(); 110 chromeos::input_method::ImeKeyboard* keyboard = manager->GetImeKeyboard();
111 if (keyboard && event->type() == ui::ET_KEY_PRESSED) { 111 if (keyboard && event->type() == ui::ET_KEY_PRESSED) {
112 bool caps = (event->key_code() == ui::VKEY_CAPITAL) 112 keyboard->SetCapsLockEnabled((event->key_code() == ui::VKEY_CAPITAL) ?
113 ? !keyboard->CapsLockIsEnabled() 113 !keyboard->CapsLockIsEnabled() : event->IsCapsLockOn());
114 : (event->flags() & EF_CAPS_LOCK_DOWN);
115 keyboard->SetCapsLockEnabled(caps);
116 } 114 }
117 } 115 }
118 } 116 }
119 117
120 // If |context_| is not usable, then we can only dispatch the key event as is. 118 // If |context_| is not usable, then we can only dispatch the key event as is.
121 // We only dispatch the key event to input method when the |context_| is an 119 // We only dispatch the key event to input method when the |context_| is an
122 // normal input field (not a password field). 120 // normal input field (not a password field).
123 // Note: We need to send the key event to ibus even if the |context_| is not 121 // Note: We need to send the key event to ibus even if the |context_| is not
124 // enabled, so that ibus can have a chance to enable the |context_|. 122 // enabled, so that ibus can have a chance to enable the |context_|.
125 if (!IsNonPasswordInputFieldFocused() || !GetEngine()) { 123 if (!IsNonPasswordInputFieldFocused() || !GetEngine()) {
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() { 664 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() {
667 TextInputType type = GetTextInputType(); 665 TextInputType type = GetTextInputType();
668 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); 666 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD);
669 } 667 }
670 668
671 bool InputMethodChromeOS::IsInputFieldFocused() { 669 bool InputMethodChromeOS::IsInputFieldFocused() {
672 return GetTextInputType() != TEXT_INPUT_TYPE_NONE; 670 return GetTextInputType() != TEXT_INPUT_TYPE_NONE;
673 } 671 }
674 672
675 } // namespace ui 673 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/chromeos/character_composer_unittest.cc ('k') | ui/content_accelerators/accelerator_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698