blob: ec97bbeaec83242460b0f5a88802d92170cbaae9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/base/ime/input_method_factory.h"
#include "ui/base/ime/input_method_delegate.h"
#include "ui/base/ime/mock_input_method.h"
#if defined(OS_CHROMEOS)
#include "ui/base/ime/input_method_ibus.h"
#elif defined(OS_WIN)
#include "ui/base/ime/input_method_win.h"
#else
#include "ui/base/ime/fake_input_method.h"
#endif
namespace ui {
namespace {
static bool g_input_method_set_for_testing = false;
}
InputMethod* CreateInputMethod(internal::InputMethodDelegate* delegate,
gfx::AcceleratedWidget widget) {
if (g_input_method_set_for_testing)
return new MockInputMethod(delegate);
#if defined(OS_CHROMEOS)
return new InputMethodIBus(delegate);
#elif defined(OS_WIN)
return new InputMethodWin(delegate, widget);
#else
return new FakeInputMethod(delegate);
#endif
}
void SetUpInputMethodFacotryForTesting() {
g_input_method_set_for_testing = true;
}
} // namespace ui
|