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/mock_input_method.h" | 7 #include "ui/base/ime/mock_input_method.h" |
8 | 8 |
9 #if defined(OS_CHROMEOS) | 9 #if defined(OS_CHROMEOS) |
10 #include "ui/base/ime/input_method_chromeos.h" | 10 #include "ui/base/ime/input_method_chromeos.h" |
11 #elif defined(OS_WIN) | 11 #elif defined(OS_WIN) |
12 #include "base/win/metro.h" | 12 #include "base/win/metro.h" |
13 #include "ui/base/ime/input_method_win.h" | 13 #include "ui/base/ime/input_method_win.h" |
14 #include "ui/base/ime/remote_input_method_win.h" | 14 #include "ui/base/ime/remote_input_method_win.h" |
15 #elif defined(OS_MACOSX) | 15 #elif defined(OS_MACOSX) |
16 #include "ui/base/ime/input_method_mac.h" | 16 #include "ui/base/ime/input_method_mac.h" |
17 #elif defined(USE_AURA) && defined(OS_LINUX) && defined(USE_X11) && \ | 17 #elif defined(USE_AURA) && defined(OS_LINUX) && defined(USE_X11) && \ |
18 !defined(OS_CHROMEOS) | 18 !defined(OS_CHROMEOS) |
19 #include "ui/base/ime/input_method_auralinux.h" | 19 #include "ui/base/ime/input_method_auralinux.h" |
| 20 #elif defined(OS_ANDROID) |
| 21 #include "ui/base/ime/input_method_android.h" |
20 #else | 22 #else |
21 #include "ui/base/ime/input_method_minimal.h" | 23 #include "ui/base/ime/input_method_minimal.h" |
22 #endif | 24 #endif |
23 | 25 |
24 namespace { | 26 namespace { |
25 | 27 |
26 ui::InputMethod* g_input_method_for_testing = nullptr; | 28 ui::InputMethod* g_input_method_for_testing = nullptr; |
27 | 29 |
28 bool g_input_method_set_for_testing = false; | 30 bool g_input_method_set_for_testing = false; |
29 | 31 |
(...skipping 22 matching lines...) Expand all Loading... |
52 return make_scoped_ptr(new InputMethodChromeOS(delegate)); | 54 return make_scoped_ptr(new InputMethodChromeOS(delegate)); |
53 #elif defined(OS_WIN) | 55 #elif defined(OS_WIN) |
54 if (IsRemoteInputMethodWinRequired(widget)) | 56 if (IsRemoteInputMethodWinRequired(widget)) |
55 return CreateRemoteInputMethodWin(delegate); | 57 return CreateRemoteInputMethodWin(delegate); |
56 return make_scoped_ptr(new InputMethodWin(delegate, widget)); | 58 return make_scoped_ptr(new InputMethodWin(delegate, widget)); |
57 #elif defined(OS_MACOSX) | 59 #elif defined(OS_MACOSX) |
58 return make_scoped_ptr(new InputMethodMac(delegate)); | 60 return make_scoped_ptr(new InputMethodMac(delegate)); |
59 #elif defined(USE_AURA) && defined(OS_LINUX) && defined(USE_X11) && \ | 61 #elif defined(USE_AURA) && defined(OS_LINUX) && defined(USE_X11) && \ |
60 !defined(OS_CHROMEOS) | 62 !defined(OS_CHROMEOS) |
61 return make_scoped_ptr(new InputMethodAuraLinux(delegate)); | 63 return make_scoped_ptr(new InputMethodAuraLinux(delegate)); |
| 64 #elif defined(OS_ANDROID) |
| 65 return make_scoped_ptr(new InputMethodAndroid(delegate)); |
62 #else | 66 #else |
63 return make_scoped_ptr(new InputMethodMinimal(delegate)); | 67 return make_scoped_ptr(new InputMethodMinimal(delegate)); |
64 #endif | 68 #endif |
65 } | 69 } |
66 | 70 |
67 void SetUpInputMethodFactoryForTesting() { | 71 void SetUpInputMethodFactoryForTesting() { |
68 if (g_input_method_set_for_testing) | 72 if (g_input_method_set_for_testing) |
69 return; | 73 return; |
70 | 74 |
71 CHECK(!g_create_input_method_called) | 75 CHECK(!g_create_input_method_called) |
72 << "ui::SetUpInputMethodFactoryForTesting was called after use of " | 76 << "ui::SetUpInputMethodFactoryForTesting was called after use of " |
73 << "ui::CreateInputMethod. You must call " | 77 << "ui::CreateInputMethod. You must call " |
74 << "ui::SetUpInputMethodFactoryForTesting earlier."; | 78 << "ui::SetUpInputMethodFactoryForTesting earlier."; |
75 | 79 |
76 g_input_method_set_for_testing = true; | 80 g_input_method_set_for_testing = true; |
77 } | 81 } |
78 | 82 |
79 void SetUpInputMethodForTesting(InputMethod* input_method) { | 83 void SetUpInputMethodForTesting(InputMethod* input_method) { |
80 g_input_method_for_testing = input_method; | 84 g_input_method_for_testing = input_method; |
81 } | 85 } |
82 | 86 |
83 } // namespace ui | 87 } // namespace ui |
OLD | NEW |