| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_minimal.h" | 5 #include "ui/base/ime/input_method_minimal.h" |
| 6 | 6 |
| 7 #include "ui/base/ime/text_input_client.h" | 7 #include "ui/base/ime/text_input_client.h" |
| 8 #include "ui/events/event.h" | 8 #include "ui/events/event.h" |
| 9 #include "ui/events/event_constants.h" | 9 #include "ui/events/event_constants.h" |
| 10 | 10 |
| 11 namespace ui { | 11 namespace ui { |
| 12 | 12 |
| 13 InputMethodMinimal::InputMethodMinimal( | 13 InputMethodMinimal::InputMethodMinimal( |
| 14 internal::InputMethodDelegate* delegate) { | 14 internal::InputMethodDelegate* delegate) { |
| 15 SetDelegate(delegate); | 15 SetDelegate(delegate); |
| 16 } | 16 } |
| 17 | 17 |
| 18 InputMethodMinimal::~InputMethodMinimal() {} | 18 InputMethodMinimal::~InputMethodMinimal() {} |
| 19 | 19 |
| 20 bool InputMethodMinimal::OnUntranslatedIMEMessage( | 20 bool InputMethodMinimal::OnUntranslatedIMEMessage( |
| 21 const base::NativeEvent& event, | 21 const base::NativeEvent& event, |
| 22 NativeEventResult* result) { | 22 NativeEventResult* result) { |
| 23 return false; | 23 return false; |
| 24 } | 24 } |
| 25 | 25 |
| 26 bool InputMethodMinimal::DispatchKeyEvent(const ui::KeyEvent& event) { | 26 void InputMethodMinimal::DispatchKeyEvent(ui::KeyEvent* event) { |
| 27 DCHECK(event.type() == ET_KEY_PRESSED || event.type() == ET_KEY_RELEASED); | 27 DCHECK(event->type() == ET_KEY_PRESSED || event->type() == ET_KEY_RELEASED); |
| 28 | 28 |
| 29 // If no text input client, do nothing. | 29 // If no text input client, do nothing. |
| 30 if (!GetTextInputClient()) | 30 if (!GetTextInputClient()) { |
| 31 return DispatchKeyEventPostIME(event); | 31 ignore_result(DispatchKeyEventPostIME(event)); |
| 32 return; |
| 33 } |
| 32 | 34 |
| 33 // Insert the character. | 35 // Insert the character. |
| 34 const bool handled = DispatchKeyEventPostIME(event); | 36 ignore_result(DispatchKeyEventPostIME(event)); |
| 35 if (event.type() == ET_KEY_PRESSED && GetTextInputClient()) { | 37 if (event->type() == ET_KEY_PRESSED && GetTextInputClient()) { |
| 36 const uint16 ch = event.GetCharacter(); | 38 const uint16 ch = event->GetCharacter(); |
| 37 if (ch) { | 39 if (ch) { |
| 38 GetTextInputClient()->InsertChar(ch, event.flags()); | 40 GetTextInputClient()->InsertChar(ch, event->flags()); |
| 39 return true; | 41 event->StopPropagation(); |
| 40 } | 42 } |
| 41 } | 43 } |
| 42 return handled; | |
| 43 } | 44 } |
| 44 | 45 |
| 45 void InputMethodMinimal::OnCaretBoundsChanged(const TextInputClient* client) {} | 46 void InputMethodMinimal::OnCaretBoundsChanged(const TextInputClient* client) {} |
| 46 | 47 |
| 47 void InputMethodMinimal::CancelComposition(const TextInputClient* client) {} | 48 void InputMethodMinimal::CancelComposition(const TextInputClient* client) {} |
| 48 | 49 |
| 49 void InputMethodMinimal::OnInputLocaleChanged() {} | 50 void InputMethodMinimal::OnInputLocaleChanged() {} |
| 50 | 51 |
| 51 std::string InputMethodMinimal::GetInputLocale() { | 52 std::string InputMethodMinimal::GetInputLocale() { |
| 52 return std::string(); | 53 return std::string(); |
| 53 } | 54 } |
| 54 | 55 |
| 55 bool InputMethodMinimal::IsCandidatePopupOpen() const { | 56 bool InputMethodMinimal::IsCandidatePopupOpen() const { |
| 56 return false; | 57 return false; |
| 57 } | 58 } |
| 58 | 59 |
| 59 } // namespace ui | 60 } // namespace ui |
| OLD | NEW |