1 // Copyright 2014 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.
5 #include "ui/base/ime/chromeos/ime_bridge.h"
8 #include "base/logging.h"
9 #include "base/memory/singleton.h"
13 static IMEBridge
* g_ime_bridge
= NULL
;
15 // An implementation of IMEBridge.
16 class IMEBridgeImpl
: public IMEBridge
{
19 : input_context_handler_(NULL
),
20 engine_handler_(NULL
),
21 candidate_window_handler_(NULL
),
22 current_text_input_(ui::TEXT_INPUT_TYPE_NONE
) {
25 virtual ~IMEBridgeImpl() {
28 // IMEBridge override.
29 virtual IMEInputContextHandlerInterface
*
30 GetInputContextHandler() const OVERRIDE
{
31 return input_context_handler_
;
34 // IMEBridge override.
35 virtual void SetInputContextHandler(
36 IMEInputContextHandlerInterface
* handler
) OVERRIDE
{
37 input_context_handler_
= handler
;
40 // IMEBridge override.
41 virtual void SetCurrentEngineHandler(
42 IMEEngineHandlerInterface
* handler
) OVERRIDE
{
43 engine_handler_
= handler
;
46 // IMEBridge override.
47 virtual IMEEngineHandlerInterface
* GetCurrentEngineHandler() const OVERRIDE
{
48 return engine_handler_
;
51 // IMEBridge override.
52 virtual IMECandidateWindowHandlerInterface
* GetCandidateWindowHandler() const
54 return candidate_window_handler_
;
57 // IMEBridge override.
58 virtual void SetCandidateWindowHandler(
59 IMECandidateWindowHandlerInterface
* handler
) OVERRIDE
{
60 candidate_window_handler_
= handler
;
63 // IMEBridge override.
64 virtual void SetCurrentTextInputType(ui::TextInputType input_type
) OVERRIDE
{
65 current_text_input_
= input_type
;
68 // IMEBridge override.
69 virtual ui::TextInputType
GetCurrentTextInputType() const OVERRIDE
{
70 return current_text_input_
;
74 IMEInputContextHandlerInterface
* input_context_handler_
;
75 IMEEngineHandlerInterface
* engine_handler_
;
76 IMECandidateWindowHandlerInterface
* candidate_window_handler_
;
77 ui::TextInputType current_text_input_
;
79 DISALLOW_COPY_AND_ASSIGN(IMEBridgeImpl
);
82 ///////////////////////////////////////////////////////////////////////////////
84 IMEBridge::IMEBridge() {
87 IMEBridge::~IMEBridge() {
91 void IMEBridge::Initialize() {
93 g_ime_bridge
= new IMEBridgeImpl();
97 void IMEBridge::Shutdown() {
103 IMEBridge
* IMEBridge::Get() {
107 } // namespace chromeos