OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mock_input_method.h" | 5 #include "ui/base/ime/mock_input_method.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
| 9 #include "ui/base/events/event.h" |
9 #include "ui/base/events/event_constants.h" | 10 #include "ui/base/events/event_constants.h" |
10 #include "ui/base/glib/glib_integers.h" | 11 #include "ui/base/glib/glib_integers.h" |
11 #include "ui/base/ime/input_method_delegate.h" | 12 #include "ui/base/ime/input_method_delegate.h" |
12 #include "ui/base/ime/text_input_client.h" | 13 #include "ui/base/ime/text_input_client.h" |
13 #include "ui/base/keycodes/keyboard_code_conversion.h" | 14 #include "ui/base/keycodes/keyboard_code_conversion.h" |
14 | 15 |
15 #if defined(USE_X11) | 16 #if defined(USE_X11) |
16 #include <X11/X.h> | 17 #include <X11/X.h> |
17 #include <X11/Xlib.h> | 18 #include <X11/Xlib.h> |
18 #include <X11/Xutil.h> | 19 #include <X11/Xutil.h> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 if (ch) | 86 if (ch) |
86 text_input_client_->InsertChar(ch, state); | 87 text_input_client_->InsertChar(ch, state); |
87 } | 88 } |
88 } | 89 } |
89 #else | 90 #else |
90 // TODO(yusukes): Support other platforms. Call InsertChar() when necessary. | 91 // TODO(yusukes): Support other platforms. Call InsertChar() when necessary. |
91 delegate_->DispatchKeyEventPostIME(native_event); | 92 delegate_->DispatchKeyEventPostIME(native_event); |
92 #endif | 93 #endif |
93 } | 94 } |
94 | 95 |
| 96 void MockInputMethod::DispatchFabricatedKeyEvent(const ui::KeyEvent& event) { |
| 97 #if defined(OS_WIN) |
| 98 delegate_->DispatchFabricatedKeyEventPostIME(event.type(), |
| 99 event.key_code(), |
| 100 event.flags()); |
| 101 #endif |
| 102 } |
| 103 |
95 void MockInputMethod::Init(bool focused) {} | 104 void MockInputMethod::Init(bool focused) {} |
96 void MockInputMethod::OnFocus() {} | 105 void MockInputMethod::OnFocus() {} |
97 void MockInputMethod::OnBlur() {} | 106 void MockInputMethod::OnBlur() {} |
98 void MockInputMethod::OnTextInputTypeChanged(const TextInputClient* client) {} | 107 void MockInputMethod::OnTextInputTypeChanged(const TextInputClient* client) {} |
99 void MockInputMethod::OnCaretBoundsChanged(const TextInputClient* client) {} | 108 void MockInputMethod::OnCaretBoundsChanged(const TextInputClient* client) {} |
100 void MockInputMethod::CancelComposition(const TextInputClient* client) {} | 109 void MockInputMethod::CancelComposition(const TextInputClient* client) {} |
101 | 110 |
102 std::string MockInputMethod::GetInputLocale() { | 111 std::string MockInputMethod::GetInputLocale() { |
103 return ""; | 112 return ""; |
104 } | 113 } |
105 | 114 |
106 base::i18n::TextDirection MockInputMethod::GetInputTextDirection() { | 115 base::i18n::TextDirection MockInputMethod::GetInputTextDirection() { |
107 return base::i18n::UNKNOWN_DIRECTION; | 116 return base::i18n::UNKNOWN_DIRECTION; |
108 } | 117 } |
109 | 118 |
110 bool MockInputMethod::IsActive() { | 119 bool MockInputMethod::IsActive() { |
111 return true; | 120 return true; |
112 } | 121 } |
113 | 122 |
114 ui::TextInputType MockInputMethod::GetTextInputType() const { | 123 ui::TextInputType MockInputMethod::GetTextInputType() const { |
115 return ui::TEXT_INPUT_TYPE_NONE; | 124 return ui::TEXT_INPUT_TYPE_NONE; |
116 } | 125 } |
117 | 126 |
118 bool MockInputMethod::CanComposeInline() const { | 127 bool MockInputMethod::CanComposeInline() const { |
119 return true; | 128 return true; |
120 } | 129 } |
121 | 130 |
122 } // namespace ui | 131 } // namespace ui |
OLD | NEW |