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

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

Issue 1155013005: Refactoring the ownership of ui::InputMethod. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pls be green! Created 5 years, 6 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
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(OS_CHROMEOS) 17 #elif defined(USE_AURA) && defined(OS_LINUX) && defined(USE_X11) && \
18 !defined(OS_CHROMEOS)
18 #include "ui/base/ime/input_method_auralinux.h" 19 #include "ui/base/ime/input_method_auralinux.h"
19 #else 20 #else
20 #include "ui/base/ime/input_method_minimal.h" 21 #include "ui/base/ime/input_method_minimal.h"
21 #endif 22 #endif
22 23
23 namespace { 24 namespace {
24 25
25 bool g_input_method_set_for_testing = false; 26 bool g_input_method_set_for_testing = false;
26 27
27 bool g_create_input_method_called = false; 28 bool g_create_input_method_called = false;
(...skipping 12 matching lines...) Expand all
40 return make_scoped_ptr(new MockInputMethod(delegate)); 41 return make_scoped_ptr(new MockInputMethod(delegate));
41 42
42 #if defined(OS_CHROMEOS) 43 #if defined(OS_CHROMEOS)
43 return make_scoped_ptr(new InputMethodChromeOS(delegate)); 44 return make_scoped_ptr(new InputMethodChromeOS(delegate));
44 #elif defined(OS_WIN) 45 #elif defined(OS_WIN)
45 if (IsRemoteInputMethodWinRequired(widget)) 46 if (IsRemoteInputMethodWinRequired(widget))
46 return CreateRemoteInputMethodWin(delegate); 47 return CreateRemoteInputMethodWin(delegate);
47 return make_scoped_ptr(new InputMethodWin(delegate, widget)); 48 return make_scoped_ptr(new InputMethodWin(delegate, widget));
48 #elif defined(OS_MACOSX) 49 #elif defined(OS_MACOSX)
49 return make_scoped_ptr(new InputMethodMac(delegate)); 50 return make_scoped_ptr(new InputMethodMac(delegate));
50 #elif defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) 51 #elif defined(USE_AURA) && defined(OS_LINUX) && defined(USE_X11) && \
52 !defined(OS_CHROMEOS)
51 return make_scoped_ptr(new InputMethodAuraLinux(delegate)); 53 return make_scoped_ptr(new InputMethodAuraLinux(delegate));
52 #else 54 #else
53 return make_scoped_ptr(new InputMethodMinimal(delegate)); 55 return make_scoped_ptr(new InputMethodMinimal(delegate));
54 #endif 56 #endif
55 } 57 }
56 58
57 void SetUpInputMethodFactoryForTesting() { 59 void SetUpInputMethodFactoryForTesting() {
58 if (g_input_method_set_for_testing) 60 if (g_input_method_set_for_testing)
59 return; 61 return;
60 62
61 CHECK(!g_create_input_method_called) 63 CHECK(!g_create_input_method_called)
62 << "ui::SetUpInputMethodFactoryForTesting was called after use of " 64 << "ui::SetUpInputMethodFactoryForTesting was called after use of "
63 << "ui::CreateInputMethod. You must call " 65 << "ui::CreateInputMethod. You must call "
64 << "ui::SetUpInputMethodFactoryForTesting earlier."; 66 << "ui::SetUpInputMethodFactoryForTesting earlier.";
65 67
66 g_input_method_set_for_testing = true; 68 g_input_method_set_for_testing = true;
67 } 69 }
68 70
69 } // namespace ui 71 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698