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/ime/composition_text.h" | 11 #include "ui/base/ime/composition_text.h" |
11 #include "ui/base/ime/text_input_client.h" | 12 #include "ui/base/ime/text_input_client.h" |
12 #include "ui/base/keycodes/keyboard_codes.h" | 13 #include "ui/base/keycodes/keyboard_codes.h" |
13 #include "ui/views/events/event.h" | 14 #include "ui/views/events/event.h" |
14 | 15 |
15 // 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 |
16 // is returned to IME for improving conversion accuracy. | 17 // is returned to IME for improving conversion accuracy. |
17 static const size_t kExtraNumberOfChars = 20; | 18 static const size_t kExtraNumberOfChars = 20; |
18 | 19 |
19 namespace views { | 20 namespace views { |
(...skipping 22 matching lines...) Expand all Loading... |
42 InputMethodBase::OnFocus(); | 43 InputMethodBase::OnFocus(); |
43 UpdateIMEState(); | 44 UpdateIMEState(); |
44 } | 45 } |
45 | 46 |
46 void InputMethodWin::OnBlur() { | 47 void InputMethodWin::OnBlur() { |
47 DCHECK(widget_focused()); | 48 DCHECK(widget_focused()); |
48 ConfirmCompositionText(); | 49 ConfirmCompositionText(); |
49 InputMethodBase::OnBlur(); | 50 InputMethodBase::OnBlur(); |
50 } | 51 } |
51 | 52 |
52 void InputMethodWin::DispatchKeyEvent(const KeyEvent& key) { | 53 void InputMethodWin::DispatchKeyEvent(const ui::KeyEvent& key) { |
53 // Handles ctrl-shift key to change text direction and layout alignment. | 54 // Handles ctrl-shift key to change text direction and layout alignment. |
54 if (ui::ImeInput::IsRTLKeyboardLayoutInstalled() && !IsTextInputTypeNone()) { | 55 if (ui::ImeInput::IsRTLKeyboardLayoutInstalled() && !IsTextInputTypeNone()) { |
55 ui::KeyboardCode code = key.key_code(); | 56 ui::KeyboardCode code = key.key_code(); |
56 if (key.type() == ui::ET_KEY_PRESSED) { | 57 if (key.type() == ui::ET_KEY_PRESSED) { |
57 if (code == ui::VKEY_SHIFT) { | 58 if (code == ui::VKEY_SHIFT) { |
58 base::i18n::TextDirection dir; | 59 base::i18n::TextDirection dir; |
59 if (ui::ImeInput::IsCtrlShiftPressed(&dir)) | 60 if (ui::ImeInput::IsCtrlShiftPressed(&dir)) |
60 pending_requested_direction_ = dir; | 61 pending_requested_direction_ = dir; |
61 } else if (code != ui::VKEY_CONTROL) { | 62 } else if (code != ui::VKEY_CONTROL) { |
62 pending_requested_direction_ = base::i18n::UNKNOWN_DIRECTION; | 63 pending_requested_direction_ = base::i18n::UNKNOWN_DIRECTION; |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 case ui::TEXT_INPUT_TYPE_PASSWORD: | 420 case ui::TEXT_INPUT_TYPE_PASSWORD: |
420 ime_input_.DisableIME(hwnd()); | 421 ime_input_.DisableIME(hwnd()); |
421 break; | 422 break; |
422 default: | 423 default: |
423 ime_input_.EnableIME(hwnd()); | 424 ime_input_.EnableIME(hwnd()); |
424 break; | 425 break; |
425 } | 426 } |
426 } | 427 } |
427 | 428 |
428 } // namespace views | 429 } // namespace views |
OLD | NEW |