| 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) && defined(USE_X11) | 9 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 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_imm32.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(USE_AURA) && defined(OS_LINUX) | 15 #elif defined(USE_AURA) && defined(OS_LINUX) |
| 16 #include "ui/base/ime/input_method_auralinux.h" | 16 #include "ui/base/ime/input_method_auralinux.h" |
| 17 #else | 17 #else |
| 18 #include "ui/base/ime/input_method_minimal.h" | 18 #include "ui/base/ime/input_method_minimal.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 bool g_input_method_set_for_testing = false; | 23 bool g_input_method_set_for_testing = false; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 35 g_create_input_method_called = true; | 35 g_create_input_method_called = true; |
| 36 | 36 |
| 37 if (g_input_method_set_for_testing) | 37 if (g_input_method_set_for_testing) |
| 38 return scoped_ptr<InputMethod>(new MockInputMethod(delegate)); | 38 return scoped_ptr<InputMethod>(new MockInputMethod(delegate)); |
| 39 | 39 |
| 40 #if defined(OS_CHROMEOS) && defined(USE_X11) | 40 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 41 return scoped_ptr<InputMethod>(new InputMethodChromeOS(delegate)); | 41 return scoped_ptr<InputMethod>(new InputMethodChromeOS(delegate)); |
| 42 #elif defined(OS_WIN) | 42 #elif defined(OS_WIN) |
| 43 if (IsRemoteInputMethodWinRequired(widget)) | 43 if (IsRemoteInputMethodWinRequired(widget)) |
| 44 return CreateRemoteInputMethodWin(delegate); | 44 return CreateRemoteInputMethodWin(delegate); |
| 45 return scoped_ptr<InputMethod>(new InputMethodIMM32(delegate, widget)); | 45 return scoped_ptr<InputMethod>(new InputMethodWin(delegate, widget)); |
| 46 #elif defined(USE_AURA) && defined(OS_LINUX) | 46 #elif defined(USE_AURA) && defined(OS_LINUX) |
| 47 return scoped_ptr<InputMethod>(new InputMethodAuraLinux(delegate)); | 47 return scoped_ptr<InputMethod>(new InputMethodAuraLinux(delegate)); |
| 48 #else | 48 #else |
| 49 return scoped_ptr<InputMethod>(new InputMethodMinimal(delegate)); | 49 return scoped_ptr<InputMethod>(new InputMethodMinimal(delegate)); |
| 50 #endif | 50 #endif |
| 51 } | 51 } |
| 52 | 52 |
| 53 void SetUpInputMethodFactoryForTesting() { | 53 void SetUpInputMethodFactoryForTesting() { |
| 54 if (g_input_method_set_for_testing) | 54 if (g_input_method_set_for_testing) |
| 55 return; | 55 return; |
| 56 | 56 |
| 57 CHECK(!g_create_input_method_called) | 57 CHECK(!g_create_input_method_called) |
| 58 << "ui::SetUpInputMethodFactoryForTesting was called after use of " | 58 << "ui::SetUpInputMethodFactoryForTesting was called after use of " |
| 59 << "ui::CreateInputMethod. You must call " | 59 << "ui::CreateInputMethod. You must call " |
| 60 << "ui::SetUpInputMethodFactoryForTesting earlier."; | 60 << "ui::SetUpInputMethodFactoryForTesting earlier."; |
| 61 | 61 |
| 62 g_input_method_set_for_testing = true; | 62 g_input_method_set_for_testing = true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace ui | 65 } // namespace ui |
| OLD | NEW |