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 CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_IBUS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_IBUS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_IBUS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_IBUS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/chromeos/input_method/input_method_engine.h" | 12 #include "chrome/browser/chromeos/input_method/input_method_engine.h" |
13 #include "chromeos/ime/ibus_bridge.h" | 13 #include "chromeos/ime/ibus_bridge.h" |
14 #include "dbus/object_path.h" | 14 #include "dbus/object_path.h" |
15 | 15 |
16 namespace chromeos { | 16 namespace chromeos { |
17 | 17 |
18 class IBusText; | 18 class IBusText; |
19 | 19 |
20 class IBusEngineService; | |
21 | |
22 namespace input_method { | 20 namespace input_method { |
23 class CandidateWindow; | 21 class CandidateWindow; |
24 struct KeyEventHandle; | 22 struct KeyEventHandle; |
25 } // namespace input_method | 23 } // namespace input_method |
26 | 24 |
27 class InputMethodEngineIBus : public InputMethodEngine, | 25 class InputMethodEngineIBus : public InputMethodEngine, |
28 public IBusEngineHandlerInterface { | 26 public IBusEngineHandlerInterface { |
29 public: | 27 public: |
30 InputMethodEngineIBus(); | 28 InputMethodEngineIBus(); |
31 | 29 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 void MenuItemToProperty(const MenuItem& item, | 104 void MenuItemToProperty(const MenuItem& item, |
107 input_method::InputMethodProperty* property); | 105 input_method::InputMethodProperty* property); |
108 | 106 |
109 // Registers the engine component. | 107 // Registers the engine component. |
110 void RegisterComponent(); | 108 void RegisterComponent(); |
111 | 109 |
112 // Called when the IBusBrige executes CreateEngine with | 110 // Called when the IBusBrige executes CreateEngine with |
113 // corresponding engine id. | 111 // corresponding engine id. |
114 void CreateEngineHandler(); | 112 void CreateEngineHandler(); |
115 | 113 |
116 // Returns current IBusEngineService, if there is no available service, this | |
117 // function returns NULL. | |
118 IBusEngineService* GetCurrentService(); | |
119 | |
120 // True if the current context has focus. | 114 // True if the current context has focus. |
121 bool focused_; | 115 bool focused_; |
122 | 116 |
123 // True if this engine is active. | 117 // True if this engine is active. |
124 bool active_; | 118 bool active_; |
125 | 119 |
126 // ID that is used for the current input context. False if there is no focus. | 120 // ID that is used for the current input context. False if there is no focus. |
127 int context_id_; | 121 int context_id_; |
128 | 122 |
129 // Next id that will be assigned to a context. | 123 // Next id that will be assigned to a context. |
130 int next_context_id_; | 124 int next_context_id_; |
131 | 125 |
132 // This IME ID in Chrome Extension. | 126 // This IME ID in Chrome Extension. |
133 std::string engine_id_; | 127 std::string engine_id_; |
134 | 128 |
135 // This IME ID in ibus. | 129 // This IME ID in ibus. |
136 std::string ibus_id_; | 130 std::string ibus_id_; |
137 | 131 |
138 // Flag whether CreateEngineHandler is called or not. | |
139 bool is_create_engine_handler_called_; | |
140 | |
141 // The current auxialy text and it's visiblity. | 132 // The current auxialy text and it's visiblity. |
142 scoped_ptr<IBusText> aux_text_; | 133 scoped_ptr<IBusText> aux_text_; |
143 bool aux_text_visible_; | 134 bool aux_text_visible_; |
144 | 135 |
145 // Pointer to the object recieving events for this IME. | 136 // Pointer to the object recieving events for this IME. |
146 InputMethodEngine::Observer* observer_; | 137 InputMethodEngine::Observer* observer_; |
147 | 138 |
148 // The current preedit text, and it's cursor position. | 139 // The current preedit text, and it's cursor position. |
149 scoped_ptr<IBusText> preedit_text_; | 140 scoped_ptr<IBusText> preedit_text_; |
150 int preedit_cursor_; | 141 int preedit_cursor_; |
151 | 142 |
152 // The current candidate window. | 143 // The current candidate window. |
153 scoped_ptr<input_method::CandidateWindow> candidate_window_; | 144 scoped_ptr<input_method::CandidateWindow> candidate_window_; |
154 | 145 |
155 // The current candidate window property. | 146 // The current candidate window property. |
156 CandidateWindowProperty candidate_window_property_; | 147 CandidateWindowProperty candidate_window_property_; |
157 | 148 |
158 // Indicates whether the candidate window is visible. | 149 // Indicates whether the candidate window is visible. |
159 bool window_visible_; | 150 bool window_visible_; |
160 | 151 |
161 // Mapping of candidate index to candidate id. | 152 // Mapping of candidate index to candidate id. |
162 std::vector<int> candidate_ids_; | 153 std::vector<int> candidate_ids_; |
163 | 154 |
164 // Mapping of candidate id to index. | 155 // Mapping of candidate id to index. |
165 std::map<int, int> candidate_indexes_; | 156 std::map<int, int> candidate_indexes_; |
166 | 157 |
167 scoped_ptr<IBusEngineService> ibus_engine_service_; | |
168 | |
169 // Used for making callbacks. | 158 // Used for making callbacks. |
170 base::WeakPtrFactory<InputMethodEngineIBus> weak_ptr_factory_; | 159 base::WeakPtrFactory<InputMethodEngineIBus> weak_ptr_factory_; |
171 }; | 160 }; |
172 | 161 |
173 } // namespace chromeos | 162 } // namespace chromeos |
174 | 163 |
175 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_IBUS_H_ | 164 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_IBUS_H_ |
OLD | NEW |