Chromium Code Reviews| Index: chromeos/ime/ibus_bridge.h |
| diff --git a/chromeos/ime/ibus_bridge.h b/chromeos/ime/ibus_bridge.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7655aba4df01a210a9bfb7f2c93132af75d7f5a9 |
| --- /dev/null |
| +++ b/chromeos/ime/ibus_bridge.h |
| @@ -0,0 +1,95 @@ |
| +// 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. |
| + |
| +#ifndef CHROMEOS_IME_IBUS_BRIDGE_H_ |
| +#define CHROMEOS_IME_IBUS_BRIDGE_H_ |
| + |
| +#include <string> |
| +#include "base/basictypes.h" |
| + |
| +namespace chromeos { |
| +class IBusInputContextHandlerInterface; |
| +class IBusEngineHandlerInterface; |
| + |
| +namespace ibus { |
| +class IBusPanelCandidateWindowHandlerInterface; |
| +class IBusPanelPropertyHandlerInterface; |
| +} // namespace ibus |
| + |
| +// IBusBridge provides access of each IME related handler. IBusBridge is managed |
| +// by TLS because IME related stuff should be accessible only from UI thread. |
|
satorux1
2013/01/17 20:43:31
I'm confused. Why TLS? If this is only accessible
Seigo Nonaka
2013/01/18 06:06:00
I don't have strong opinion for TLS.
I just don't
|
| +class IBusBridge { |
| + public: |
| + // Initializes IBusBridge. This function should be called before any |
| + // GetInstance function calls. |
| + static void Initialize(); |
| + |
| + // Returns IBusBridge instance. |
| + static IBusBridge* GetInstance(); |
| + |
| + // Returns current InputContextHandler. This function returns NULL if input |
| + // context is not ready to use. |
| + IBusInputContextHandlerInterface* input_context_handler() const { |
| + return input_context_handler_; |
| + } |
| + |
| + // Updates current InputContextHandler. If there is no active input context, |
| + // pass NULL for |handler|. |
| + void set_input_context_handler(IBusInputContextHandlerInterface* handler) { |
| + input_context_handler_ = handler; |
| + } |
| + |
| + // Returns current EngineHandler. This function returns NULL if current engine |
| + // is not ready to use. |
| + IBusEngineHandlerInterface* engine_handler() const { |
| + return engine_handler_; |
| + } |
| + |
| + // Updates current EngineHandler. If there is no active engine service, pass |
| + // NULL for |handler|. |
| + void set_engine_handler(IBusEngineHandlerInterface* handler) { |
| + engine_handler_ = handler; |
| + } |
| + |
| + // Returns current CandidateWindowHandler. This function returns NULL if |
| + // current candidate window is not ready to use. |
| + ibus::IBusPanelCandidateWindowHandlerInterface* |
| + candidate_window_handler() const { |
| + return candidate_window_handler_; |
| + } |
| + |
| + // Updates current CandidatWindowHandler. If there is no active candidate |
| + // window service, pass NULL for |handler|. |
| + void set_candidate_window_handler( |
| + ibus::IBusPanelCandidateWindowHandlerInterface* handler) { |
| + candidate_window_handler_ = handler; |
| + } |
| + |
| + // Returns current PropertyHandler. This function returns NULL if panel window |
| + // is not ready to use. |
| + ibus::IBusPanelPropertyHandlerInterface* panel_handler() const { |
| + return panel_handler_; |
| + } |
| + |
| + // Updates current PropertyHandler. If there is no active property service, |
| + // pass NULL for |handler|. |
| + void set_panel_handler(ibus::IBusPanelPropertyHandlerInterface* handler) { |
| + panel_handler_ = handler; |
| + } |
| + |
| + private: |
| + // TLS implementation. Use GetInstance for getting instance. |
| + IBusBridge(); |
| + |
| + IBusInputContextHandlerInterface* input_context_handler_; |
| + IBusEngineHandlerInterface* engine_handler_; |
| + ibus::IBusPanelCandidateWindowHandlerInterface* candidate_window_handler_; |
| + ibus::IBusPanelPropertyHandlerInterface* panel_handler_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(IBusBridge); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROMEOS_IME_IBUS_BRIDGE_H_ |