OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // TODO(nona): Rename this file to ime_bridge.h | 4 // TODO(nona): Rename this file to ime_bridge.h |
5 | 5 |
6 #ifndef CHROMEOS_IME_IBUS_BRIDGE_H_ | 6 #ifndef CHROMEOS_IME_IBUS_BRIDGE_H_ |
7 #define CHROMEOS_IME_IBUS_BRIDGE_H_ | 7 #define CHROMEOS_IME_IBUS_BRIDGE_H_ |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" |
11 #include "chromeos/chromeos_export.h" | 12 #include "chromeos/chromeos_export.h" |
12 #include "chromeos/dbus/ibus/ibus_engine_factory_service.h" | |
13 #include "chromeos/ime/ime_constants.h" | 13 #include "chromeos/ime/ime_constants.h" |
14 #include "chromeos/ime/input_method_property.h" | 14 #include "chromeos/ime/input_method_property.h" |
15 | 15 |
16 namespace chromeos { | 16 namespace chromeos { |
17 namespace input_method { | 17 namespace input_method { |
18 class CandidateWindow; | 18 class CandidateWindow; |
19 } // namespace input_method | 19 } // namespace input_method |
20 | 20 |
21 class IBusText; | 21 class IBusText; |
22 | 22 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 }; | 169 }; |
170 | 170 |
171 | 171 |
172 // IBusBridge provides access of each IME related handler. This class is used | 172 // IBusBridge provides access of each IME related handler. This class is used |
173 // for IME implementation without ibus-daemon. The legacy ibus IME communicates | 173 // for IME implementation without ibus-daemon. The legacy ibus IME communicates |
174 // their engine with dbus protocol, but new implementation doesn't. Instead of | 174 // their engine with dbus protocol, but new implementation doesn't. Instead of |
175 // dbus communcation, new implementation calls target service(e.g. PanelService | 175 // dbus communcation, new implementation calls target service(e.g. PanelService |
176 // or EngineService) directly by using this class. | 176 // or EngineService) directly by using this class. |
177 class IBusBridge { | 177 class IBusBridge { |
178 public: | 178 public: |
| 179 typedef base::Callback<void()> CreateEngineHandler; |
| 180 |
179 virtual ~IBusBridge(); | 181 virtual ~IBusBridge(); |
180 | 182 |
181 // Allocates the global instance. Must be called before any calls to Get(). | 183 // Allocates the global instance. Must be called before any calls to Get(). |
182 static CHROMEOS_EXPORT void Initialize(); | 184 static CHROMEOS_EXPORT void Initialize(); |
183 | 185 |
184 // Releases the global instance. | 186 // Releases the global instance. |
185 static CHROMEOS_EXPORT void Shutdown(); | 187 static CHROMEOS_EXPORT void Shutdown(); |
186 | 188 |
187 // Returns IBusBridge global instance. Initialize() must be called first. | 189 // Returns IBusBridge global instance. Initialize() must be called first. |
188 static CHROMEOS_EXPORT IBusBridge* Get(); | 190 static CHROMEOS_EXPORT IBusBridge* Get(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 222 |
221 // Updates current PropertyHandler. If there is no active property service, | 223 // Updates current PropertyHandler. If there is no active property service, |
222 // pass NULL for |handler|. Caller must release |handler|. | 224 // pass NULL for |handler|. Caller must release |handler|. |
223 virtual void SetPropertyHandler( | 225 virtual void SetPropertyHandler( |
224 IBusPanelPropertyHandlerInterface* handler) = 0; | 226 IBusPanelPropertyHandlerInterface* handler) = 0; |
225 | 227 |
226 // Sets create engine handler for |engine_id|. |engine_id| must not be empty | 228 // Sets create engine handler for |engine_id|. |engine_id| must not be empty |
227 // and |handler| must not be null. | 229 // and |handler| must not be null. |
228 virtual void SetCreateEngineHandler( | 230 virtual void SetCreateEngineHandler( |
229 const std::string& engine_id, | 231 const std::string& engine_id, |
230 const IBusEngineFactoryService::CreateEngineHandler& handler) = 0; | 232 const CreateEngineHandler& handler) = 0; |
231 | 233 |
232 // Unsets create engine handler for |engine_id|. |engine_id| must not be | 234 // Unsets create engine handler for |engine_id|. |engine_id| must not be |
233 // empty. | 235 // empty. |
234 virtual void UnsetCreateEngineHandler(const std::string& engine_id) = 0; | 236 virtual void UnsetCreateEngineHandler(const std::string& engine_id) = 0; |
235 | 237 |
236 // Creates engine. Do not call this function before SetCreateEngineHandler | 238 // Creates engine. Do not call this function before SetCreateEngineHandler |
237 // call with |engine_id|. | 239 // call with |engine_id|. |
238 virtual void CreateEngine(const std::string& engine_id) = 0; | 240 virtual void CreateEngine(const std::string& engine_id) = 0; |
239 | 241 |
240 protected: | 242 protected: |
241 IBusBridge(); | 243 IBusBridge(); |
242 | 244 |
243 private: | 245 private: |
244 DISALLOW_COPY_AND_ASSIGN(IBusBridge); | 246 DISALLOW_COPY_AND_ASSIGN(IBusBridge); |
245 }; | 247 }; |
246 | 248 |
247 } // namespace chromeos | 249 } // namespace chromeos |
248 | 250 |
249 #endif // CHROMEOS_IME_IBUS_BRIDGE_H_ | 251 #endif // CHROMEOS_IME_IBUS_BRIDGE_H_ |
OLD | NEW |