Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: chromeos/dbus/ibus/ibus_engine_service.h

Issue 10835003: Revise IBusEngineService. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/dbus/ibus/ibus_constants.h ('k') | chromeos/dbus/ibus/ibus_engine_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 12 matching lines...) Expand all
23 namespace ibus { 23 namespace ibus {
24 class IBusLookupTable; 24 class IBusLookupTable;
25 class IBusProperty; 25 class IBusProperty;
26 class IBusText; 26 class IBusText;
27 typedef ScopedVector<IBusProperty> IBusPropertyList; 27 typedef ScopedVector<IBusProperty> IBusPropertyList;
28 } // namespace 28 } // namespace
29 29
30 // A interface to handle the engine client method call. 30 // A interface to handle the engine client method call.
31 class CHROMEOS_EXPORT IBusEngineHandlerInterface { 31 class CHROMEOS_EXPORT IBusEngineHandlerInterface {
32 public: 32 public:
33 typedef base::Callback<void (bool consumed)> KeyEventDoneCallback;
34
33 // Following capability mask is introduced from 35 // Following capability mask is introduced from
34 // http://ibus.googlecode.com/svn/docs/ibus-1.4/ibus-ibustypes.html#IBusCapabi lite 36 // http://ibus.googlecode.com/svn/docs/ibus-1.4/ibus-ibustypes.html#IBusCapabi lite
35 // TODO(nona): Move to ibus_contants and merge one in ui/base/ime/* 37 // TODO(nona): Move to ibus_contants and merge one in ui/base/ime/*
36 enum IBusCapability { 38 enum IBusCapability {
37 IBUS_CAPABILITY_PREEDIT_TEXT = 1U, 39 IBUS_CAPABILITY_PREEDIT_TEXT = 1U,
38 IBUS_CAPABILITY_FOCUS = 8U, 40 IBUS_CAPABILITY_FOCUS = 8U,
39 }; 41 };
40 42
41 // Following property state value is introduced from 43 // Following property state value is introduced from
42 // http://ibus.googlecode.com/svn/docs/ibus-1.4/IBusProperty.html#IBusPropStat e 44 // http://ibus.googlecode.com/svn/docs/ibus-1.4/IBusProperty.html#IBusPropStat e
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 82
81 // Called when the Chrome input field set their capabilities. 83 // Called when the Chrome input field set their capabilities.
82 virtual void SetCapability(IBusCapability capability) = 0; 84 virtual void SetCapability(IBusCapability capability) = 0;
83 85
84 // Called when the IME is reset. 86 // Called when the IME is reset.
85 virtual void Reset() = 0; 87 virtual void Reset() = 0;
86 88
87 // Called when the key event is received. The |keycode| is raw layout 89 // Called when the key event is received. The |keycode| is raw layout
88 // independent keycode. The |keysym| is result of XLookupString function 90 // independent keycode. The |keysym| is result of XLookupString function
89 // which translate |keycode| to keyboard layout dependent symbol value. 91 // which translate |keycode| to keyboard layout dependent symbol value.
92 // Actual implementation must call |callback| after key event handling.
90 // For example: key press event for 'd' key on us layout and dvorak layout. 93 // For example: key press event for 'd' key on us layout and dvorak layout.
91 // keyval keycode state 94 // keyval keycode state
92 // us layout : 0x64 0x20 0x00 95 // us layout : 0x64 0x20 0x00
93 // dvorak layout : 0x65 0x20 0x00 96 // dvorak layout : 0x65 0x20 0x00
94 virtual bool ProcessKeyEvent(uint32 keysym, uint32 keycode, uint32 state) = 0; 97 virtual void ProcessKeyEvent(uint32 keysym, uint32 keycode, uint32 state,
98 const KeyEventDoneCallback& callback) = 0;
95 99
96 // Called when the candidate in lookup table is clicked. The |index| is 0 100 // Called when the candidate in lookup table is clicked. The |index| is 0
97 // based candidate index in lookup table. The |state| is same value as 101 // based candidate index in lookup table. The |state| is same value as
98 // GdkModifierType in 102 // GdkModifierType in
99 // http://developer.gnome.org/gdk/stable/gdk-Windows.html#GdkModifierType 103 // http://developer.gnome.org/gdk/stable/gdk-Windows.html#GdkModifierType
100 virtual void CandidateClicked(uint32 index, IBusMouseButton button, 104 virtual void CandidateClicked(uint32 index, IBusMouseButton button,
101 uint32 state) = 0; 105 uint32 state) = 0;
102 106
103 // Called when a new surrounding text is set. The |text| is surrounding text 107 // Called when a new surrounding text is set. The |text| is surrounding text
104 // and |cursor_pos| is 0 based index of cursor position in |text|. If there is 108 // and |cursor_pos| is 0 based index of cursor position in |text|. If there is
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 bool is_visible) = 0; 146 bool is_visible) = 0;
143 // Emits UpdateLookupTable signal. 147 // Emits UpdateLookupTable signal.
144 virtual void UpdateLookupTable(const ibus::IBusLookupTable& lookup_table, 148 virtual void UpdateLookupTable(const ibus::IBusLookupTable& lookup_table,
145 bool is_visible) = 0; 149 bool is_visible) = 0;
146 // Emits UpdateProperty signal. 150 // Emits UpdateProperty signal.
147 virtual void UpdateProperty(const ibus::IBusProperty& property) = 0; 151 virtual void UpdateProperty(const ibus::IBusProperty& property) = 0;
148 // Emits ForwardKeyEvent signal. 152 // Emits ForwardKeyEvent signal.
149 virtual void ForwardKeyEvent(uint32 keyval, uint32 keycode, uint32 state) = 0; 153 virtual void ForwardKeyEvent(uint32 keyval, uint32 keycode, uint32 state) = 0;
150 // Emits RequireSurroundingText signal. 154 // Emits RequireSurroundingText signal.
151 virtual void RequireSurroundingText() = 0; 155 virtual void RequireSurroundingText() = 0;
156 // Emits CommitText signal.
157 virtual void CommitText(const std::string& text) = 0;
152 158
153 // Factory function, creates a new instance and returns ownership. 159 // Factory function, creates a new instance and returns ownership.
154 // For normal usage, access the singleton via DBusThreadManager::Get(). 160 // For normal usage, access the singleton via DBusThreadManager::Get().
155 static CHROMEOS_EXPORT IBusEngineService* Create( 161 static CHROMEOS_EXPORT IBusEngineService* Create(
156 DBusClientImplementationType type, 162 DBusClientImplementationType type,
157 dbus::Bus* bus, 163 dbus::Bus* bus,
158 const dbus::ObjectPath& object_path); 164 const dbus::ObjectPath& object_path);
159 165
160 protected: 166 protected:
161 // Create() should be used instead. 167 // Create() should be used instead.
162 IBusEngineService(); 168 IBusEngineService();
163 169
164 private: 170 private:
165 DISALLOW_COPY_AND_ASSIGN(IBusEngineService); 171 DISALLOW_COPY_AND_ASSIGN(IBusEngineService);
166 }; 172 };
167 173
168 } // namespace chromeos 174 } // namespace chromeos
169 175
170 #endif // CHROMEOS_DBUS_IBUS_IBUS_ENGINE_SERVICE_H_ 176 #endif // CHROMEOS_DBUS_IBUS_IBUS_ENGINE_SERVICE_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/ibus/ibus_constants.h ('k') | chromeos/dbus/ibus/ibus_engine_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698