Chromium Code Reviews| 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 "chrome/browser/chromeos/input_method/input_method_engine.h" | 12 #include "chrome/browser/chromeos/input_method/input_method_engine.h" |
| 12 #include "chromeos/ime/ibus_bridge.h" | 13 #include "chromeos/ime/ibus_bridge.h" |
| 13 #include "dbus/object_path.h" | 14 #include "dbus/object_path.h" |
| 14 | 15 |
| 15 namespace chromeos { | 16 namespace chromeos { |
| 16 | 17 |
| 17 class IBusText; | 18 class IBusText; |
| 18 | 19 |
| 19 class IBusEngineFactoryService; | |
| 20 class IBusEngineService; | 20 class IBusEngineService; |
| 21 | 21 |
| 22 namespace input_method { | 22 namespace input_method { |
| 23 class CandidateWindow; | 23 class CandidateWindow; |
| 24 struct KeyEventHandle; | 24 struct KeyEventHandle; |
| 25 } // namespace input_method | 25 } // namespace input_method |
| 26 | 26 |
| 27 class InputMethodEngineIBus : public InputMethodEngine, | 27 class InputMethodEngineIBus : public InputMethodEngine, |
| 28 public IBusEngineHandlerInterface { | 28 public IBusEngineHandlerInterface { |
| 29 public: | 29 public: |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 virtual void SetCapability(IBusCapability capability) OVERRIDE; | 88 virtual void SetCapability(IBusCapability capability) OVERRIDE; |
| 89 virtual void Reset() OVERRIDE; | 89 virtual void Reset() OVERRIDE; |
| 90 virtual void ProcessKeyEvent(uint32 keysym, uint32 keycode, uint32 state, | 90 virtual void ProcessKeyEvent(uint32 keysym, uint32 keycode, uint32 state, |
| 91 const KeyEventDoneCallback& callback) OVERRIDE; | 91 const KeyEventDoneCallback& callback) OVERRIDE; |
| 92 virtual void CandidateClicked(uint32 index, ibus::IBusMouseButton button, | 92 virtual void CandidateClicked(uint32 index, ibus::IBusMouseButton button, |
| 93 uint32 state) OVERRIDE; | 93 uint32 state) OVERRIDE; |
| 94 virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos, | 94 virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos, |
| 95 uint32 anchor_pos) OVERRIDE; | 95 uint32 anchor_pos) OVERRIDE; |
| 96 | 96 |
| 97 // Called when the connection with ibus-daemon is connected. | 97 // Called when the connection with ibus-daemon is connected. |
| 98 void OnConnected(); | 98 void OnConnected(); |
|
Seigo Nonaka
2013/11/12 03:37:22
This function does no longer make sense.
Please re
Hiro Komatsu
2013/11/12 05:01:39
Thank you for the information. Please let me do i
| |
| 99 | 99 |
| 100 // Called whtn the connection with ibus-daemon is disconnected. | 100 // Called whtn the connection with ibus-daemon is disconnected. |
| 101 void OnDisconnected(); | 101 void OnDisconnected(); |
|
Seigo Nonaka
2013/11/12 03:37:22
ditto
Hiro Komatsu
2013/11/12 05:01:39
Here too.
| |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 // Converts MenuItem to InputMethodProperty. | 104 // Converts MenuItem to InputMethodProperty. |
| 105 void MenuItemToProperty(const MenuItem& item, | 105 void MenuItemToProperty(const MenuItem& item, |
| 106 input_method::InputMethodProperty* property); | 106 input_method::InputMethodProperty* property); |
| 107 | 107 |
| 108 // Registers the engine component. | 108 // Registers the engine component. |
| 109 void RegisterComponent(); | 109 void RegisterComponent(); |
| 110 | 110 |
| 111 // Called when the ibus-daemon sends CreateEngine message with corresponding | 111 // Called when the IBusBrige executes CreateEngine with |
| 112 // engine id. | 112 // corresponding engine id. |
| 113 void CreateEngineHandler( | 113 void CreateEngineHandler(); |
| 114 const IBusEngineFactoryService::CreateEngineResponseSender& sender); | |
| 115 | 114 |
| 116 // Returns current IBusEngineService, if there is no available service, this | 115 // Returns current IBusEngineService, if there is no available service, this |
| 117 // function returns NULL. | 116 // function returns NULL. |
| 118 IBusEngineService* GetCurrentService(); | 117 IBusEngineService* GetCurrentService(); |
| 119 | 118 |
| 120 // True if the current context has focus. | 119 // True if the current context has focus. |
| 121 bool focused_; | 120 bool focused_; |
| 122 | 121 |
| 123 // True if this engine is active. | 122 // True if this engine is active. |
| 124 bool active_; | 123 bool active_; |
| 125 | 124 |
| 126 // ID that is used for the current input context. False if there is no focus. | 125 // ID that is used for the current input context. False if there is no focus. |
| 127 int context_id_; | 126 int context_id_; |
| 128 | 127 |
| 129 // Next id that will be assigned to a context. | 128 // Next id that will be assigned to a context. |
| 130 int next_context_id_; | 129 int next_context_id_; |
| 131 | 130 |
| 132 // This IME ID in Chrome Extension. | 131 // This IME ID in Chrome Extension. |
| 133 std::string engine_id_; | 132 std::string engine_id_; |
| 134 | 133 |
| 135 // This IME ID in ibus. | 134 // This IME ID in ibus. |
| 136 std::string ibus_id_; | 135 std::string ibus_id_; |
| 137 | 136 |
| 138 // The current object path. | 137 // Flag whether CreateEngineHandler is called or not. |
| 139 dbus::ObjectPath object_path_; | 138 bool is_create_engine_handler_called_; |
|
Seigo Nonaka
2013/11/12 03:37:22
I'm curious about this flag.
Why do we check the
Hiro Komatsu
2013/11/12 05:01:39
I just focused on the deletion of IBusEngineFactor
| |
| 140 | 139 |
| 141 // The current auxialy text and it's visiblity. | 140 // The current auxialy text and it's visiblity. |
| 142 scoped_ptr<IBusText> aux_text_; | 141 scoped_ptr<IBusText> aux_text_; |
| 143 bool aux_text_visible_; | 142 bool aux_text_visible_; |
| 144 | 143 |
| 145 // Pointer to the object recieving events for this IME. | 144 // Pointer to the object recieving events for this IME. |
| 146 InputMethodEngine::Observer* observer_; | 145 InputMethodEngine::Observer* observer_; |
| 147 | 146 |
| 148 // The current preedit text, and it's cursor position. | 147 // The current preedit text, and it's cursor position. |
| 149 scoped_ptr<IBusText> preedit_text_; | 148 scoped_ptr<IBusText> preedit_text_; |
| 150 int preedit_cursor_; | 149 int preedit_cursor_; |
| 151 | 150 |
| 152 // The current candidate window. | 151 // The current candidate window. |
| 153 scoped_ptr<input_method::CandidateWindow> candidate_window_; | 152 scoped_ptr<input_method::CandidateWindow> candidate_window_; |
| 154 | 153 |
| 155 // The current candidate window property. | 154 // The current candidate window property. |
| 156 CandidateWindowProperty candidate_window_property_; | 155 CandidateWindowProperty candidate_window_property_; |
| 157 | 156 |
| 158 // Indicates whether the candidate window is visible. | 157 // Indicates whether the candidate window is visible. |
| 159 bool window_visible_; | 158 bool window_visible_; |
| 160 | 159 |
| 161 // Mapping of candidate index to candidate id. | 160 // Mapping of candidate index to candidate id. |
| 162 std::vector<int> candidate_ids_; | 161 std::vector<int> candidate_ids_; |
| 163 | 162 |
| 164 // Mapping of candidate id to index. | 163 // Mapping of candidate id to index. |
| 165 std::map<int, int> candidate_indexes_; | 164 std::map<int, int> candidate_indexes_; |
| 166 | 165 |
| 167 scoped_ptr<IBusEngineService> ibus_engine_service_; | 166 scoped_ptr<IBusEngineService> ibus_engine_service_; |
| 168 scoped_ptr<IBusEngineFactoryService> ibus_engine_factory_service_; | |
| 169 | 167 |
| 170 // Used for making callbacks. | 168 // Used for making callbacks. |
| 171 base::WeakPtrFactory<InputMethodEngineIBus> weak_ptr_factory_; | 169 base::WeakPtrFactory<InputMethodEngineIBus> weak_ptr_factory_; |
| 172 }; | 170 }; |
| 173 | 171 |
| 174 } // namespace chromeos | 172 } // namespace chromeos |
| 175 | 173 |
| 176 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_IBUS_H_ | 174 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_IBUS_H_ |
| OLD | NEW |