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

Side by Side Diff: ui/base/ime/input_method_ibus.h

Issue 10656017: Clean UP: Remove IBusClientImpl from ui/base/ime/* (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix WinAura Created 8 years, 5 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 | « ui/base/ime/ime_unittests.gypi ('k') | ui/base/ime/input_method_ibus.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 UI_BASE_IME_INPUT_METHOD_IBUS_H_ 5 #ifndef UI_BASE_IME_INPUT_METHOD_IBUS_H_
6 #define UI_BASE_IME_INPUT_METHOD_IBUS_H_ 6 #define UI_BASE_IME_INPUT_METHOD_IBUS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "ui/base/ime/character_composer.h" 16 #include "ui/base/ime/character_composer.h"
17 #include "ui/base/ime/composition_text.h" 17 #include "ui/base/ime/composition_text.h"
18 #include "ui/base/ime/ibus_client.h" 18 #include "ui/base/ime/ibus_client.h"
19 #include "ui/base/ime/input_method_base.h" 19 #include "ui/base/ime/input_method_base.h"
20 20
21 namespace dbus {
22 class ObjectPath;
23 }
21 namespace chromeos { 24 namespace chromeos {
22 namespace ibus { 25 namespace ibus {
23 class IBusText; 26 class IBusText;
24 } // namespace ibus 27 } // namespace ibus
25 } // namespace chromeos 28 } // namespace chromeos
26 29
27 namespace ui { 30 namespace ui {
28 31
29 // A ui::InputMethod implementation based on IBus. 32 // A ui::InputMethod implementation based on IBus.
30 class UI_EXPORT InputMethodIBus : public InputMethodBase { 33 class UI_EXPORT InputMethodIBus : public InputMethodBase {
(...skipping 27 matching lines...) Expand all
58 // The caller is not allowed to delete the object. 61 // The caller is not allowed to delete the object.
59 internal::IBusClient* ibus_client() const; 62 internal::IBusClient* ibus_client() const;
60 63
61 protected: 64 protected:
62 // Converts |text| into CompositionText. 65 // Converts |text| into CompositionText.
63 void ExtractCompositionText(const chromeos::ibus::IBusText& text, 66 void ExtractCompositionText(const chromeos::ibus::IBusText& text,
64 uint32 cursor_position, 67 uint32 cursor_position,
65 CompositionText* out_composition) const; 68 CompositionText* out_composition) const;
66 69
67 private: 70 private:
68 class PendingKeyEventImpl; 71 class PendingKeyEvent;
69 class PendingCreateICRequestImpl; 72 class PendingCreateICRequest;
70 73
71 // Overridden from InputMethodBase: 74 // Overridden from InputMethodBase:
72 virtual void OnWillChangeFocusedClient(TextInputClient* focused_before, 75 virtual void OnWillChangeFocusedClient(TextInputClient* focused_before,
73 TextInputClient* focused) OVERRIDE; 76 TextInputClient* focused) OVERRIDE;
74 virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, 77 virtual void OnDidChangeFocusedClient(TextInputClient* focused_before,
75 TextInputClient* focused) OVERRIDE; 78 TextInputClient* focused) OVERRIDE;
76 79
77 // Creates context asynchronously. 80 // Creates context asynchronously.
78 void CreateContext(); 81 void CreateContext();
79 82
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 129
127 // Checks if there is pending input method result. 130 // Checks if there is pending input method result.
128 bool HasInputMethodResult() const; 131 bool HasInputMethodResult() const;
129 132
130 // Fabricates a key event with VKEY_PROCESSKEY key code and dispatches it to 133 // Fabricates a key event with VKEY_PROCESSKEY key code and dispatches it to
131 // the focused View. 134 // the focused View.
132 void SendFakeProcessKeyEvent(bool pressed) const; 135 void SendFakeProcessKeyEvent(bool pressed) const;
133 136
134 // Called when a pending key event has finished. The event will be removed 137 // Called when a pending key event has finished. The event will be removed
135 // from |pending_key_events_|. 138 // from |pending_key_events_|.
136 void FinishPendingKeyEvent(PendingKeyEventImpl* pending_key); 139 void FinishPendingKeyEvent(PendingKeyEvent* pending_key);
137 140
138 // Abandons all pending key events. It usually happends when we lose keyboard 141 // Abandons all pending key events. It usually happends when we lose keyboard
139 // focus, the text input type is changed or we are destroyed. 142 // focus, the text input type is changed or we are destroyed.
140 void AbandonAllPendingKeyEvents(); 143 void AbandonAllPendingKeyEvents();
141 144
142 // Releases context focus and confirms the composition text. Then destroy 145 // Releases context focus and confirms the composition text. Then destroy
143 // object proxy. 146 // object proxy.
144 void ResetInputContext(); 147 void ResetInputContext();
145 148
149 // Returns true if the connection to ibus-daemon is established.
150 bool IsConnected();
151
152 // Returns true if the input context is ready to use.
153 bool IsContextReady();
154
146 // Event handlers for IBusInputContext: 155 // Event handlers for IBusInputContext:
147 void OnCommitText(const chromeos::ibus::IBusText& text); 156 void OnCommitText(const chromeos::ibus::IBusText& text);
148 void OnForwardKeyEvent(uint32 keyval, uint32 keycode, uint32 status); 157 void OnForwardKeyEvent(uint32 keyval, uint32 keycode, uint32 status);
149 void OnShowPreeditText(); 158 void OnShowPreeditText();
150 void OnUpdatePreeditText(const chromeos::ibus::IBusText& text, 159 void OnUpdatePreeditText(const chromeos::ibus::IBusText& text,
151 uint32 cursor_pos, 160 uint32 cursor_pos,
152 bool visible); 161 bool visible);
153 void OnHidePreeditText(); 162 void OnHidePreeditText();
154 163
155 void CreateInputContextDone(PendingCreateICRequestImpl* ic_request, 164 void CreateInputContextDone(PendingCreateICRequest* ic_request,
156 const dbus::ObjectPath& object_path); 165 const dbus::ObjectPath& object_path);
157 static void ProcessKeyEventDone(PendingKeyEventImpl* pending_key_event, 166 void CreateInputContextFail(PendingCreateICRequest* ic_request);
167 static void ProcessKeyEventDone(PendingKeyEvent* pending_key_event,
158 bool is_handled); 168 bool is_handled);
159 169
160 scoped_ptr<internal::IBusClient> ibus_client_; 170 scoped_ptr<internal::IBusClient> ibus_client_;
161 171
162 // All pending key events. Note: we do not own these object, we just save 172 // All pending key events. Note: we do not own these object, we just save
163 // pointers to these object so that we can abandon them when necessary. 173 // pointers to these object so that we can abandon them when necessary.
164 // They will be deleted in ProcessKeyEventDone(). 174 // They will be deleted in ProcessKeyEventDone().
165 std::set<PendingKeyEventImpl*> pending_key_events_; 175 std::set<PendingKeyEvent*> pending_key_events_;
166 176
167 // The pending request for creating the input context. We need to keep this 177 // The pending request for creating the input context. We need to keep this
168 // pointer so that we can receive or abandon the result. 178 // pointer so that we can receive or abandon the result.
169 PendingCreateICRequestImpl* pending_create_ic_request_; 179 PendingCreateICRequest* pending_create_ic_request_;
170 180
171 // Pending composition text generated by the current pending key event. 181 // Pending composition text generated by the current pending key event.
172 // It'll be sent to the focused text input client as soon as we receive the 182 // It'll be sent to the focused text input client as soon as we receive the
173 // processing result of the pending key event. 183 // processing result of the pending key event.
174 CompositionText composition_; 184 CompositionText composition_;
175 185
176 // Pending result text generated by the current pending key event. 186 // Pending result text generated by the current pending key event.
177 // It'll be sent to the focused text input client as soon as we receive the 187 // It'll be sent to the focused text input client as soon as we receive the
178 // processing result of the pending key event. 188 // processing result of the pending key event.
179 string16 result_text_; 189 string16 result_text_;
(...skipping 17 matching lines...) Expand all
197 207
198 // Used for making callbacks. 208 // Used for making callbacks.
199 base::WeakPtrFactory<InputMethodIBus> weak_ptr_factory_; 209 base::WeakPtrFactory<InputMethodIBus> weak_ptr_factory_;
200 210
201 DISALLOW_COPY_AND_ASSIGN(InputMethodIBus); 211 DISALLOW_COPY_AND_ASSIGN(InputMethodIBus);
202 }; 212 };
203 213
204 } // namespace ui 214 } // namespace ui
205 215
206 #endif // UI_BASE_IME_INPUT_METHOD_IBUS_H_ 216 #endif // UI_BASE_IME_INPUT_METHOD_IBUS_H_
OLDNEW
« no previous file with comments | « ui/base/ime/ime_unittests.gypi ('k') | ui/base/ime/input_method_ibus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698