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 ~IMEBridgeImpl() override
{}
27 // IMEBridge override.
28 IMEInputContextHandlerInterface
* GetInputContextHandler() const override
{
29 return input_context_handler_
;
32 // IMEBridge override.
33 void SetInputContextHandler(
34 IMEInputContextHandlerInterface
* handler
) override
{
35 input_context_handler_
= handler
;
38 // IMEBridge override.
39 void SetCurrentEngineHandler(IMEEngineHandlerInterface
* handler
) override
{
40 engine_handler_
= handler
;
43 // IMEBridge override.
44 IMEEngineHandlerInterface
* GetCurrentEngineHandler() const override
{
45 return engine_handler_
;
48 // IMEBridge override.
49 IMECandidateWindowHandlerInterface
* GetCandidateWindowHandler()
51 return candidate_window_handler_
;
54 // IMEBridge override.
55 void SetCandidateWindowHandler(
56 IMECandidateWindowHandlerInterface
* handler
) override
{
57 candidate_window_handler_
= handler
;
60 // IMEBridge override.
61 void SetCurrentTextInputType(ui::TextInputType input_type
) override
{
62 current_text_input_
= input_type
;
65 // IMEBridge override.
66 ui::TextInputType
GetCurrentTextInputType() const override
{
67 return current_text_input_
;
71 IMEInputContextHandlerInterface
* input_context_handler_
;
72 IMEEngineHandlerInterface
* engine_handler_
;
73 IMECandidateWindowHandlerInterface
* candidate_window_handler_
;
74 ui::TextInputType current_text_input_
;
76 DISALLOW_COPY_AND_ASSIGN(IMEBridgeImpl
);
79 ///////////////////////////////////////////////////////////////////////////////
81 IMEBridge::IMEBridge() {
84 IMEBridge::~IMEBridge() {
88 void IMEBridge::Initialize() {
90 g_ime_bridge
= new IMEBridgeImpl();
94 void IMEBridge::Shutdown() {
100 IMEBridge
* IMEBridge::Get() {
104 } // namespace chromeos