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

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

Issue 1991953002: Implement a runtime headless mode for Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review nits Created 4 years 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 "base/command_line.h"
7 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
8 #include "build/build_config.h" 9 #include "build/build_config.h"
9 #include "ui/base/ime/mock_input_method.h" 10 #include "ui/base/ime/mock_input_method.h"
11 #include "ui/gfx/switches.h"
10 12
11 #if defined(OS_CHROMEOS) 13 #if defined(OS_CHROMEOS)
12 #include "ui/base/ime/input_method_chromeos.h" 14 #include "ui/base/ime/input_method_chromeos.h"
13 #elif defined(OS_WIN) 15 #elif defined(OS_WIN)
14 #include "ui/base/ime/input_method_win.h" 16 #include "ui/base/ime/input_method_win.h"
15 #elif defined(OS_MACOSX) 17 #elif defined(OS_MACOSX)
16 #include "ui/base/ime/input_method_mac.h" 18 #include "ui/base/ime/input_method_mac.h"
17 #elif defined(USE_AURA) && defined(OS_LINUX) && defined(USE_X11) 19 #elif defined(USE_AURA) && defined(OS_LINUX) && defined(USE_X11)
18 #include "ui/base/ime/input_method_auralinux.h" 20 #include "ui/base/ime/input_method_auralinux.h"
19 #elif defined(OS_ANDROID) 21 #elif defined(OS_ANDROID)
(...skipping 22 matching lines...) Expand all
42 44
43 if (g_input_method_for_testing) { 45 if (g_input_method_for_testing) {
44 ui::InputMethod* ret = g_input_method_for_testing; 46 ui::InputMethod* ret = g_input_method_for_testing;
45 g_input_method_for_testing = nullptr; 47 g_input_method_for_testing = nullptr;
46 return base::WrapUnique(ret); 48 return base::WrapUnique(ret);
47 } 49 }
48 50
49 if (g_input_method_set_for_testing) 51 if (g_input_method_set_for_testing)
50 return base::MakeUnique<MockInputMethod>(delegate); 52 return base::MakeUnique<MockInputMethod>(delegate);
51 53
54 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless))
55 return base::WrapUnique(new MockInputMethod(delegate));
56
52 #if defined(OS_CHROMEOS) 57 #if defined(OS_CHROMEOS)
53 return base::MakeUnique<InputMethodChromeOS>(delegate); 58 return base::MakeUnique<InputMethodChromeOS>(delegate);
54 #elif defined(OS_WIN) 59 #elif defined(OS_WIN)
55 return base::MakeUnique<InputMethodWin>(delegate, widget); 60 return base::MakeUnique<InputMethodWin>(delegate, widget);
56 #elif defined(OS_MACOSX) 61 #elif defined(OS_MACOSX)
57 return base::MakeUnique<InputMethodMac>(delegate); 62 return base::MakeUnique<InputMethodMac>(delegate);
58 #elif defined(USE_AURA) && defined(OS_LINUX) && defined(USE_X11) 63 #elif defined(USE_AURA) && defined(OS_LINUX) && defined(USE_X11)
59 return base::MakeUnique<InputMethodAuraLinux>(delegate); 64 return base::MakeUnique<InputMethodAuraLinux>(delegate);
60 #elif defined(OS_ANDROID) 65 #elif defined(OS_ANDROID)
61 return base::MakeUnique<InputMethodAndroid>(delegate); 66 return base::MakeUnique<InputMethodAndroid>(delegate);
(...skipping 12 matching lines...) Expand all
74 << "ui::SetUpInputMethodFactoryForTesting earlier."; 79 << "ui::SetUpInputMethodFactoryForTesting earlier.";
75 80
76 g_input_method_set_for_testing = true; 81 g_input_method_set_for_testing = true;
77 } 82 }
78 83
79 void SetUpInputMethodForTesting(InputMethod* input_method) { 84 void SetUpInputMethodForTesting(InputMethod* input_method) {
80 g_input_method_for_testing = input_method; 85 g_input_method_for_testing = input_method;
81 } 86 }
82 87
83 } // namespace ui 88 } // namespace ui
OLDNEW
« ui/aura/env.cc ('K') | « ui/aura/env.cc ('k') | ui/gfx/icc_profile_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698