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 #include "chrome/browser/chromeos/input_method/input_method_engine_ibus.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_engine_ibus.h" |
6 | 6 |
7 #define XK_MISCELLANY | 7 #define XK_MISCELLANY |
8 #include <X11/keysymdef.h> | 8 #include <X11/keysymdef.h> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 component_->mutable_engine_description()->push_back(engine_desc); | 112 component_->mutable_engine_description()->push_back(engine_desc); |
113 manager->AddInputMethodExtension(ibus_id_, engine_name, layouts, language, | 113 manager->AddInputMethodExtension(ibus_id_, engine_name, layouts, language, |
114 options_page, this); | 114 options_page, this); |
115 // If connection is avaiable, register component. If there are no connection | 115 // If connection is avaiable, register component. If there are no connection |
116 // to ibus-daemon, OnConnected callback will register component instead. | 116 // to ibus-daemon, OnConnected callback will register component instead. |
117 if (IsConnected()) | 117 if (IsConnected()) |
118 RegisterComponent(); | 118 RegisterComponent(); |
119 } | 119 } |
120 | 120 |
| 121 void InputMethodEngineIBus::StartIme() { |
| 122 input_method::InputMethodManager* manager = |
| 123 input_method::InputMethodManager::Get(); |
| 124 if (manager && ibus_id_ == manager->GetCurrentInputMethod().id()) |
| 125 Enable(); |
| 126 } |
| 127 |
121 bool InputMethodEngineIBus::SetComposition( | 128 bool InputMethodEngineIBus::SetComposition( |
122 int context_id, | 129 int context_id, |
123 const char* text, | 130 const char* text, |
124 int selection_start, | 131 int selection_start, |
125 int selection_end, | 132 int selection_end, |
126 int cursor, | 133 int cursor, |
127 const std::vector<SegmentInfo>& segments, | 134 const std::vector<SegmentInfo>& segments, |
128 std::string* error) { | 135 std::string* error) { |
129 if (!active_) { | 136 if (!active_) { |
130 *error = kErrorNotActive; | 137 *error = kErrorNotActive; |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 DBusThreadManager::Get()->RemoveIBusEngineService(object_path_); | 636 DBusThreadManager::Get()->RemoveIBusEngineService(object_path_); |
630 | 637 |
631 object_path_ = DBusThreadManager::Get()->GetIBusEngineFactoryService()-> | 638 object_path_ = DBusThreadManager::Get()->GetIBusEngineFactoryService()-> |
632 GenerateUniqueObjectPath(); | 639 GenerateUniqueObjectPath(); |
633 | 640 |
634 GetCurrentService()->SetEngine(this); | 641 GetCurrentService()->SetEngine(this); |
635 sender.Run(object_path_); | 642 sender.Run(object_path_); |
636 } | 643 } |
637 | 644 |
638 } // namespace chromeos | 645 } // namespace chromeos |
OLD | NEW |