OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_TSF_H_ | 5 #ifndef UI_BASE_IME_INPUT_METHOD_TSF_H_ |
6 #define UI_BASE_IME_INPUT_METHOD_TSF_H_ | 6 #define UI_BASE_IME_INPUT_METHOD_TSF_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
| 12 #include "base/memory/scoped_ptr.h" |
12 #include "ui/base/ime/input_method_win.h" | 13 #include "ui/base/ime/input_method_win.h" |
13 | 14 |
14 namespace ui { | 15 namespace ui { |
15 | 16 |
| 17 class TSFEventRouter; |
| 18 |
16 // An InputMethod implementation based on Windows TSF API. | 19 // An InputMethod implementation based on Windows TSF API. |
17 class UI_EXPORT InputMethodTSF : public InputMethodWin { | 20 class UI_EXPORT InputMethodTSF : public InputMethodWin { |
18 public: | 21 public: |
19 InputMethodTSF(internal::InputMethodDelegate* delegate, | 22 InputMethodTSF(internal::InputMethodDelegate* delegate, |
20 HWND toplevel_window_handle); | 23 HWND toplevel_window_handle); |
| 24 virtual ~InputMethodTSF(); |
21 | 25 |
22 // Overridden from InputMethod: | 26 // Overridden from InputMethod: |
23 virtual void OnFocus() OVERRIDE; | 27 virtual void OnFocus() OVERRIDE; |
24 virtual void OnBlur() OVERRIDE; | 28 virtual void OnBlur() OVERRIDE; |
25 virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, | 29 virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, |
26 NativeEventResult* result) OVERRIDE; | 30 NativeEventResult* result) OVERRIDE; |
27 virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; | 31 virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; |
28 virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE; | 32 virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE; |
29 virtual void CancelComposition(const TextInputClient* client) OVERRIDE; | 33 virtual void CancelComposition(const TextInputClient* client) OVERRIDE; |
30 virtual void SetFocusedTextInputClient(TextInputClient* client) OVERRIDE; | 34 virtual void SetFocusedTextInputClient(TextInputClient* client) OVERRIDE; |
31 virtual bool IsCandidatePopupOpen() const OVERRIDE; | 35 virtual bool IsCandidatePopupOpen() const OVERRIDE; |
32 | 36 |
33 // Overridden from InputMethodBase: | 37 // Overridden from InputMethodBase: |
34 virtual void OnWillChangeFocusedClient(TextInputClient* focused_before, | 38 virtual void OnWillChangeFocusedClient(TextInputClient* focused_before, |
35 TextInputClient* focused) OVERRIDE; | 39 TextInputClient* focused) OVERRIDE; |
36 virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, | 40 virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, |
37 TextInputClient* focused) OVERRIDE; | 41 TextInputClient* focused) OVERRIDE; |
38 | 42 |
39 private: | 43 private: |
| 44 class TSFEventObserver; |
| 45 |
40 // Asks the client to confirm current composition text. | 46 // Asks the client to confirm current composition text. |
41 void ConfirmCompositionText(); | 47 void ConfirmCompositionText(); |
42 | 48 |
43 // Returns true if the Win32 native window bound to |client| has Win32 input | 49 // Returns true if the Win32 native window bound to |client| has Win32 input |
44 // focus. | 50 // focus. |
45 bool IsWindowFocused(const TextInputClient* client) const; | 51 bool IsWindowFocused(const TextInputClient* client) const; |
46 | 52 |
| 53 // TSF event router and observer. |
| 54 scoped_ptr<TSFEventObserver> tsf_event_observer_; |
| 55 scoped_ptr<TSFEventRouter> tsf_event_router_; |
| 56 |
47 DISALLOW_COPY_AND_ASSIGN(InputMethodTSF); | 57 DISALLOW_COPY_AND_ASSIGN(InputMethodTSF); |
48 }; | 58 }; |
49 | 59 |
50 } // namespace ui | 60 } // namespace ui |
51 | 61 |
52 #endif // UI_BASE_IME_INPUT_METHOD_TSF_H_ | 62 #endif // UI_BASE_IME_INPUT_METHOD_TSF_H_ |
OLD | NEW |