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

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

Issue 2585633004: ozone: Allow ozone evdev/kvm features to be enabled without running on ChromeOS. (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « ui/base/ime/DEPS ('k') | ui/display/manager/BUILD.gn » ('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 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>
11 #include <set> 11 #include <set>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/i18n/char_iterator.h" 15 #include "base/i18n/char_iterator.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "base/sys_info.h"
20 #include "base/third_party/icu/icu_utf.h" 19 #include "base/third_party/icu/icu_utf.h"
20 #include "chromeos/system/devicemode.h"
21 #include "ui/base/ime/chromeos/ime_keyboard.h" 21 #include "ui/base/ime/chromeos/ime_keyboard.h"
22 #include "ui/base/ime/chromeos/input_method_manager.h" 22 #include "ui/base/ime/chromeos/input_method_manager.h"
23 #include "ui/base/ime/composition_text.h" 23 #include "ui/base/ime/composition_text.h"
24 #include "ui/base/ime/ime_bridge.h" 24 #include "ui/base/ime/ime_bridge.h"
25 #include "ui/base/ime/ime_engine_handler_interface.h" 25 #include "ui/base/ime/ime_engine_handler_interface.h"
26 #include "ui/base/ime/text_input_client.h" 26 #include "ui/base/ime/text_input_client.h"
27 #include "ui/events/event.h" 27 #include "ui/events/event.h"
28 #include "ui/gfx/geometry/rect.h" 28 #include "ui/gfx/geometry/rect.h"
29 29
30 namespace { 30 namespace {
(...skipping 28 matching lines...) Expand all
59 59
60 void InputMethodChromeOS::DispatchKeyEvent( 60 void InputMethodChromeOS::DispatchKeyEvent(
61 ui::KeyEvent* event, 61 ui::KeyEvent* event,
62 std::unique_ptr<AckCallback> ack_callback) { 62 std::unique_ptr<AckCallback> ack_callback) {
63 DCHECK(event->IsKeyEvent()); 63 DCHECK(event->IsKeyEvent());
64 DCHECK(!(event->flags() & ui::EF_IS_SYNTHESIZED)); 64 DCHECK(!(event->flags() & ui::EF_IS_SYNTHESIZED));
65 65
66 // For linux_chromeos, the ime keyboard cannot track the caps lock state by 66 // For linux_chromeos, the ime keyboard cannot track the caps lock state by
67 // itself, so need to call SetCapsLockEnabled() method to reflect the caps 67 // itself, so need to call SetCapsLockEnabled() method to reflect the caps
68 // lock state by the key event. 68 // lock state by the key event.
69 if (!base::SysInfo::IsRunningOnChromeOS()) { 69 if (!chromeos::IsRunningAsSystemCompositor()) {
70 chromeos::input_method::InputMethodManager* manager = 70 chromeos::input_method::InputMethodManager* manager =
71 chromeos::input_method::InputMethodManager::Get(); 71 chromeos::input_method::InputMethodManager::Get();
72 if (manager) { 72 if (manager) {
73 chromeos::input_method::ImeKeyboard* keyboard = manager->GetImeKeyboard(); 73 chromeos::input_method::ImeKeyboard* keyboard = manager->GetImeKeyboard();
74 if (keyboard && event->type() == ui::ET_KEY_PRESSED) { 74 if (keyboard && event->type() == ui::ET_KEY_PRESSED) {
75 keyboard->SetCapsLockEnabled((event->key_code() == ui::VKEY_CAPITAL) ? 75 keyboard->SetCapsLockEnabled((event->key_code() == ui::VKEY_CAPITAL) ?
76 !keyboard->CapsLockIsEnabled() : event->IsCapsLockOn()); 76 !keyboard->CapsLockIsEnabled() : event->IsCapsLockOn());
77 } 77 }
78 } 78 }
79 } 79 }
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() { 648 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() {
649 TextInputType type = GetTextInputType(); 649 TextInputType type = GetTextInputType();
650 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); 650 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD);
651 } 651 }
652 652
653 bool InputMethodChromeOS::IsInputFieldFocused() { 653 bool InputMethodChromeOS::IsInputFieldFocused() {
654 return GetTextInputType() != TEXT_INPUT_TYPE_NONE; 654 return GetTextInputType() != TEXT_INPUT_TYPE_NONE;
655 } 655 }
656 656
657 } // namespace ui 657 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/DEPS ('k') | ui/display/manager/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698