| 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 DispatchKeyEventPostIME(event); | 360 DispatchKeyEventPostIME(event); |
| 361 } | 361 } |
| 362 | 362 |
| 363 void InputMethodChromeOS::ProcessFilteredKeyPressEvent( | 363 void InputMethodChromeOS::ProcessFilteredKeyPressEvent( |
| 364 const ui::KeyEvent& event) { | 364 const ui::KeyEvent& event) { |
| 365 if (NeedInsertChar()) { | 365 if (NeedInsertChar()) { |
| 366 DispatchKeyEventPostIME(event); | 366 DispatchKeyEventPostIME(event); |
| 367 } else { | 367 } else { |
| 368 const ui::KeyEvent fabricated_event(ET_KEY_PRESSED, | 368 const ui::KeyEvent fabricated_event(ET_KEY_PRESSED, |
| 369 VKEY_PROCESSKEY, | 369 VKEY_PROCESSKEY, |
| 370 event.flags(), | 370 event.flags()); |
| 371 false); // is_char | |
| 372 DispatchKeyEventPostIME(fabricated_event); | 371 DispatchKeyEventPostIME(fabricated_event); |
| 373 } | 372 } |
| 374 } | 373 } |
| 375 | 374 |
| 376 void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent( | 375 void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent( |
| 377 const ui::KeyEvent& event) { | 376 const ui::KeyEvent& event) { |
| 378 const TextInputClient* prev_client = GetTextInputClient(); | 377 const TextInputClient* prev_client = GetTextInputClient(); |
| 379 DispatchKeyEventPostIME(event); | 378 DispatchKeyEventPostIME(event); |
| 380 | 379 |
| 381 // We shouldn't dispatch the character anymore if the key event dispatch | 380 // We shouldn't dispatch the character anymore if the key event dispatch |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 436 |
| 438 bool InputMethodChromeOS::HasInputMethodResult() const { | 437 bool InputMethodChromeOS::HasInputMethodResult() const { |
| 439 return result_text_.length() || composition_changed_; | 438 return result_text_.length() || composition_changed_; |
| 440 } | 439 } |
| 441 | 440 |
| 442 void InputMethodChromeOS::SendFakeProcessKeyEvent(bool pressed) const { | 441 void InputMethodChromeOS::SendFakeProcessKeyEvent(bool pressed) const { |
| 443 if (!GetTextInputClient()) | 442 if (!GetTextInputClient()) |
| 444 return; | 443 return; |
| 445 KeyEvent evt(pressed ? ET_KEY_PRESSED : ET_KEY_RELEASED, | 444 KeyEvent evt(pressed ? ET_KEY_PRESSED : ET_KEY_RELEASED, |
| 446 pressed ? VKEY_PROCESSKEY : VKEY_UNKNOWN, | 445 pressed ? VKEY_PROCESSKEY : VKEY_UNKNOWN, |
| 447 EF_IME_FABRICATED_KEY, | 446 EF_IME_FABRICATED_KEY); |
| 448 false); // is_char | |
| 449 DispatchKeyEventPostIME(evt); | 447 DispatchKeyEventPostIME(evt); |
| 450 } | 448 } |
| 451 | 449 |
| 452 void InputMethodChromeOS::AbandonAllPendingKeyEvents() { | 450 void InputMethodChromeOS::AbandonAllPendingKeyEvents() { |
| 453 pending_key_events_.clear(); | 451 pending_key_events_.clear(); |
| 454 } | 452 } |
| 455 | 453 |
| 456 void InputMethodChromeOS::CommitText(const std::string& text) { | 454 void InputMethodChromeOS::CommitText(const std::string& text) { |
| 457 if (text.empty()) | 455 if (text.empty()) |
| 458 return; | 456 return; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 0, length, SK_ColorBLACK, false /* thick */, SK_ColorTRANSPARENT)); | 650 0, length, SK_ColorBLACK, false /* thick */, SK_ColorTRANSPARENT)); |
| 653 } | 651 } |
| 654 } | 652 } |
| 655 | 653 |
| 656 bool InputMethodChromeOS::IsInputFieldFocused() { | 654 bool InputMethodChromeOS::IsInputFieldFocused() { |
| 657 TextInputType type = GetTextInputType(); | 655 TextInputType type = GetTextInputType(); |
| 658 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); | 656 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); |
| 659 } | 657 } |
| 660 | 658 |
| 661 } // namespace ui | 659 } // namespace ui |
| OLD | NEW |