| 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 #include "ui/base/ime/input_method_initializer.h" | 5 #include "ui/base/ime/input_method_initializer.h" |
| 6 | 6 |
| 7 #if defined(OS_CHROMEOS) | 7 #if defined(OS_CHROMEOS) |
| 8 #include "ui/base/ime/chromeos/ime_bridge.h" | 8 #include "ui/base/ime/chromeos/ime_bridge.h" |
| 9 #elif defined(USE_AURA) && defined(OS_LINUX) && !defined(USE_OZONE) | 9 #elif defined(USE_AURA) && defined(OS_LINUX) && !defined(USE_OZONE) |
| 10 #include "ui/base/ime/input_method_auralinux.h" | 10 #include "ui/base/ime/input_method_auralinux.h" |
| 11 #include "ui/base/ime/linux/fake_input_method_context_factory.h" | 11 #include "ui/base/ime/linux/fake_input_method_context_factory.h" |
| 12 #elif defined(OS_WIN) | |
| 13 #include "base/win/metro.h" | |
| 14 #include "ui/base/ime/input_method_factory.h" | |
| 15 #endif | 12 #endif |
| 16 | 13 |
| 17 namespace { | 14 namespace { |
| 18 | 15 |
| 19 #if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX) && \ | 16 #if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX) && \ |
| 20 !defined(USE_OZONE) | 17 !defined(USE_OZONE) |
| 21 const ui::LinuxInputMethodContextFactory* g_linux_input_method_context_factory; | 18 const ui::LinuxInputMethodContextFactory* g_linux_input_method_context_factory; |
| 22 #endif | 19 #endif |
| 23 | 20 |
| 24 } // namespace | 21 } // namespace |
| 25 | 22 |
| 26 namespace ui { | 23 namespace ui { |
| 27 | 24 |
| 28 void InitializeInputMethod() { | 25 void InitializeInputMethod() { |
| 29 #if defined(OS_CHROMEOS) | 26 #if defined(OS_CHROMEOS) |
| 30 chromeos::IMEBridge::Initialize(); | 27 chromeos::IMEBridge::Initialize(); |
| 31 #elif defined(USE_AURA) && defined(OS_LINUX) && !defined(USE_OZONE) | 28 #elif defined(USE_AURA) && defined(OS_LINUX) && !defined(USE_OZONE) |
| 32 InputMethodAuraLinux::Initialize(); | 29 InputMethodAuraLinux::Initialize(); |
| 33 #endif | 30 #endif |
| 34 } | 31 } |
| 35 | 32 |
| 36 void ShutdownInputMethod() { | 33 void ShutdownInputMethod() { |
| 37 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
| 38 chromeos::IMEBridge::Shutdown(); | 35 chromeos::IMEBridge::Shutdown(); |
| 39 #elif defined(OS_WIN) | |
| 40 internal::DestroySharedInputMethod(); | |
| 41 #endif | 36 #endif |
| 42 } | 37 } |
| 43 | 38 |
| 44 void InitializeInputMethodForTesting() { | 39 void InitializeInputMethodForTesting() { |
| 45 #if defined(OS_CHROMEOS) | 40 #if defined(OS_CHROMEOS) |
| 46 chromeos::IMEBridge::Initialize(); | 41 chromeos::IMEBridge::Initialize(); |
| 47 #elif defined(USE_AURA) && defined(OS_LINUX) && !defined(USE_OZONE) | 42 #elif defined(USE_AURA) && defined(OS_LINUX) && !defined(USE_OZONE) |
| 48 if (!g_linux_input_method_context_factory) | 43 if (!g_linux_input_method_context_factory) |
| 49 g_linux_input_method_context_factory = new FakeInputMethodContextFactory(); | 44 g_linux_input_method_context_factory = new FakeInputMethodContextFactory(); |
| 50 const LinuxInputMethodContextFactory* factory = | 45 const LinuxInputMethodContextFactory* factory = |
| (...skipping 10 matching lines...) Expand all Loading... |
| 61 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
| 62 chromeos::IMEBridge::Shutdown(); | 57 chromeos::IMEBridge::Shutdown(); |
| 63 #elif defined(USE_AURA) && defined(OS_LINUX) && !defined(USE_OZONE) | 58 #elif defined(USE_AURA) && defined(OS_LINUX) && !defined(USE_OZONE) |
| 64 const LinuxInputMethodContextFactory* factory = | 59 const LinuxInputMethodContextFactory* factory = |
| 65 LinuxInputMethodContextFactory::instance(); | 60 LinuxInputMethodContextFactory::instance(); |
| 66 CHECK(!factory || factory == g_linux_input_method_context_factory) | 61 CHECK(!factory || factory == g_linux_input_method_context_factory) |
| 67 << "An unknown LinuxInputMethodContextFactory was set."; | 62 << "An unknown LinuxInputMethodContextFactory was set."; |
| 68 LinuxInputMethodContextFactory::SetInstance(NULL); | 63 LinuxInputMethodContextFactory::SetInstance(NULL); |
| 69 delete g_linux_input_method_context_factory; | 64 delete g_linux_input_method_context_factory; |
| 70 g_linux_input_method_context_factory = NULL; | 65 g_linux_input_method_context_factory = NULL; |
| 71 #elif defined(OS_WIN) | |
| 72 internal::DestroySharedInputMethod(); | |
| 73 #endif | 66 #endif |
| 74 } | 67 } |
| 75 | 68 |
| 76 } // namespace ui | 69 } // namespace ui |
| OLD | NEW |