OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/base/ime/input_method_auraandroid.h" | |
6 | |
7 #include "ui/base/ime/text_input_client.h" | |
8 #include "ui/events/event.h" | |
9 | |
10 // TODO(bshe): This is currently very similar to InputMethodMUS. Consider unify | |
11 // them in the furture if the two have reasonable similarity. | |
12 | |
13 namespace ui { | |
14 | |
15 //////////////////////////////////////////////////////////////////////////////// | |
16 // InputMethodAuraAndroid, public: | |
17 | |
18 InputMethodAuraAndroid::InputMethodAuraAndroid( | |
19 internal::InputMethodDelegate* delegate) { | |
20 SetDelegate(delegate); | |
mfomitchev
2015/10/15 18:19:59
We don't need to call OnFocus() here like we do in
bshe
2015/10/15 18:27:14
I want to add it in follow up cls (probably part o
mfomitchev
2015/10/15 18:29:05
Acknowledged.
| |
21 } | |
22 | |
23 InputMethodAuraAndroid::~InputMethodAuraAndroid() {} | |
24 | |
25 bool InputMethodAuraAndroid::OnUntranslatedIMEMessage( | |
26 const base::NativeEvent& event, | |
27 NativeEventResult* result) { | |
28 return false; | |
29 } | |
30 | |
31 void InputMethodAuraAndroid::DispatchKeyEvent(ui::KeyEvent* event) { | |
32 DCHECK(event->type() == ui::ET_KEY_PRESSED || | |
33 event->type() == ui::ET_KEY_RELEASED); | |
34 | |
35 // If no text input client, do nothing. | |
36 if (!GetTextInputClient()) { | |
37 ignore_result(DispatchKeyEventPostIME(event)); | |
38 return; | |
39 } | |
40 | |
41 // Here is where we change the differ from our base class's logic. Instead of | |
42 // always dispatching a key down event, and then sending a synthesized | |
43 // character event, we instead check to see if this is a character event and | |
44 // send out the key if it is. (We fallback to normal dispatch if it isn't.) | |
45 if (event->is_char()) { | |
46 GetTextInputClient()->InsertChar(*event); | |
47 event->StopPropagation(); | |
48 return; | |
49 } | |
50 | |
51 ignore_result(DispatchKeyEventPostIME(event)); | |
52 } | |
53 | |
54 void InputMethodAuraAndroid::OnCaretBoundsChanged( | |
55 const ui::TextInputClient* client) { | |
56 } | |
57 | |
58 void InputMethodAuraAndroid::CancelComposition( | |
59 const ui::TextInputClient* client) { | |
60 } | |
61 | |
62 void InputMethodAuraAndroid::OnInputLocaleChanged() {} | |
63 | |
64 std::string InputMethodAuraAndroid::GetInputLocale() { | |
65 return ""; | |
66 } | |
67 | |
68 bool InputMethodAuraAndroid::IsCandidatePopupOpen() const { | |
69 return false; | |
70 } | |
71 | |
72 } // namespace ui | |
OLD | NEW |