Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: ui/base/ime/input_method_initializer.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/ime/input_method_initializer.h ('k') | ui/base/ime/input_method_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/base/ime/input_method_initializer.h"
6
7 #if defined(OS_CHROMEOS)
8 #include "ui/base/ime/chromeos/ime_bridge.h"
9 #elif defined(USE_AURA) && defined(OS_LINUX)
10 #include "base/logging.h"
11 #include "ui/base/ime/linux/fake_input_method_context_factory.h"
12 #endif
13
14 namespace {
15
16 #if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX)
17 const ui::LinuxInputMethodContextFactory* g_linux_input_method_context_factory;
18 #endif
19
20 } // namespace
21
22 namespace ui {
23
24 void InitializeInputMethod() {
25 #if defined(OS_CHROMEOS)
26 chromeos::IMEBridge::Initialize();
27 #endif
28 }
29
30 void ShutdownInputMethod() {
31 #if defined(OS_CHROMEOS)
32 chromeos::IMEBridge::Shutdown();
33 #endif
34 }
35
36 void InitializeInputMethodForTesting() {
37 #if defined(OS_CHROMEOS)
38 chromeos::IMEBridge::Initialize();
39 #elif defined(USE_AURA) && defined(OS_LINUX)
40 if (!g_linux_input_method_context_factory)
41 g_linux_input_method_context_factory = new FakeInputMethodContextFactory();
42 const LinuxInputMethodContextFactory* factory =
43 LinuxInputMethodContextFactory::instance();
44 CHECK(!factory || factory == g_linux_input_method_context_factory)
45 << "LinuxInputMethodContextFactory was already initialized somewhere "
46 << "else.";
47 LinuxInputMethodContextFactory::SetInstance(
48 g_linux_input_method_context_factory);
49 #endif
50 }
51
52 void ShutdownInputMethodForTesting() {
53 #if defined(OS_CHROMEOS)
54 chromeos::IMEBridge::Shutdown();
55 #elif defined(USE_AURA) && defined(OS_LINUX)
56 const LinuxInputMethodContextFactory* factory =
57 LinuxInputMethodContextFactory::instance();
58 CHECK(!factory || factory == g_linux_input_method_context_factory)
59 << "An unknown LinuxInputMethodContextFactory was set.";
60 LinuxInputMethodContextFactory::SetInstance(NULL);
61 delete g_linux_input_method_context_factory;
62 g_linux_input_method_context_factory = NULL;
63 #endif
64 }
65
66 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/input_method_initializer.h ('k') | ui/base/ime/input_method_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698