OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_REMOTE_INPUT_METHOD_WIN_H_ | 5 #ifndef UI_BASE_IME_REMOTE_INPUT_METHOD_WIN_H_ |
6 #define UI_BASE_IME_REMOTE_INPUT_METHOD_WIN_H_ | 6 #define UI_BASE_IME_REMOTE_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 "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/strings/string16.h" |
15 #include "ui/base/ui_export.h" | 16 #include "ui/base/ui_export.h" |
16 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
17 | 18 |
18 namespace ui { | 19 namespace ui { |
19 namespace internal { | 20 namespace internal { |
20 class InputMethodDelegate; | 21 class InputMethodDelegate; |
21 class RemoteInputMethodDelegateWin; | 22 class RemoteInputMethodDelegateWin; |
22 } // namespace internal | 23 } // namespace internal |
23 | 24 |
24 class InputMethod; | 25 class InputMethod; |
| 26 struct CompositionText; |
25 | 27 |
26 // RemoteInputMethodWin is a special implementation of ui::InputMethod that | 28 // RemoteInputMethodWin is a special implementation of ui::InputMethod that |
27 // works as a proxy of an IME handler running in the metro_driver process. | 29 // works as a proxy of an IME handler running in the metro_driver process. |
28 // RemoteInputMethodWin works as follows. | 30 // RemoteInputMethodWin works as follows. |
29 // - Any action to RemoteInputMethodPrivateWin should be delegated to the | 31 // - Any action to RemoteInputMethodWin should be delegated to the |
30 // metro_driver process via RemoteInputMethodDelegateWin. | 32 // metro_driver process via RemoteInputMethodDelegateWin. |
31 // - Data retrieval from RemoteInputMethodPrivateWin is implemented with | 33 // - Data retrieval from RemoteInputMethodPrivateWin is implemented with |
32 // data cache. Whenever the IME state in the metro_driver process is changed, | 34 // data cache. Whenever the IME state in the metro_driver process is changed, |
33 // RemoteRootWindowHostWin, which receives IPCs from metro_driver process, | 35 // RemoteRootWindowHostWin, which receives IPCs from metro_driver process, |
34 // will call RemoteInputMethodPrivateWin::OnCandidatePopupChanged and/or | 36 // will call RemoteInputMethodPrivateWin::OnCandidatePopupChanged and/or |
35 // RemoteInputMethodPrivateWin::OnInputSourceChanged accordingly so that | 37 // RemoteInputMethodPrivateWin::OnInputSourceChanged accordingly so that |
36 // the state cache should be updated. | 38 // the state cache should be updated. |
| 39 // - Some IPC messages that represent actions to TextInputClient should be |
| 40 // delegated to RemoteInputMethodPrivateWin so that RemoteInputMethodWin can |
| 41 // work as a real proxy. |
37 | 42 |
38 // Returns true if |widget| requires RemoteInputMethodWin. | 43 // Returns true if |widget| requires RemoteInputMethodWin. |
39 bool IsRemoteInputMethodWinRequired(gfx::AcceleratedWidget widget); | 44 bool IsRemoteInputMethodWinRequired(gfx::AcceleratedWidget widget); |
40 | 45 |
41 // Returns the public interface of RemoteInputMethodWin. | 46 // Returns the public interface of RemoteInputMethodWin. |
42 // Caveats: Currently only one instance of RemoteInputMethodWin is able to run | 47 // Caveats: Currently only one instance of RemoteInputMethodWin is able to run |
43 // at the same time. | 48 // at the same time. |
44 UI_EXPORT scoped_ptr<InputMethod> CreateRemoteInputMethodWin( | 49 UI_EXPORT scoped_ptr<InputMethod> CreateRemoteInputMethodWin( |
45 internal::InputMethodDelegate* delegate); | 50 internal::InputMethodDelegate* delegate); |
46 | 51 |
(...skipping 18 matching lines...) Expand all Loading... |
65 // RemoteInputMethodWin::IsCandidatePopupOpen can return the correct value | 70 // RemoteInputMethodWin::IsCandidatePopupOpen can return the correct value |
66 // based on remote IME activities in the metro_driver process. | 71 // based on remote IME activities in the metro_driver process. |
67 virtual void OnCandidatePopupChanged(bool visible) = 0; | 72 virtual void OnCandidatePopupChanged(bool visible) = 0; |
68 | 73 |
69 // Updates internal cache so that subsequent calls of | 74 // Updates internal cache so that subsequent calls of |
70 // RemoteInputMethodWin::GetInputLocale and | 75 // RemoteInputMethodWin::GetInputLocale and |
71 // RemoteInputMethodWin::GetInputTextDirection can return the correct | 76 // RemoteInputMethodWin::GetInputTextDirection can return the correct |
72 // values based on remote IME activities in the metro_driver process. | 77 // values based on remote IME activities in the metro_driver process. |
73 virtual void OnInputSourceChanged(LANGID langid, bool is_ime) = 0; | 78 virtual void OnInputSourceChanged(LANGID langid, bool is_ime) = 0; |
74 | 79 |
| 80 // Handles composition-update events occurred in the metro_driver process. |
| 81 // Caveats: This method is designed to be used only with |
| 82 // metro_driver::TextService. In other words, there is no garantee that this |
| 83 // method works a wrapper to call ui::TextInputClient::SetCompositionText. |
| 84 virtual void OnCompositionChanged( |
| 85 const CompositionText& composition_text) = 0; |
| 86 |
| 87 // Handles text-commit events occurred in the metro_driver process. |
| 88 // Caveats: This method is designed to be used only with |
| 89 // metro_driver::TextService. In other words, there is no garantee that this |
| 90 // method works a wrapper to call ui::TextInputClient::InsertText. In fact, |
| 91 // this method may call ui::TextInputClient::InsertChar when the text input |
| 92 // type of the focused text input client is TEXT_INPUT_TYPE_NONE. |
| 93 virtual void OnTextCommitted(const base::string16& text) = 0; |
| 94 |
75 private: | 95 private: |
76 DISALLOW_COPY_AND_ASSIGN(RemoteInputMethodPrivateWin); | 96 DISALLOW_COPY_AND_ASSIGN(RemoteInputMethodPrivateWin); |
77 }; | 97 }; |
78 | 98 |
79 } // namespace ui | 99 } // namespace ui |
80 | 100 |
81 #endif // UI_BASE_IME_REMOTE_INPUT_METHOD_WIN_H_ | 101 #endif // UI_BASE_IME_REMOTE_INPUT_METHOD_WIN_H_ |
OLD | NEW |