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/views/ime/input_method_win.h" | 5 #include "ui/views/ime/input_method_win.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "ui/base/event.h" | 10 #include "ui/base/event.h" |
| 11 #include "ui/base/events.h" |
11 #include "ui/base/ime/composition_text.h" | 12 #include "ui/base/ime/composition_text.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_codes.h" | 14 #include "ui/base/keycodes/keyboard_codes.h" |
14 #include "ui/views/events/event.h" | |
15 | 15 |
16 // Extra number of chars before and after selection (or composition) range which | 16 // Extra number of chars before and after selection (or composition) range which |
17 // is returned to IME for improving conversion accuracy. | 17 // is returned to IME for improving conversion accuracy. |
18 static const size_t kExtraNumberOfChars = 20; | 18 static const size_t kExtraNumberOfChars = 20; |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 | 21 |
22 InputMethodWin::InputMethodWin(internal::InputMethodDelegate* delegate) | 22 InputMethodWin::InputMethodWin(internal::InputMethodDelegate* delegate) |
23 : active_(false), | 23 : active_(false), |
24 direction_(base::i18n::UNKNOWN_DIRECTION), | 24 direction_(base::i18n::UNKNOWN_DIRECTION), |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 LRESULT InputMethodWin::OnChar( | 255 LRESULT InputMethodWin::OnChar( |
256 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled) { | 256 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled) { |
257 *handled = TRUE; | 257 *handled = TRUE; |
258 | 258 |
259 // We need to send character events to the focused text input client event if | 259 // We need to send character events to the focused text input client event if |
260 // its text input type is ui::TEXT_INPUT_TYPE_NONE. | 260 // its text input type is ui::TEXT_INPUT_TYPE_NONE. |
261 if (!GetTextInputClient()) | 261 if (!GetTextInputClient()) |
262 return 0; | 262 return 0; |
263 | 263 |
264 GetTextInputClient()->InsertChar(static_cast<char16>(wparam), | 264 GetTextInputClient()->InsertChar(static_cast<char16>(wparam), |
265 GetModifiersFromKeyState()); | 265 ui::GetModifiersFromKeyState()); |
266 return 0; | 266 return 0; |
267 } | 267 } |
268 | 268 |
269 LRESULT InputMethodWin::OnDeadChar( | 269 LRESULT InputMethodWin::OnDeadChar( |
270 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled) { | 270 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled) { |
271 *handled = TRUE; | 271 *handled = TRUE; |
272 | 272 |
273 if (IsTextInputTypeNone()) | 273 if (IsTextInputTypeNone()) |
274 return 0; | 274 return 0; |
275 | 275 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 case ui::TEXT_INPUT_TYPE_PASSWORD: | 420 case ui::TEXT_INPUT_TYPE_PASSWORD: |
421 ime_input_.DisableIME(hwnd()); | 421 ime_input_.DisableIME(hwnd()); |
422 break; | 422 break; |
423 default: | 423 default: |
424 ime_input_.EnableIME(hwnd()); | 424 ime_input_.EnableIME(hwnd()); |
425 break; | 425 break; |
426 } | 426 } |
427 } | 427 } |
428 | 428 |
429 } // namespace views | 429 } // namespace views |
OLD | NEW |