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/base/ime/input_method_factory.h" | 5 #include "ui/base/ime/input_method_factory.h" |
6 | 6 |
7 #include "ui/base/ime/input_method_delegate.h" | 7 #include "ui/base/ime/input_method_delegate.h" |
8 #include "ui/base/ime/mock_input_method.h" | 8 #include "ui/base/ime/mock_input_method.h" |
9 | 9 |
10 #if defined(OS_CHROMEOS) && defined(USE_X11) | 10 #if defined(OS_CHROMEOS) && defined(USE_X11) |
11 #include "ui/base/ime/input_method_ibus.h" | 11 #include "ui/base/ime/input_method_ibus.h" |
12 #elif defined(OS_WIN) | 12 #elif defined(OS_WIN) |
13 #include "base/win/metro.h" | 13 #include "base/win/metro.h" |
14 #include "ui/base/ime/input_method_imm32.h" | 14 #include "ui/base/ime/input_method_imm32.h" |
15 #include "ui/base/ime/input_method_tsf.h" | 15 #include "ui/base/ime/input_method_tsf.h" |
| 16 #include "ui/base/ime/remote_input_method_win.h" |
16 #elif defined(USE_AURA) && defined(USE_X11) | 17 #elif defined(USE_AURA) && defined(USE_X11) |
17 #include "ui/base/ime/input_method_linux_x11.h" | 18 #include "ui/base/ime/input_method_linux_x11.h" |
18 #else | 19 #else |
19 #include "ui/base/ime/fake_input_method.h" | 20 #include "ui/base/ime/fake_input_method.h" |
20 #endif | 21 #endif |
21 | 22 |
22 namespace ui { | 23 namespace ui { |
23 namespace { | 24 namespace { |
24 | 25 |
25 bool g_input_method_set_for_testing = false; | 26 bool g_input_method_set_for_testing = false; |
26 InputMethod* g_shared_input_method = NULL; | 27 InputMethod* g_shared_input_method = NULL; |
27 | 28 |
28 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 30 bool IsWindowImmersive(HWND window_handle) { |
| 31 DWORD process_id = 0; |
| 32 if (::GetWindowThreadProcessId(window_handle, &process_id) == 0) |
| 33 return false; |
| 34 // TODO(yukawa): Use ScopedHandle. |
| 35 HANDLE process_handle = ::OpenProcess( |
| 36 PROCESS_QUERY_LIMITED_INFORMATION, FALSE, process_id); |
| 37 if (process_handle == NULL) |
| 38 return false; |
| 39 const bool result = base::win::IsProcessImmersive(process_handle); |
| 40 ::CloseHandle(process_handle); |
| 41 return result; |
| 42 } |
| 43 |
29 // Returns a new instance of input method object for IMM32 or TSF. | 44 // Returns a new instance of input method object for IMM32 or TSF. |
30 scoped_ptr<InputMethod> CreateInputMethodWinInternal( | 45 scoped_ptr<InputMethod> CreateInputMethodWinInternal( |
31 internal::InputMethodDelegate* delegate, | 46 internal::InputMethodDelegate* delegate, |
32 gfx::AcceleratedWidget widget) { | 47 gfx::AcceleratedWidget widget) { |
33 if (base::win::IsTSFAwareRequired()) | 48 if (IsWindowImmersive(widget)) |
| 49 return CreateRemoteInputMethodWin(delegate); |
| 50 else if(base::win::IsTSFAwareRequired()) |
34 return scoped_ptr<InputMethod>(new InputMethodTSF(delegate, widget)); | 51 return scoped_ptr<InputMethod>(new InputMethodTSF(delegate, widget)); |
35 else | 52 else |
36 return scoped_ptr<InputMethod>(new InputMethodIMM32(delegate, widget)); | 53 return scoped_ptr<InputMethod>(new InputMethodIMM32(delegate, widget)); |
37 } | 54 } |
38 #endif | 55 #endif |
39 | 56 |
40 } // namespace | 57 } // namespace |
41 | 58 |
42 scoped_ptr<InputMethod> CreateInputMethod( | 59 scoped_ptr<InputMethod> CreateInputMethod( |
43 internal::InputMethodDelegate* delegate, | 60 internal::InputMethodDelegate* delegate, |
(...skipping 27 matching lines...) Expand all Loading... |
71 | 88 |
72 namespace internal { | 89 namespace internal { |
73 | 90 |
74 void DestroySharedInputMethod() { | 91 void DestroySharedInputMethod() { |
75 delete g_shared_input_method; | 92 delete g_shared_input_method; |
76 g_shared_input_method = NULL; | 93 g_shared_input_method = NULL; |
77 } | 94 } |
78 | 95 |
79 } // namespace internal | 96 } // namespace internal |
80 } // namespace ui | 97 } // namespace ui |
OLD | NEW |