| 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_DBUS_IBUS_IBUS_ENGINE_SERVICE_H_ | |
| 6 #define CHROMEOS_DBUS_IBUS_IBUS_ENGINE_SERVICE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include "base/bind.h" | |
| 10 #include "base/callback.h" | |
| 11 #include "base/memory/scoped_vector.h" | |
| 12 #include "chromeos/chromeos_export.h" | |
| 13 #include "chromeos/dbus/dbus_client_implementation_type.h" | |
| 14 #include "chromeos/dbus/ibus/ibus_constants.h" | |
| 15 | |
| 16 namespace chromeos { | |
| 17 | |
| 18 class IBusText; | |
| 19 class IBusEngineHandlerInterface; | |
| 20 | |
| 21 // A class to make the actual DBus method call handling for IBusEngine service. | |
| 22 // The exported method call is used by ibus-demon to process key event, because | |
| 23 // Chrome works engine service if the extension IME is enabled. This class is | |
| 24 // managed by DBusThreadManager. | |
| 25 class CHROMEOS_EXPORT IBusEngineService { | |
| 26 public: | |
| 27 // Following value should be same in | |
| 28 // http://ibus.googlecode.com/svn/docs/ibus-1.4/ibus-ibustypes.html#IBusPreedi
tFocusMode | |
| 29 enum IBusEnginePreeditFocusOutMode { | |
| 30 IBUS_ENGINE_PREEEDIT_FOCUS_OUT_MODE_CLEAR = 0, | |
| 31 IBUS_ENGINE_PREEEDIT_FOCUS_OUT_MODE_COMMIT = 1, | |
| 32 }; | |
| 33 | |
| 34 virtual ~IBusEngineService(); | |
| 35 | |
| 36 // Sets a new IBus engine handler and old handler will be overridden. | |
| 37 // This class doesn't take the ownership of |handler|. | |
| 38 virtual void SetEngine(IBusEngineHandlerInterface* handler) = 0; | |
| 39 | |
| 40 // Unsets the IBus engine handler if |handler| equals to current engine | |
| 41 // handler. | |
| 42 virtual void UnsetEngine(IBusEngineHandlerInterface* handler) = 0; | |
| 43 | |
| 44 // Emits UpdatePreedit signal. | |
| 45 virtual void UpdatePreedit(const IBusText& ibus_text, | |
| 46 uint32 cursor_pos, | |
| 47 bool is_visible, | |
| 48 IBusEnginePreeditFocusOutMode mode) = 0; | |
| 49 // Emits UpdateAuxiliaryText signal. | |
| 50 virtual void UpdateAuxiliaryText(const IBusText& ibus_text, | |
| 51 bool is_visible) = 0; | |
| 52 // Emits ForwardKeyEvent signal. | |
| 53 virtual void ForwardKeyEvent(uint32 keyval, uint32 keycode, uint32 state) = 0; | |
| 54 // Emits RequireSurroundingText signal. | |
| 55 virtual void RequireSurroundingText() = 0; | |
| 56 // Emits DeleteSurroundingText signal. | |
| 57 virtual void DeleteSurroundingText(int32 offset, uint32 length) = 0; | |
| 58 | |
| 59 // Factory function, creates a new instance and returns ownership. | |
| 60 // For normal usage, access the singleton via DBusThreadManager::Get(). | |
| 61 static CHROMEOS_EXPORT IBusEngineService* Create(); | |
| 62 | |
| 63 protected: | |
| 64 // Create() should be used instead. | |
| 65 IBusEngineService(); | |
| 66 | |
| 67 private: | |
| 68 DISALLOW_COPY_AND_ASSIGN(IBusEngineService); | |
| 69 }; | |
| 70 | |
| 71 } // namespace chromeos | |
| 72 | |
| 73 #endif // CHROMEOS_DBUS_IBUS_IBUS_ENGINE_SERVICE_H_ | |
| OLD | NEW |