OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_BASE_IME_REMOTE_INPUT_METHOD_WIN_H_ |
| 6 #define UI_BASE_IME_REMOTE_INPUT_METHOD_WIN_H_ |
| 7 |
| 8 #include <Windows.h> |
| 9 |
| 10 #include <string> |
| 11 |
| 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "ui/base/ui_export.h" |
| 16 |
| 17 namespace ui { |
| 18 namespace internal { |
| 19 class InputMethodDelegate; |
| 20 class RemoteInputMethodDelegateWin; |
| 21 } // namespace internal |
| 22 |
| 23 class InputMethod; |
| 24 |
| 25 // RemoteInputMethodWin is a special implementation of ui::InputMethod that |
| 26 // works as a proxy of an IME handler running in the metro_driver process. |
| 27 // RemoteInputMethodWin works as follows. |
| 28 // - Any action to RemoteInputMethodPrivateWin should be delegated to the |
| 29 // metro_driver process via RemoteInputMethodDelegateWin. |
| 30 // - Data retrieval from RemoteInputMethodPrivateWin is implemented with |
| 31 // data cache. Whenever the IME state in the metro_driver process is changed, |
| 32 // RemoteRootWindowHostWin, which receives IPCs from metro_driver process, |
| 33 // will call RemoteInputMethodPrivateWin::OnCandidatePopupChanged and/or |
| 34 // RemoteInputMethodPrivateWin::OnInputSourceChanged accordingly so that |
| 35 // the state cache should be updated. |
| 36 // Caveats: RemoteInputMethodWin does not support InputMethodObserver yet. |
| 37 |
| 38 // Returns the public interface of RemoteInputMethodWin. |
| 39 // Caveats: Currently only one instance of RemoteInputMethodWin is able to run |
| 40 // at the same time. |
| 41 UI_EXPORT scoped_ptr<InputMethod> CreateRemoteInputMethodWin( |
| 42 internal::InputMethodDelegate* delegate); |
| 43 |
| 44 // Private interface of RemoteInputMethodWin. |
| 45 class UI_EXPORT RemoteInputMethodPrivateWin { |
| 46 public: |
| 47 RemoteInputMethodPrivateWin(); |
| 48 |
| 49 // Returns the private interface of RemoteInputMethodWin when and only when |
| 50 // |input_method| is instanciated via CreateRemoteInputMethodWin. Caller does |
| 51 // not take the ownership of the returned object. |
| 52 // As you might notice, this is yet another reinplementation of dynamic_cast |
| 53 // or IUnknown::QueryInterface. |
| 54 static RemoteInputMethodPrivateWin* Get(InputMethod* input_method); |
| 55 |
| 56 // Installs RemoteInputMethodDelegateWin delegate. Set NULL to |delegate| to |
| 57 // unregister. |
| 58 virtual void SetRemoteDelegate( |
| 59 internal::RemoteInputMethodDelegateWin* delegate) = 0; |
| 60 |
| 61 // Updates internal cache so that subsequent calls of |
| 62 // RemoteInputMethodWin::IsCandidatePopupOpen can return the correct value |
| 63 // based on remote IME activities in the metro_driver process. |
| 64 virtual void OnCandidatePopupChanged(bool visible) = 0; |
| 65 |
| 66 // Updates internal cache so that subsequent calls of |
| 67 // RemoteInputMethodWin::GetInputLocale and |
| 68 // RemoteInputMethodWin::GetInputTextDirection can return the correct |
| 69 // values based on remote IME activities in the metro_driver process. |
| 70 virtual void OnInputSourceChanged(LANGID langid, bool is_ime) = 0; |
| 71 |
| 72 private: |
| 73 DISALLOW_COPY_AND_ASSIGN(RemoteInputMethodPrivateWin); |
| 74 }; |
| 75 |
| 76 } // namespace ui |
| 77 |
| 78 #endif // UI_BASE_IME_REMOTE_INPUT_METHOD_WIN_H_ |
OLD | NEW |