Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROMEOS_IME_IBUS_BRIDGE_H_ | |
| 6 #define CHROMEOS_IME_IBUS_BRIDGE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include "base/basictypes.h" | |
| 10 | |
| 11 namespace chromeos { | |
| 12 class IBusInputContextHandlerInterface; | |
| 13 class IBusEngineHandlerInterface; | |
| 14 | |
| 15 namespace ibus { | |
| 16 class IBusPanelCandidateWindowHandlerInterface; | |
| 17 class IBusPanelPropertyHandlerInterface; | |
| 18 } // namespace ibus | |
| 19 | |
| 20 // IBusBridge provides access of each IME related handler. IBusBridge is managed | |
| 21 // 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
| |
| 22 class IBusBridge { | |
| 23 public: | |
| 24 // Initializes IBusBridge. This function should be called before any | |
| 25 // GetInstance function calls. | |
| 26 static void Initialize(); | |
| 27 | |
| 28 // Returns IBusBridge instance. | |
| 29 static IBusBridge* GetInstance(); | |
| 30 | |
| 31 // Returns current InputContextHandler. This function returns NULL if input | |
| 32 // context is not ready to use. | |
| 33 IBusInputContextHandlerInterface* input_context_handler() const { | |
| 34 return input_context_handler_; | |
| 35 } | |
| 36 | |
| 37 // Updates current InputContextHandler. If there is no active input context, | |
| 38 // pass NULL for |handler|. | |
| 39 void set_input_context_handler(IBusInputContextHandlerInterface* handler) { | |
| 40 input_context_handler_ = handler; | |
| 41 } | |
| 42 | |
| 43 // Returns current EngineHandler. This function returns NULL if current engine | |
| 44 // is not ready to use. | |
| 45 IBusEngineHandlerInterface* engine_handler() const { | |
| 46 return engine_handler_; | |
| 47 } | |
| 48 | |
| 49 // Updates current EngineHandler. If there is no active engine service, pass | |
| 50 // NULL for |handler|. | |
| 51 void set_engine_handler(IBusEngineHandlerInterface* handler) { | |
| 52 engine_handler_ = handler; | |
| 53 } | |
| 54 | |
| 55 // Returns current CandidateWindowHandler. This function returns NULL if | |
| 56 // current candidate window is not ready to use. | |
| 57 ibus::IBusPanelCandidateWindowHandlerInterface* | |
| 58 candidate_window_handler() const { | |
| 59 return candidate_window_handler_; | |
| 60 } | |
| 61 | |
| 62 // Updates current CandidatWindowHandler. If there is no active candidate | |
| 63 // window service, pass NULL for |handler|. | |
| 64 void set_candidate_window_handler( | |
| 65 ibus::IBusPanelCandidateWindowHandlerInterface* handler) { | |
| 66 candidate_window_handler_ = handler; | |
| 67 } | |
| 68 | |
| 69 // Returns current PropertyHandler. This function returns NULL if panel window | |
| 70 // is not ready to use. | |
| 71 ibus::IBusPanelPropertyHandlerInterface* panel_handler() const { | |
| 72 return panel_handler_; | |
| 73 } | |
| 74 | |
| 75 // Updates current PropertyHandler. If there is no active property service, | |
| 76 // pass NULL for |handler|. | |
| 77 void set_panel_handler(ibus::IBusPanelPropertyHandlerInterface* handler) { | |
| 78 panel_handler_ = handler; | |
| 79 } | |
| 80 | |
| 81 private: | |
| 82 // TLS implementation. Use GetInstance for getting instance. | |
| 83 IBusBridge(); | |
| 84 | |
| 85 IBusInputContextHandlerInterface* input_context_handler_; | |
| 86 IBusEngineHandlerInterface* engine_handler_; | |
| 87 ibus::IBusPanelCandidateWindowHandlerInterface* candidate_window_handler_; | |
| 88 ibus::IBusPanelPropertyHandlerInterface* panel_handler_; | |
| 89 | |
| 90 DISALLOW_COPY_AND_ASSIGN(IBusBridge); | |
| 91 }; | |
| 92 | |
| 93 } // namespace chromeos | |
| 94 | |
| 95 #endif // CHROMEOS_IME_IBUS_BRIDGE_H_ | |
| OLD | NEW |