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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 InputMethodBase::OnBlur(); | 64 InputMethodBase::OnBlur(); |
65 OnTextInputTypeChanged(GetTextInputClient()); | 65 OnTextInputTypeChanged(GetTextInputClient()); |
66 } | 66 } |
67 | 67 |
68 bool InputMethodChromeOS::OnUntranslatedIMEMessage( | 68 bool InputMethodChromeOS::OnUntranslatedIMEMessage( |
69 const base::NativeEvent& event, | 69 const base::NativeEvent& event, |
70 NativeEventResult* result) { | 70 NativeEventResult* result) { |
71 return false; | 71 return false; |
72 } | 72 } |
73 | 73 |
74 void InputMethodChromeOS::ProcessKeyEventDone(const ui::KeyEvent* event, | 74 void InputMethodChromeOS::ProcessKeyEventDone(ui::KeyEvent* event, |
75 bool is_handled) { | 75 bool is_handled) { |
76 DCHECK(event); | 76 DCHECK(event); |
77 if (event->type() == ET_KEY_PRESSED) { | 77 if (event->type() == ET_KEY_PRESSED) { |
78 if (is_handled) { | 78 if (is_handled) { |
79 // IME event has a priority to be handled, so that character composer | 79 // IME event has a priority to be handled, so that character composer |
80 // should be reset. | 80 // should be reset. |
81 character_composer_.Reset(); | 81 character_composer_.Reset(); |
82 } else { | 82 } else { |
83 // If IME does not handle key event, passes keyevent to character composer | 83 // If IME does not handle key event, passes keyevent to character composer |
84 // to be able to compose complex characters. | 84 // to be able to compose complex characters. |
85 is_handled = ExecuteCharacterComposer(*event); | 85 is_handled = ExecuteCharacterComposer(*event); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 if (event->type() == ET_KEY_PRESSED || event->type() == ET_KEY_RELEASED) | 89 if (event->type() == ET_KEY_PRESSED || event->type() == ET_KEY_RELEASED) |
90 ProcessKeyEventPostIME(*event, is_handled); | 90 ProcessKeyEventPostIME(event, is_handled); |
91 | 91 |
92 handling_key_event_ = false; | 92 handling_key_event_ = false; |
93 } | 93 } |
94 | 94 |
95 bool InputMethodChromeOS::DispatchKeyEvent(const ui::KeyEvent& event) { | 95 void InputMethodChromeOS::DispatchKeyEvent(ui::KeyEvent* event) { |
96 DCHECK(event.IsKeyEvent()); | 96 DCHECK(event->IsKeyEvent()); |
97 DCHECK(!(event.flags() & ui::EF_IS_SYNTHESIZED)); | 97 DCHECK(!(event->flags() & ui::EF_IS_SYNTHESIZED)); |
98 DCHECK(system_toplevel_window_focused()); | 98 DCHECK(system_toplevel_window_focused()); |
99 | 99 |
100 // For linux_chromeos, the ime keyboard cannot track the caps lock state by | 100 // For linux_chromeos, the ime keyboard cannot track the caps lock state by |
101 // itself, so need to call SetCapsLockEnabled() method to reflect the caps | 101 // itself, so need to call SetCapsLockEnabled() method to reflect the caps |
102 // lock state by the key event. | 102 // lock state by the key event. |
103 if (!base::SysInfo::IsRunningOnChromeOS()) { | 103 if (!base::SysInfo::IsRunningOnChromeOS()) { |
104 chromeos::input_method::InputMethodManager* manager = | 104 chromeos::input_method::InputMethodManager* manager = |
105 chromeos::input_method::InputMethodManager::Get(); | 105 chromeos::input_method::InputMethodManager::Get(); |
106 if (manager) { | 106 if (manager) { |
107 chromeos::input_method::ImeKeyboard* keyboard = manager->GetImeKeyboard(); | 107 chromeos::input_method::ImeKeyboard* keyboard = manager->GetImeKeyboard(); |
108 if (keyboard && event.type() == ui::ET_KEY_PRESSED) { | 108 if (keyboard && event->type() == ui::ET_KEY_PRESSED) { |
109 bool caps = (event.key_code() == ui::VKEY_CAPITAL) | 109 bool caps = (event->key_code() == ui::VKEY_CAPITAL) |
110 ? !keyboard->CapsLockIsEnabled() | 110 ? !keyboard->CapsLockIsEnabled() |
111 : (event.flags() & EF_CAPS_LOCK_DOWN); | 111 : (event->flags() & EF_CAPS_LOCK_DOWN); |
112 keyboard->SetCapsLockEnabled(caps); | 112 keyboard->SetCapsLockEnabled(caps); |
113 } | 113 } |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 // If |context_| is not usable, then we can only dispatch the key event as is. | 117 // If |context_| is not usable, then we can only dispatch the key event as is. |
118 // We only dispatch the key event to input method when the |context_| is an | 118 // We only dispatch the key event to input method when the |context_| is an |
119 // normal input field (not a password field). | 119 // normal input field (not a password field). |
120 // Note: We need to send the key event to ibus even if the |context_| is not | 120 // Note: We need to send the key event to ibus even if the |context_| is not |
121 // enabled, so that ibus can have a chance to enable the |context_|. | 121 // enabled, so that ibus can have a chance to enable the |context_|. |
122 if (!IsNonPasswordInputFieldFocused() || !GetEngine()) { | 122 if (!IsNonPasswordInputFieldFocused() || !GetEngine()) { |
123 if (event.type() == ET_KEY_PRESSED) { | 123 if (event->type() == ET_KEY_PRESSED) { |
124 if (ExecuteCharacterComposer(event)) { | 124 if (ExecuteCharacterComposer(*event)) { |
125 // Treating as PostIME event if character composer handles key event and | 125 // Treating as PostIME event if character composer handles key event and |
126 // generates some IME event, | 126 // generates some IME event, |
127 ProcessKeyEventPostIME(event, true); | 127 ProcessKeyEventPostIME(event, true); |
128 return true; | 128 return; |
129 } | 129 } |
130 ProcessUnfilteredKeyPressEvent(event); | 130 ProcessUnfilteredKeyPressEvent(event); |
131 } else { | 131 } else { |
132 DispatchKeyEventPostIME(event); | 132 ignore_result(DispatchKeyEventPostIME(event)); |
133 } | 133 } |
134 return true; | 134 return; |
135 } | 135 } |
136 | 136 |
137 handling_key_event_ = true; | 137 handling_key_event_ = true; |
138 if (GetEngine()->IsInterestedInKeyEvent()) { | 138 if (GetEngine()->IsInterestedInKeyEvent()) { |
139 GetEngine()->ProcessKeyEvent( | 139 GetEngine()->ProcessKeyEvent( |
140 event, | 140 *event, |
141 base::Bind(&InputMethodChromeOS::ProcessKeyEventDone, | 141 base::Bind(&InputMethodChromeOS::ProcessKeyEventDone, |
142 weak_ptr_factory_.GetWeakPtr(), | 142 weak_ptr_factory_.GetWeakPtr(), |
143 // Pass the ownership of the new copied event. | 143 // Pass the ownership of the new copied event. |
144 base::Owned(new ui::KeyEvent(event)))); | 144 base::Owned(new ui::KeyEvent(*event)))); |
145 } else { | 145 } else { |
146 ProcessKeyEventDone(&event, false); | 146 ProcessKeyEventDone(event, false); |
147 } | 147 } |
148 return true; | |
149 } | 148 } |
150 | 149 |
151 void InputMethodChromeOS::OnTextInputTypeChanged( | 150 void InputMethodChromeOS::OnTextInputTypeChanged( |
152 const TextInputClient* client) { | 151 const TextInputClient* client) { |
153 if (!IsTextInputClientFocused(client)) | 152 if (!IsTextInputClientFocused(client)) |
154 return; | 153 return; |
155 | 154 |
156 UpdateContextFocusState(); | 155 UpdateContextFocusState(); |
157 | 156 |
158 chromeos::IMEEngineHandlerInterface* engine = GetEngine(); | 157 chromeos::IMEEngineHandlerInterface* engine = GetEngine(); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 candidate_window->FocusStateChanged(IsNonPasswordInputFieldFocused()); | 328 candidate_window->FocusStateChanged(IsNonPasswordInputFieldFocused()); |
330 | 329 |
331 chromeos::IMEEngineHandlerInterface::InputContext context( | 330 chromeos::IMEEngineHandlerInterface::InputContext context( |
332 GetTextInputType(), GetTextInputMode(), GetTextInputFlags()); | 331 GetTextInputType(), GetTextInputMode(), GetTextInputFlags()); |
333 chromeos::IMEBridge::Get()->SetCurrentInputContext(context); | 332 chromeos::IMEBridge::Get()->SetCurrentInputContext(context); |
334 | 333 |
335 if (!IsTextInputTypeNone()) | 334 if (!IsTextInputTypeNone()) |
336 OnCaretBoundsChanged(GetTextInputClient()); | 335 OnCaretBoundsChanged(GetTextInputClient()); |
337 } | 336 } |
338 | 337 |
339 void InputMethodChromeOS::ProcessKeyEventPostIME(const ui::KeyEvent& event, | 338 void InputMethodChromeOS::ProcessKeyEventPostIME(ui::KeyEvent* event, |
340 bool handled) { | 339 bool handled) { |
341 TextInputClient* client = GetTextInputClient(); | 340 TextInputClient* client = GetTextInputClient(); |
342 if (!client) { | 341 if (!client) { |
343 // As ibus works asynchronously, there is a chance that the focused client | 342 // As ibus works asynchronously, there is a chance that the focused client |
344 // loses focus before this method gets called. | 343 // loses focus before this method gets called. |
345 DispatchKeyEventPostIME(event); | 344 ignore_result(DispatchKeyEventPostIME(event)); |
346 return; | 345 return; |
347 } | 346 } |
348 | 347 |
349 if (event.type() == ET_KEY_PRESSED && handled) { | 348 if (event->type() == ET_KEY_PRESSED && handled) { |
350 if (ProcessFilteredKeyPressEvent(event)) { | 349 ProcessFilteredKeyPressEvent(event); |
| 350 if (event->stopped_propagation()) { |
351 ResetContext(); | 351 ResetContext(); |
352 return; | 352 return; |
353 } | 353 } |
354 } | 354 } |
355 | 355 |
356 // In case the focus was changed by the key event. The |context_| should have | 356 // In case the focus was changed by the key event. The |context_| should have |
357 // been reset when the focused window changed. | 357 // been reset when the focused window changed. |
358 if (client != GetTextInputClient()) | 358 if (client != GetTextInputClient()) |
359 return; | 359 return; |
360 | 360 |
361 if (HasInputMethodResult()) | 361 if (HasInputMethodResult()) |
362 ProcessInputMethodResult(event, handled); | 362 ProcessInputMethodResult(event, handled); |
363 | 363 |
364 // In case the focus was changed when sending input method results to the | 364 // In case the focus was changed when sending input method results to the |
365 // focused window. | 365 // focused window. |
366 if (client != GetTextInputClient()) | 366 if (client != GetTextInputClient()) |
367 return; | 367 return; |
368 | 368 |
369 if (handled) | 369 if (handled) |
370 return; // IME handled the key event. do not forward. | 370 return; // IME handled the key event. do not forward. |
371 | 371 |
372 if (event.type() == ET_KEY_PRESSED) | 372 if (event->type() == ET_KEY_PRESSED) |
373 ProcessUnfilteredKeyPressEvent(event); | 373 ProcessUnfilteredKeyPressEvent(event); |
374 else if (event.type() == ET_KEY_RELEASED) | 374 else if (event->type() == ET_KEY_RELEASED) |
375 DispatchKeyEventPostIME(event); | 375 ignore_result(DispatchKeyEventPostIME(event)); |
376 } | 376 } |
377 | 377 |
378 bool InputMethodChromeOS::ProcessFilteredKeyPressEvent( | 378 void InputMethodChromeOS::ProcessFilteredKeyPressEvent(ui::KeyEvent* event) { |
379 const ui::KeyEvent& event) { | 379 if (NeedInsertChar()) { |
380 if (NeedInsertChar()) | 380 ignore_result(DispatchKeyEventPostIME(event)); |
381 return DispatchKeyEventPostIME(event); | 381 return; |
382 const ui::KeyEvent fabricated_event(ET_KEY_PRESSED, | 382 } |
383 VKEY_PROCESSKEY, | 383 ui::KeyEvent fabricated_event(ET_KEY_PRESSED, |
384 event.flags()); | 384 VKEY_PROCESSKEY, |
385 return DispatchKeyEventPostIME(fabricated_event); | 385 event->flags()); |
| 386 ignore_result(DispatchKeyEventPostIME(&fabricated_event)); |
| 387 if (fabricated_event.stopped_propagation()) |
| 388 event->StopPropagation(); |
386 } | 389 } |
387 | 390 |
388 void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent( | 391 void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent( |
389 const ui::KeyEvent& event) { | 392 ui::KeyEvent* event) { |
390 const TextInputClient* prev_client = GetTextInputClient(); | 393 const TextInputClient* prev_client = GetTextInputClient(); |
391 if (DispatchKeyEventPostIME(event)) { | 394 ignore_result(DispatchKeyEventPostIME(event)); |
| 395 if (event->stopped_propagation()) { |
392 ResetContext(); | 396 ResetContext(); |
393 return; | 397 return; |
394 } | 398 } |
395 | 399 |
396 // We shouldn't dispatch the character anymore if the key event dispatch | 400 // We shouldn't dispatch the character anymore if the key event dispatch |
397 // caused focus change. For example, in the following scenario, | 401 // caused focus change. For example, in the following scenario, |
398 // 1. visit a web page which has a <textarea>. | 402 // 1. visit a web page which has a <textarea>. |
399 // 2. click Omnibox. | 403 // 2. click Omnibox. |
400 // 3. enable Korean IME, press A, then press Tab to move the focus to the web | 404 // 3. enable Korean IME, press A, then press Tab to move the focus to the web |
401 // page. | 405 // page. |
402 // We should return here not to send the Tab key event to RWHV. | 406 // We should return here not to send the Tab key event to RWHV. |
403 TextInputClient* client = GetTextInputClient(); | 407 TextInputClient* client = GetTextInputClient(); |
404 if (!client || client != prev_client) | 408 if (!client || client != prev_client) |
405 return; | 409 return; |
406 | 410 |
407 // If a key event was not filtered by |context_| and |character_composer_|, | 411 // If a key event was not filtered by |context_| and |character_composer_|, |
408 // then it means the key event didn't generate any result text. So we need | 412 // then it means the key event didn't generate any result text. So we need |
409 // to send corresponding character to the focused text input client. | 413 // to send corresponding character to the focused text input client. |
410 uint16 ch = event.GetCharacter(); | 414 uint16 ch = event->GetCharacter(); |
411 if (ch) | 415 if (ch) |
412 client->InsertChar(ch, event.flags()); | 416 client->InsertChar(ch, event->flags()); |
413 } | 417 } |
414 | 418 |
415 void InputMethodChromeOS::ProcessInputMethodResult(const ui::KeyEvent& event, | 419 void InputMethodChromeOS::ProcessInputMethodResult(ui::KeyEvent* event, |
416 bool handled) { | 420 bool handled) { |
417 TextInputClient* client = GetTextInputClient(); | 421 TextInputClient* client = GetTextInputClient(); |
418 DCHECK(client); | 422 DCHECK(client); |
419 | 423 |
420 if (result_text_.length()) { | 424 if (result_text_.length()) { |
421 if (handled && NeedInsertChar()) { | 425 if (handled && NeedInsertChar()) { |
422 for (base::string16::const_iterator i = result_text_.begin(); | 426 for (base::string16::const_iterator i = result_text_.begin(); |
423 i != result_text_.end(); ++i) { | 427 i != result_text_.end(); ++i) { |
424 client->InsertChar(*i, event.flags()); | 428 client->InsertChar(*i, event->flags()); |
425 } | 429 } |
426 } else { | 430 } else { |
427 client->InsertText(result_text_); | 431 client->InsertText(result_text_); |
428 composing_text_ = false; | 432 composing_text_ = false; |
429 } | 433 } |
430 } | 434 } |
431 | 435 |
432 if (composition_changed_ && !IsTextInputTypeNone()) { | 436 if (composition_changed_ && !IsTextInputTypeNone()) { |
433 if (composition_.text.length()) { | 437 if (composition_.text.length()) { |
434 composing_text_ = true; | 438 composing_text_ = true; |
(...skipping 12 matching lines...) Expand all Loading... |
447 bool InputMethodChromeOS::NeedInsertChar() const { | 451 bool InputMethodChromeOS::NeedInsertChar() const { |
448 return GetTextInputClient() && | 452 return GetTextInputClient() && |
449 (IsTextInputTypeNone() || | 453 (IsTextInputTypeNone() || |
450 (!composing_text_ && result_text_.length() == 1)); | 454 (!composing_text_ && result_text_.length() == 1)); |
451 } | 455 } |
452 | 456 |
453 bool InputMethodChromeOS::HasInputMethodResult() const { | 457 bool InputMethodChromeOS::HasInputMethodResult() const { |
454 return result_text_.length() || composition_changed_; | 458 return result_text_.length() || composition_changed_; |
455 } | 459 } |
456 | 460 |
457 void InputMethodChromeOS::SendFakeProcessKeyEvent(bool pressed) const { | 461 bool InputMethodChromeOS::SendFakeProcessKeyEvent(bool pressed) const { |
458 if (!GetTextInputClient()) | |
459 return; | |
460 KeyEvent evt(pressed ? ET_KEY_PRESSED : ET_KEY_RELEASED, | 462 KeyEvent evt(pressed ? ET_KEY_PRESSED : ET_KEY_RELEASED, |
461 pressed ? VKEY_PROCESSKEY : VKEY_UNKNOWN, | 463 pressed ? VKEY_PROCESSKEY : VKEY_UNKNOWN, |
462 EF_IME_FABRICATED_KEY); | 464 EF_IME_FABRICATED_KEY); |
463 DispatchKeyEventPostIME(evt); | 465 ignore_result(DispatchKeyEventPostIME(&evt)); |
| 466 return evt.stopped_propagation(); |
464 } | 467 } |
465 | 468 |
466 void InputMethodChromeOS::CommitText(const std::string& text) { | 469 void InputMethodChromeOS::CommitText(const std::string& text) { |
467 if (text.empty()) | 470 if (text.empty()) |
468 return; | 471 return; |
469 | 472 |
470 // We need to receive input method result even if the text input type is | 473 // We need to receive input method result even if the text input type is |
471 // TEXT_INPUT_TYPE_NONE, to make sure we can always send correct | 474 // TEXT_INPUT_TYPE_NONE, to make sure we can always send correct |
472 // character for each key event to the focused text input client. | 475 // character for each key event to the focused text input client. |
473 if (!GetTextInputClient()) | 476 if (!GetTextInputClient()) |
474 return; | 477 return; |
475 | 478 |
476 const base::string16 utf16_text = base::UTF8ToUTF16(text); | 479 const base::string16 utf16_text = base::UTF8ToUTF16(text); |
477 if (utf16_text.empty()) | 480 if (utf16_text.empty()) |
478 return; | 481 return; |
479 | 482 |
480 // Append the text to the buffer, because commit signal might be fired | 483 // Append the text to the buffer, because commit signal might be fired |
481 // multiple times when processing a key event. | 484 // multiple times when processing a key event. |
482 result_text_.append(utf16_text); | 485 result_text_.append(utf16_text); |
483 | 486 |
484 // If we are not handling key event, do not bother sending text result if the | 487 // If we are not handling key event, do not bother sending text result if the |
485 // focused text input client does not support text input. | 488 // focused text input client does not support text input. |
486 if (!handling_key_event_ && !IsTextInputTypeNone()) { | 489 if (!handling_key_event_ && !IsTextInputTypeNone()) { |
487 SendFakeProcessKeyEvent(true); | 490 if (!SendFakeProcessKeyEvent(true)) |
488 GetTextInputClient()->InsertText(utf16_text); | 491 GetTextInputClient()->InsertText(utf16_text); |
489 SendFakeProcessKeyEvent(false); | 492 SendFakeProcessKeyEvent(false); |
490 result_text_.clear(); | 493 result_text_.clear(); |
491 } | 494 } |
492 } | 495 } |
493 | 496 |
494 void InputMethodChromeOS::UpdateCompositionText( | 497 void InputMethodChromeOS::UpdateCompositionText( |
495 const chromeos::CompositionText& text, | 498 const chromeos::CompositionText& text, |
496 uint32 cursor_pos, | 499 uint32 cursor_pos, |
497 bool visible) { | 500 bool visible) { |
498 if (IsTextInputTypeNone()) | 501 if (IsTextInputTypeNone()) |
(...skipping 22 matching lines...) Expand all Loading... |
521 | 524 |
522 composition_changed_ = true; | 525 composition_changed_ = true; |
523 | 526 |
524 // In case OnShowPreeditText() is not called. | 527 // In case OnShowPreeditText() is not called. |
525 if (composition_.text.length()) | 528 if (composition_.text.length()) |
526 composing_text_ = true; | 529 composing_text_ = true; |
527 | 530 |
528 if (!handling_key_event_) { | 531 if (!handling_key_event_) { |
529 // If we receive a composition text without pending key event, then we need | 532 // If we receive a composition text without pending key event, then we need |
530 // to send it to the focused text input client directly. | 533 // to send it to the focused text input client directly. |
531 SendFakeProcessKeyEvent(true); | 534 if (!SendFakeProcessKeyEvent(true)) |
532 GetTextInputClient()->SetCompositionText(composition_); | 535 GetTextInputClient()->SetCompositionText(composition_); |
533 SendFakeProcessKeyEvent(false); | 536 SendFakeProcessKeyEvent(false); |
534 composition_changed_ = false; | 537 composition_changed_ = false; |
535 composition_.Clear(); | 538 composition_.Clear(); |
536 } | 539 } |
537 } | 540 } |
538 | 541 |
539 void InputMethodChromeOS::HidePreeditText() { | 542 void InputMethodChromeOS::HidePreeditText() { |
540 if (composition_.text.empty() || IsTextInputTypeNone()) | 543 if (composition_.text.empty() || IsTextInputTypeNone()) |
541 return; | 544 return; |
542 | 545 |
543 // Intentionally leaves |composing_text_| unchanged. | 546 // Intentionally leaves |composing_text_| unchanged. |
544 composition_changed_ = true; | 547 composition_changed_ = true; |
545 composition_.Clear(); | 548 composition_.Clear(); |
546 | 549 |
547 if (!handling_key_event_) { | 550 if (!handling_key_event_) { |
548 TextInputClient* client = GetTextInputClient(); | 551 TextInputClient* client = GetTextInputClient(); |
549 if (client && client->HasCompositionText()) { | 552 if (client && client->HasCompositionText()) { |
550 SendFakeProcessKeyEvent(true); | 553 if (!SendFakeProcessKeyEvent(true)) |
551 client->ClearCompositionText(); | 554 client->ClearCompositionText(); |
552 SendFakeProcessKeyEvent(false); | 555 SendFakeProcessKeyEvent(false); |
553 } | 556 } |
554 composition_changed_ = false; | 557 composition_changed_ = false; |
555 } | 558 } |
556 } | 559 } |
557 | 560 |
558 void InputMethodChromeOS::DeleteSurroundingText(int32 offset, uint32 length) { | 561 void InputMethodChromeOS::DeleteSurroundingText(int32 offset, uint32 length) { |
559 if (!composition_.text.empty()) | 562 if (!composition_.text.empty()) |
560 return; // do nothing if there is ongoing composition. | 563 return; // do nothing if there is ongoing composition. |
561 | 564 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() { | 673 bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() { |
671 TextInputType type = GetTextInputType(); | 674 TextInputType type = GetTextInputType(); |
672 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); | 675 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); |
673 } | 676 } |
674 | 677 |
675 bool InputMethodChromeOS::IsInputFieldFocused() { | 678 bool InputMethodChromeOS::IsInputFieldFocused() { |
676 return GetTextInputType() != TEXT_INPUT_TYPE_NONE; | 679 return GetTextInputType() != TEXT_INPUT_TYPE_NONE; |
677 } | 680 } |
678 | 681 |
679 } // namespace ui | 682 } // namespace ui |
OLD | NEW |