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

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

Issue 1177503003: Remove the 2-level input method system & InputMethodBridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits. Created 5 years, 5 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_factory.h ('k') | ui/base/ime/ui_base_ime.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #else 20 #else
21 #include "ui/base/ime/input_method_minimal.h" 21 #include "ui/base/ime/input_method_minimal.h"
22 #endif 22 #endif
23 23
24 namespace { 24 namespace {
25 25
26 ui::InputMethod* g_input_method_for_testing = nullptr;
27
26 bool g_input_method_set_for_testing = false; 28 bool g_input_method_set_for_testing = false;
27 29
28 bool g_create_input_method_called = false; 30 bool g_create_input_method_called = false;
29 31
30 } // namespace 32 } // namespace
31 33
32 namespace ui { 34 namespace ui {
33 35
34 scoped_ptr<InputMethod> CreateInputMethod( 36 scoped_ptr<InputMethod> CreateInputMethod(
35 internal::InputMethodDelegate* delegate, 37 internal::InputMethodDelegate* delegate,
36 gfx::AcceleratedWidget widget) { 38 gfx::AcceleratedWidget widget) {
37 if (!g_create_input_method_called) 39 if (!g_create_input_method_called)
38 g_create_input_method_called = true; 40 g_create_input_method_called = true;
39 41
42 if (g_input_method_for_testing) {
43 ui::InputMethod* ret = g_input_method_for_testing;
44 g_input_method_for_testing = nullptr;
45 return make_scoped_ptr(ret);
46 }
47
40 if (g_input_method_set_for_testing) 48 if (g_input_method_set_for_testing)
41 return make_scoped_ptr(new MockInputMethod(delegate)); 49 return make_scoped_ptr(new MockInputMethod(delegate));
42 50
43 #if defined(OS_CHROMEOS) 51 #if defined(OS_CHROMEOS)
44 return make_scoped_ptr(new InputMethodChromeOS(delegate)); 52 return make_scoped_ptr(new InputMethodChromeOS(delegate));
45 #elif defined(OS_WIN) 53 #elif defined(OS_WIN)
46 if (IsRemoteInputMethodWinRequired(widget)) 54 if (IsRemoteInputMethodWinRequired(widget))
47 return CreateRemoteInputMethodWin(delegate); 55 return CreateRemoteInputMethodWin(delegate);
48 return make_scoped_ptr(new InputMethodWin(delegate, widget)); 56 return make_scoped_ptr(new InputMethodWin(delegate, widget));
49 #elif defined(OS_MACOSX) 57 #elif defined(OS_MACOSX)
(...skipping 11 matching lines...) Expand all
61 return; 69 return;
62 70
63 CHECK(!g_create_input_method_called) 71 CHECK(!g_create_input_method_called)
64 << "ui::SetUpInputMethodFactoryForTesting was called after use of " 72 << "ui::SetUpInputMethodFactoryForTesting was called after use of "
65 << "ui::CreateInputMethod. You must call " 73 << "ui::CreateInputMethod. You must call "
66 << "ui::SetUpInputMethodFactoryForTesting earlier."; 74 << "ui::SetUpInputMethodFactoryForTesting earlier.";
67 75
68 g_input_method_set_for_testing = true; 76 g_input_method_set_for_testing = true;
69 } 77 }
70 78
79 void SetUpInputMethodForTesting(InputMethod* input_method) {
80 g_input_method_for_testing = input_method;
81 }
82
71 } // namespace ui 83 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/input_method_factory.h ('k') | ui/base/ime/ui_base_ime.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698