Chromium Code Reviews

Side by Side Diff: ui/base/ime/input_method_auraandroid.cc

Issue 1391893003: NOT FOR REVIEW: Aura on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "mandoline/ui/aura/input_method_mandoline.h" 5 #include "ui/base/ime/input_method_auraandroid.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 9
10 namespace mandoline { 10 // TODO(mfomitchev): This is a copy of InputMethodMandoline.
11 // We should unify InputMethodMandoline, InputMethodMinimal, and this class.
12
13 namespace ui {
11 14
12 //////////////////////////////////////////////////////////////////////////////// 15 ////////////////////////////////////////////////////////////////////////////////
13 // InputMethodMandoline, public: 16 // InputMethodAuraAndroid, public:
14 17
15 InputMethodMandoline::InputMethodMandoline( 18 InputMethodAuraAndroid::InputMethodAuraAndroid(
16 ui::internal::InputMethodDelegate* delegate) { 19 ui::internal::InputMethodDelegate* delegate) {
20 LOG(ERROR) << "auraclank: InputMethodAuraAndroid ctor";
17 SetDelegate(delegate); 21 SetDelegate(delegate);
22 //hack, find the place to focus the input method
23 OnFocus();
18 } 24 }
19 25
20 InputMethodMandoline::~InputMethodMandoline() {} 26 InputMethodAuraAndroid::~InputMethodAuraAndroid() {}
21 27
22 //////////////////////////////////////////////////////////////////////////////// 28 ////////////////////////////////////////////////////////////////////////////////
23 // InputMethodMandoline, ui::InputMethod implementation: 29 // InputMethodAuraAndroid, ui::InputMethod implementation:
24 30
25 bool InputMethodMandoline::OnUntranslatedIMEMessage( 31 bool InputMethodAuraAndroid::OnUntranslatedIMEMessage(
26 const base::NativeEvent& event, 32 const base::NativeEvent& event,
27 NativeEventResult* result) { 33 NativeEventResult* result) {
28 return false; 34 return false;
29 } 35 }
30 36
31 void InputMethodMandoline::DispatchKeyEvent(ui::KeyEvent* event) { 37 void InputMethodAuraAndroid::DispatchKeyEvent(ui::KeyEvent* event) {
38 LOG(ERROR) << "auraclank: InputMethodAuraAndroid::DispatchKeyEvent";
32 DCHECK(event->type() == ui::ET_KEY_PRESSED || 39 DCHECK(event->type() == ui::ET_KEY_PRESSED ||
33 event->type() == ui::ET_KEY_RELEASED); 40 event->type() == ui::ET_KEY_RELEASED);
34 41
35 // If no text input client, do nothing. 42 // If no text input client, do nothing.
36 if (!GetTextInputClient()) { 43 if (!GetTextInputClient()) {
37 ignore_result(DispatchKeyEventPostIME(event)); 44 ignore_result(DispatchKeyEventPostIME(event));
38 return; 45 return;
39 } 46 }
40 47
41 // Here is where we change the differ from our base class's logic. Instead of 48 // 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 49 // 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 50 // 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.) 51 // send out the key if it is. (We fallback to normal dispatch if it isn't.)
45 if (event->is_char()) { 52 if (event->is_char()) {
46 GetTextInputClient()->InsertChar(event->GetCharacter(), event->flags()); 53 GetTextInputClient()->InsertChar(event->GetCharacter(), event->flags());
47 event->StopPropagation(); 54 event->StopPropagation();
48 return; 55 return;
49 } 56 }
50 57
51 ignore_result(DispatchKeyEventPostIME(event)); 58 ignore_result(DispatchKeyEventPostIME(event));
52 } 59 }
53 60
54 void InputMethodMandoline::OnCaretBoundsChanged( 61 void InputMethodAuraAndroid::OnCaretBoundsChanged(
55 const ui::TextInputClient* client) { 62 const ui::TextInputClient* client) {
56 } 63 }
57 64
58 void InputMethodMandoline::CancelComposition( 65 void InputMethodAuraAndroid::CancelComposition(
59 const ui::TextInputClient* client) { 66 const ui::TextInputClient* client) {
60 } 67 }
61 68
62 void InputMethodMandoline::OnInputLocaleChanged() { 69 void InputMethodAuraAndroid::OnInputLocaleChanged() {
63 } 70 }
64 71
65 std::string InputMethodMandoline::GetInputLocale() { 72 std::string InputMethodAuraAndroid::GetInputLocale() {
66 return ""; 73 return "";
67 } 74 }
68 75
69 bool InputMethodMandoline::IsCandidatePopupOpen() const { 76 bool InputMethodAuraAndroid::IsCandidatePopupOpen() const {
70 return false; 77 return false;
71 } 78 }
72 79
73 } // namespace mandoline 80 } // namespace ui
OLDNEW

Powered by Google App Engine