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 "ui/base/ime/input_method_chromeos.h" | 5 #include "ui/base/ime/input_method_chromeos.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstring> | 8 #include <cstring> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 namespace ui { | 33 namespace ui { |
34 | 34 |
35 // InputMethodChromeOS implementation ----------------------------------------- | 35 // InputMethodChromeOS implementation ----------------------------------------- |
36 InputMethodChromeOS::InputMethodChromeOS( | 36 InputMethodChromeOS::InputMethodChromeOS( |
37 internal::InputMethodDelegate* delegate) | 37 internal::InputMethodDelegate* delegate) |
38 : composing_text_(false), | 38 : composing_text_(false), |
39 composition_changed_(false), | 39 composition_changed_(false), |
| 40 on_screen_keyboard_supported_(false), |
40 current_keyevent_id_(0), | 41 current_keyevent_id_(0), |
41 weak_ptr_factory_(this) { | 42 weak_ptr_factory_(this) { |
42 SetDelegate(delegate); | 43 SetDelegate(delegate); |
43 chromeos::IMEBridge::Get()->SetInputContextHandler(this); | 44 chromeos::IMEBridge::Get()->SetInputContextHandler(this); |
44 | 45 |
45 UpdateContextFocusState(); | 46 UpdateContextFocusState(); |
46 } | 47 } |
47 | 48 |
48 InputMethodChromeOS::~InputMethodChromeOS() { | 49 InputMethodChromeOS::~InputMethodChromeOS() { |
49 AbandonAllPendingKeyEvents(); | 50 AbandonAllPendingKeyEvents(); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // focus and after it acquires focus again are the same. | 278 // focus and after it acquires focus again are the same. |
278 UpdateContextFocusState(); | 279 UpdateContextFocusState(); |
279 | 280 |
280 if (GetEngine()) { | 281 if (GetEngine()) { |
281 chromeos::IMEEngineHandlerInterface::InputContext context( | 282 chromeos::IMEEngineHandlerInterface::InputContext context( |
282 GetTextInputType(), GetTextInputMode(), GetTextInputFlags()); | 283 GetTextInputType(), GetTextInputMode(), GetTextInputFlags()); |
283 GetEngine()->FocusIn(context); | 284 GetEngine()->FocusIn(context); |
284 } | 285 } |
285 } | 286 } |
286 | 287 |
| 288 void InputMethodChromeOS::SetSupportsOnScreenKeyboard(bool supported) { |
| 289 on_screen_keyboard_supported_ = supported; |
| 290 } |
| 291 |
| 292 bool InputMethodChromeOS::SupportsOnScreenKeyboard() const { |
| 293 return on_screen_keyboard_supported_; |
| 294 } |
| 295 |
287 void InputMethodChromeOS::ConfirmCompositionText() { | 296 void InputMethodChromeOS::ConfirmCompositionText() { |
288 TextInputClient* client = GetTextInputClient(); | 297 TextInputClient* client = GetTextInputClient(); |
289 if (client && client->HasCompositionText()) | 298 if (client && client->HasCompositionText()) |
290 client->ConfirmCompositionText(); | 299 client->ConfirmCompositionText(); |
291 | 300 |
292 ResetContext(); | 301 ResetContext(); |
293 } | 302 } |
294 | 303 |
295 void InputMethodChromeOS::ResetContext() { | 304 void InputMethodChromeOS::ResetContext() { |
296 if (!IsNonPasswordInputFieldFocused() || !GetTextInputClient()) | 305 if (!IsNonPasswordInputFieldFocused() || !GetTextInputClient()) |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() { | 674 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() { |
666 TextInputType type = GetTextInputType(); | 675 TextInputType type = GetTextInputType(); |
667 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); | 676 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); |
668 } | 677 } |
669 | 678 |
670 bool InputMethodChromeOS::IsInputFieldFocused() { | 679 bool InputMethodChromeOS::IsInputFieldFocused() { |
671 return GetTextInputType() != TEXT_INPUT_TYPE_NONE; | 680 return GetTextInputType() != TEXT_INPUT_TYPE_NONE; |
672 } | 681 } |
673 | 682 |
674 } // namespace ui | 683 } // namespace ui |
OLD | NEW |