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 | 4 |
5 #ifndef CHROMEOS_DBUS_IBUS_IBUS_ENGINE_SERVICE_H_ | 5 #ifndef CHROMEOS_DBUS_IBUS_IBUS_ENGINE_SERVICE_H_ |
6 #define CHROMEOS_DBUS_IBUS_IBUS_ENGINE_SERVICE_H_ | 6 #define CHROMEOS_DBUS_IBUS_IBUS_ENGINE_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "chromeos/chromeos_export.h" | 12 #include "chromeos/chromeos_export.h" |
13 #include "chromeos/dbus/dbus_client_implementation_type.h" | 13 #include "chromeos/dbus/dbus_client_implementation_type.h" |
14 #include "chromeos/dbus/ibus/ibus_constants.h" | 14 #include "chromeos/dbus/ibus/ibus_constants.h" |
15 | 15 |
16 namespace dbus { | 16 namespace dbus { |
17 class Bus; | 17 class Bus; |
18 class ObjectPath; | 18 class ObjectPath; |
19 } // namespace dbus | 19 } // namespace dbus |
20 | 20 |
21 namespace chromeos { | 21 namespace chromeos { |
22 | 22 |
23 // TODO(nona): Remove ibus namespace after complete libibus removal. | |
24 namespace ibus { | |
25 class IBusLookupTable; | 23 class IBusLookupTable; |
26 class IBusProperty; | 24 class IBusProperty; |
27 class IBusText; | 25 class IBusText; |
28 typedef ScopedVector<IBusProperty> IBusPropertyList; | 26 typedef ScopedVector<IBusProperty> IBusPropertyList; |
29 } // namespace | |
30 | 27 |
31 // A interface to handle the engine handler method call. | 28 // A interface to handle the engine handler method call. |
32 class CHROMEOS_EXPORT IBusEngineHandlerInterface { | 29 class CHROMEOS_EXPORT IBusEngineHandlerInterface { |
33 public: | 30 public: |
34 typedef base::Callback<void (bool consumed)> KeyEventDoneCallback; | 31 typedef base::Callback<void (bool consumed)> KeyEventDoneCallback; |
35 | 32 |
36 // Following capability mask is introduced from | 33 // Following capability mask is introduced from |
37 // http://ibus.googlecode.com/svn/docs/ibus-1.4/ibus-ibustypes.html#IBusCapabi
lite | 34 // http://ibus.googlecode.com/svn/docs/ibus-1.4/ibus-ibustypes.html#IBusCapabi
lite |
38 // TODO(nona): Move to ibus_contants and merge one in ui/base/ime/* | 35 // TODO(nona): Move to ibus_contants and merge one in ui/base/ime/* |
39 enum IBusCapability { | 36 enum IBusCapability { |
40 IBUS_CAPABILITY_PREEDIT_TEXT = 1U, | 37 IBUS_CAPABILITY_PREEDIT_TEXT = 1U, |
41 IBUS_CAPABILITY_FOCUS = 8U, | 38 IBUS_CAPABILITY_FOCUS = 8U, |
42 }; | 39 }; |
43 | 40 |
44 // Following property state value is introduced from | |
45 // http://ibus.googlecode.com/svn/docs/ibus-1.4/IBusProperty.html#IBusPropStat
e | |
46 enum IBusPropertyState { | |
47 IBUS_PROPERTY_STATE_UNCHECKED = 0U, | |
48 IBUS_PROPERTY_STATE_CHECKED = 1U, | |
49 IBUS_PROPERTY_STATE_INCONSISTENT = 2U, | |
50 }; | |
51 | |
52 virtual ~IBusEngineHandlerInterface() {} | 41 virtual ~IBusEngineHandlerInterface() {} |
53 | 42 |
54 // Called when the Chrome input field get the focus. | 43 // Called when the Chrome input field get the focus. |
55 virtual void FocusIn() = 0; | 44 virtual void FocusIn() = 0; |
56 | 45 |
57 // Called when the Chrome input field lose the focus. | 46 // Called when the Chrome input field lose the focus. |
58 virtual void FocusOut() = 0; | 47 virtual void FocusOut() = 0; |
59 | 48 |
60 // Called when the IME is enabled. | 49 // Called when the IME is enabled. |
61 virtual void Enable() = 0; | 50 virtual void Enable() = 0; |
62 | 51 |
63 // Called when the IME is disabled. | 52 // Called when the IME is disabled. |
64 virtual void Disable() = 0; | 53 virtual void Disable() = 0; |
65 | 54 |
66 // Called when a property is activated or changed. | 55 // Called when a property is activated or changed. |
67 virtual void PropertyActivate(const std::string& property_name, | 56 virtual void PropertyActivate(const std::string& property_name, |
68 IBusPropertyState property_state) = 0; | 57 ibus::IBusPropertyState property_state) = 0; |
69 | 58 |
70 // Called when a property is shown. | 59 // Called when a property is shown. |
71 virtual void PropertyShow(const std::string& property_name) = 0; | 60 virtual void PropertyShow(const std::string& property_name) = 0; |
72 | 61 |
73 // Called when a property is hidden. | 62 // Called when a property is hidden. |
74 virtual void PropertyHide(const std::string& property_name) = 0; | 63 virtual void PropertyHide(const std::string& property_name) = 0; |
75 | 64 |
76 // Called when the Chrome input field set their capabilities. | 65 // Called when the Chrome input field set their capabilities. |
77 virtual void SetCapability(IBusCapability capability) = 0; | 66 virtual void SetCapability(IBusCapability capability) = 0; |
78 | 67 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 114 |
126 // Sets a new IBus engine handler and old handler will be overridden. | 115 // Sets a new IBus engine handler and old handler will be overridden. |
127 // This class doesn't take the ownership of |handler|. | 116 // This class doesn't take the ownership of |handler|. |
128 virtual void SetEngine(IBusEngineHandlerInterface* handler) = 0; | 117 virtual void SetEngine(IBusEngineHandlerInterface* handler) = 0; |
129 | 118 |
130 // Unsets the current IBus engine handler. | 119 // Unsets the current IBus engine handler. |
131 virtual void UnsetEngine() = 0; | 120 virtual void UnsetEngine() = 0; |
132 | 121 |
133 // Emits RegisterProperties signal. | 122 // Emits RegisterProperties signal. |
134 virtual void RegisterProperties( | 123 virtual void RegisterProperties( |
135 const ibus::IBusPropertyList& property_list) = 0; | 124 const IBusPropertyList& property_list) = 0; |
136 // Emits UpdatePreedit signal. | 125 // Emits UpdatePreedit signal. |
137 virtual void UpdatePreedit(const ibus::IBusText& ibus_text, | 126 virtual void UpdatePreedit(const IBusText& ibus_text, |
138 uint32 cursor_pos, | 127 uint32 cursor_pos, |
139 bool is_visible, | 128 bool is_visible, |
140 IBusEnginePreeditFocusOutMode mode) = 0; | 129 IBusEnginePreeditFocusOutMode mode) = 0; |
141 // Emits UpdateAuxiliaryText signal. | 130 // Emits UpdateAuxiliaryText signal. |
142 virtual void UpdateAuxiliaryText(const ibus::IBusText& ibus_text, | 131 virtual void UpdateAuxiliaryText(const IBusText& ibus_text, |
143 bool is_visible) = 0; | 132 bool is_visible) = 0; |
144 // Emits UpdateLookupTable signal. | 133 // Emits UpdateLookupTable signal. |
145 virtual void UpdateLookupTable(const ibus::IBusLookupTable& lookup_table, | 134 virtual void UpdateLookupTable(const IBusLookupTable& lookup_table, |
146 bool is_visible) = 0; | 135 bool is_visible) = 0; |
147 // Emits UpdateProperty signal. | 136 // Emits UpdateProperty signal. |
148 virtual void UpdateProperty(const ibus::IBusProperty& property) = 0; | 137 virtual void UpdateProperty(const IBusProperty& property) = 0; |
149 // Emits ForwardKeyEvent signal. | 138 // Emits ForwardKeyEvent signal. |
150 virtual void ForwardKeyEvent(uint32 keyval, uint32 keycode, uint32 state) = 0; | 139 virtual void ForwardKeyEvent(uint32 keyval, uint32 keycode, uint32 state) = 0; |
151 // Emits RequireSurroundingText signal. | 140 // Emits RequireSurroundingText signal. |
152 virtual void RequireSurroundingText() = 0; | 141 virtual void RequireSurroundingText() = 0; |
153 // Emits CommitText signal. | 142 // Emits CommitText signal. |
154 virtual void CommitText(const std::string& text) = 0; | 143 virtual void CommitText(const std::string& text) = 0; |
155 | 144 |
156 // Factory function, creates a new instance and returns ownership. | 145 // Factory function, creates a new instance and returns ownership. |
157 // For normal usage, access the singleton via DBusThreadManager::Get(). | 146 // For normal usage, access the singleton via DBusThreadManager::Get(). |
158 static CHROMEOS_EXPORT IBusEngineService* Create( | 147 static CHROMEOS_EXPORT IBusEngineService* Create( |
159 DBusClientImplementationType type, | 148 DBusClientImplementationType type, |
160 dbus::Bus* bus, | 149 dbus::Bus* bus, |
161 const dbus::ObjectPath& object_path); | 150 const dbus::ObjectPath& object_path); |
162 | 151 |
163 protected: | 152 protected: |
164 // Create() should be used instead. | 153 // Create() should be used instead. |
165 IBusEngineService(); | 154 IBusEngineService(); |
166 | 155 |
167 private: | 156 private: |
168 DISALLOW_COPY_AND_ASSIGN(IBusEngineService); | 157 DISALLOW_COPY_AND_ASSIGN(IBusEngineService); |
169 }; | 158 }; |
170 | 159 |
171 } // namespace chromeos | 160 } // namespace chromeos |
172 | 161 |
173 #endif // CHROMEOS_DBUS_IBUS_IBUS_ENGINE_SERVICE_H_ | 162 #endif // CHROMEOS_DBUS_IBUS_IBUS_ENGINE_SERVICE_H_ |
OLD | NEW |