OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef UI_BASE_IME_INPUT_METHOD_WIN_H_ | 5 #ifndef UI_BASE_IME_INPUT_METHOD_WIN_H_ |
6 #define UI_BASE_IME_INPUT_METHOD_WIN_H_ | 6 #define UI_BASE_IME_INPUT_METHOD_WIN_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "ui/base/ime/input_method_base.h" | 14 #include "ui/base/ime/input_method_base.h" |
15 #include "ui/base/ime/win/imm32_manager.h" | 15 #include "ui/base/ime/win/imm32_manager.h" |
16 | 16 |
17 namespace ui { | 17 namespace ui { |
18 | 18 |
19 // A common InputMethod implementation based on IMM32. | 19 // A common InputMethod implementation based on IMM32. |
20 class UI_BASE_IME_EXPORT InputMethodWin : public InputMethodBase { | 20 class UI_BASE_IME_EXPORT InputMethodWin : public InputMethodBase { |
21 public: | 21 public: |
22 InputMethodWin(internal::InputMethodDelegate* delegate, | 22 InputMethodWin(internal::InputMethodDelegate* delegate, |
23 HWND toplevel_window_handle); | 23 HWND toplevel_window_handle); |
24 ~InputMethodWin() override; | |
25 | 24 |
26 // Overridden from InputMethod: | 25 // Overridden from InputMethod: |
27 void OnFocus() override; | 26 void OnFocus() override; |
28 void OnBlur() override; | 27 void OnBlur() override; |
29 bool OnUntranslatedIMEMessage(const base::NativeEvent& event, | 28 bool OnUntranslatedIMEMessage(const base::NativeEvent& event, |
30 NativeEventResult* result) override; | 29 NativeEventResult* result) override; |
31 bool DispatchKeyEvent(const ui::KeyEvent& event) override; | 30 void DispatchKeyEvent(ui::KeyEvent* event) override; |
32 void OnTextInputTypeChanged(const TextInputClient* client) override; | 31 void OnTextInputTypeChanged(const TextInputClient* client) override; |
33 void OnCaretBoundsChanged(const TextInputClient* client) override; | 32 void OnCaretBoundsChanged(const TextInputClient* client) override; |
34 void CancelComposition(const TextInputClient* client) override; | 33 void CancelComposition(const TextInputClient* client) override; |
35 void OnInputLocaleChanged() override; | 34 void OnInputLocaleChanged() override; |
36 std::string GetInputLocale() override; | 35 std::string GetInputLocale() override; |
37 bool IsCandidatePopupOpen() const override; | 36 bool IsCandidatePopupOpen() const override; |
38 | 37 |
39 protected: | 38 protected: |
40 // Overridden from InputMethodBase: | 39 // Overridden from InputMethodBase: |
41 // If a derived class overrides this method, it should call parent's | 40 // If a derived class overrides this method, it should call parent's |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 LPARAM lparam, | 85 LPARAM lparam, |
87 BOOL* handled); | 86 BOOL* handled); |
88 LRESULT OnDocumentFeed(RECONVERTSTRING* reconv); | 87 LRESULT OnDocumentFeed(RECONVERTSTRING* reconv); |
89 LRESULT OnReconvertString(RECONVERTSTRING* reconv); | 88 LRESULT OnReconvertString(RECONVERTSTRING* reconv); |
90 LRESULT OnQueryCharPosition(IMECHARPOSITION* char_positon); | 89 LRESULT OnQueryCharPosition(IMECHARPOSITION* char_positon); |
91 | 90 |
92 // Returns true if the Win32 native window bound to |client| is considered | 91 // Returns true if the Win32 native window bound to |client| is considered |
93 // to be ready for receiving keyboard input. | 92 // to be ready for receiving keyboard input. |
94 bool IsWindowFocused(const TextInputClient* client) const; | 93 bool IsWindowFocused(const TextInputClient* client) const; |
95 | 94 |
96 bool DispatchFabricatedKeyEvent(const ui::KeyEvent& event); | 95 void DispatchFabricatedKeyEvent(ui::KeyEvent* event); |
97 | 96 |
98 // Asks the client to confirm current composition text. | 97 // Asks the client to confirm current composition text. |
99 void ConfirmCompositionText(); | 98 void ConfirmCompositionText(); |
100 | 99 |
101 // Enables or disables the IME according to the current text input type. | 100 // Enables or disables the IME according to the current text input type. |
102 void UpdateIMEState(); | 101 void UpdateIMEState(); |
103 | 102 |
104 // Windows IMM32 wrapper. | 103 // Windows IMM32 wrapper. |
105 // (See "ui/base/ime/win/ime_input.h" for its details.) | 104 // (See "ui/base/ime/win/ime_input.h" for its details.) |
106 ui::IMM32Manager imm32_manager_; | 105 ui::IMM32Manager imm32_manager_; |
(...skipping 20 matching lines...) Expand all Loading... |
127 bool is_candidate_popup_open_; | 126 bool is_candidate_popup_open_; |
128 | 127 |
129 // Window handle where composition is on-going. NULL when there is no | 128 // Window handle where composition is on-going. NULL when there is no |
130 // composition. | 129 // composition. |
131 HWND composing_window_handle_; | 130 HWND composing_window_handle_; |
132 | 131 |
133 // Set to true to suppress the next WM_CHAR, when the WM_KEYDOWN gets stopped | 132 // Set to true to suppress the next WM_CHAR, when the WM_KEYDOWN gets stopped |
134 // propagation (e.g. triggered an accelerator). | 133 // propagation (e.g. triggered an accelerator). |
135 bool suppress_next_char_; | 134 bool suppress_next_char_; |
136 | 135 |
137 // The pointer to a boolean value which indicates whether this InputMethod | |
138 // instance is destroyed. This is used in DispatchKeyEvent to detect whether | |
139 // DispatchKeyEventPostIME will cause destruction of this InputMethod | |
140 // instance. See crbug.com/513917. | |
141 bool* destroyed_ptr_; | |
142 | |
143 DISALLOW_COPY_AND_ASSIGN(InputMethodWin); | 136 DISALLOW_COPY_AND_ASSIGN(InputMethodWin); |
144 }; | 137 }; |
145 | 138 |
146 } // namespace ui | 139 } // namespace ui |
147 | 140 |
148 #endif // UI_BASE_IME_INPUT_METHOD_WIN_H_ | 141 #endif // UI_BASE_IME_INPUT_METHOD_WIN_H_ |
OLD | NEW |