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 #include "base/memory/singleton.h" | |
| 11 | |
| 12 namespace chromeos { | |
| 13 class IBusInputContextHandlerInterface; | |
| 14 class IBusEngineHandlerInterface; | |
| 15 | |
| 16 namespace ibus { | |
| 17 class IBusPanelCandidateWindowHandlerInterface; | |
| 18 class IBusPanelPropertyHandlerInterface; | |
| 19 } // namespace ibus | |
| 20 | |
| 21 // IBusBridge provides access of each IME related handler. IBusBridge is managed | |
| 22 // as singleton object. | |
|
satorux1
2013/01/29 05:18:56
Please describe this class more carefully. Why do
Seigo Nonaka
2013/01/30 06:21:54
Sorry, I update class comment.
On 2013/01/29 05:18
| |
| 23 class IBusBridge { | |
| 24 public: | |
| 25 // Returns IBusBridge instance. | |
| 26 static IBusBridge* GetInstance(); | |
| 27 | |
| 28 // Returns current InputContextHandler. This function returns NULL if input | |
| 29 // context is not ready to use. | |
| 30 IBusInputContextHandlerInterface* input_context_handler() const { | |
| 31 return input_context_handler_; | |
| 32 } | |
| 33 | |
| 34 // Updates current InputContextHandler. If there is no active input context, | |
| 35 // pass NULL for |handler|. Caller must release |handler|. | |
| 36 void set_input_context_handler(IBusInputContextHandlerInterface* handler) { | |
| 37 input_context_handler_ = handler; | |
| 38 } | |
| 39 | |
| 40 // Returns current EngineHandler. This function returns NULL if current engine | |
| 41 // is not ready to use. | |
| 42 IBusEngineHandlerInterface* engine_handler() const { | |
| 43 return engine_handler_; | |
| 44 } | |
| 45 | |
| 46 // Updates current EngineHandler. If there is no active engine service, pass | |
| 47 // NULL for |handler|. Caller must release |handler|. | |
| 48 void set_engine_handler(IBusEngineHandlerInterface* handler) { | |
| 49 engine_handler_ = handler; | |
| 50 } | |
| 51 | |
| 52 // Returns current CandidateWindowHandler. This function returns NULL if | |
| 53 // current candidate window is not ready to use. | |
| 54 ibus::IBusPanelCandidateWindowHandlerInterface* | |
| 55 candidate_window_handler() const { | |
| 56 return candidate_window_handler_; | |
| 57 } | |
| 58 | |
| 59 // Updates current CandidatWindowHandler. If there is no active candidate | |
| 60 // window service, pass NULL for |handler|. Caller must release |handler|. | |
| 61 void set_candidate_window_handler( | |
| 62 ibus::IBusPanelCandidateWindowHandlerInterface* handler) { | |
| 63 candidate_window_handler_ = handler; | |
| 64 } | |
| 65 | |
| 66 // Returns current PropertyHandler. This function returns NULL if panel window | |
| 67 // is not ready to use. | |
| 68 ibus::IBusPanelPropertyHandlerInterface* panel_handler() const { | |
| 69 return panel_handler_; | |
| 70 } | |
| 71 | |
| 72 // Updates current PropertyHandler. If there is no active property service, | |
| 73 // pass NULL for |handler|. Caller must release |handler|. | |
| 74 void set_panel_handler(ibus::IBusPanelPropertyHandlerInterface* handler) { | |
| 75 panel_handler_ = handler; | |
| 76 } | |
| 77 | |
| 78 private: | |
| 79 // Singleton implementation. Use GetInstance for getting instance. | |
| 80 IBusBridge(); | |
| 81 friend struct DefaultSingletonTraits<IBusBridge>; | |
| 82 | |
| 83 IBusInputContextHandlerInterface* input_context_handler_; | |
| 84 IBusEngineHandlerInterface* engine_handler_; | |
| 85 ibus::IBusPanelCandidateWindowHandlerInterface* candidate_window_handler_; | |
| 86 ibus::IBusPanelPropertyHandlerInterface* panel_handler_; | |
| 87 | |
| 88 DISALLOW_COPY_AND_ASSIGN(IBusBridge); | |
| 89 }; | |
| 90 | |
| 91 } // namespace chromeos | |
| 92 | |
| 93 #endif // CHROMEOS_IME_IBUS_BRIDGE_H_ | |
| OLD | NEW |