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_manager_impl.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h" |
6 | 6 |
7 #include <algorithm> // std::find | 7 #include <algorithm> // std::find |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 new_active_input_method_ids.push_back(input_method_id); | 208 new_active_input_method_ids.push_back(input_method_id); |
209 | 209 |
210 return true; | 210 return true; |
211 } | 211 } |
212 | 212 |
213 // Starts or stops the system input method framework as needed. | 213 // Starts or stops the system input method framework as needed. |
214 void InputMethodManagerImpl::ReconfigureIMFramework() { | 214 void InputMethodManagerImpl::ReconfigureIMFramework() { |
215 if (component_extension_ime_manager_->IsInitialized()) | 215 if (component_extension_ime_manager_->IsInitialized()) |
216 LoadNecessaryComponentExtensions(); | 216 LoadNecessaryComponentExtensions(); |
217 | 217 |
218 if (ContainsOnlyKeyboardLayout(active_input_method_ids_)) { | 218 const bool need_engine = |
219 // Do NOT call ibus_controller_->Stop(); here to work around a crash issue | 219 !ContainsOnlyKeyboardLayout(active_input_method_ids_); |
220 // at crbug.com/27051. | 220 |
221 // TODO(yusukes): We can safely call Stop(); here once crbug.com/26443 | 221 // Initialize candidate window controller and widgets such as |
222 // is implemented. | 222 // candidate window, infolist and mode indicator. Note, mode |
223 } else { | 223 // indicator is used by only keyboard layout input methods. |
| 224 if (need_engine || active_input_method_ids_.size() > 1) |
224 MaybeInitializeCandidateWindowController(); | 225 MaybeInitializeCandidateWindowController(); |
| 226 |
| 227 if (need_engine) |
225 IBusDaemonController::GetInstance()->Start(); | 228 IBusDaemonController::GetInstance()->Start(); |
226 } | |
227 } | 229 } |
228 | 230 |
229 bool InputMethodManagerImpl::EnableInputMethod( | 231 bool InputMethodManagerImpl::EnableInputMethod( |
230 const std::string& input_method_id) { | 232 const std::string& input_method_id) { |
231 if (!EnableInputMethodImpl(input_method_id, active_input_method_ids_)) | 233 if (!EnableInputMethodImpl(input_method_id, active_input_method_ids_)) |
232 return false; | 234 return false; |
233 | 235 |
234 ReconfigureIMFramework(); | 236 ReconfigureIMFramework(); |
235 return true; | 237 return true; |
236 } | 238 } |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 else | 864 else |
863 DVLOG(1) << "Failed to initialize the candidate window controller"; | 865 DVLOG(1) << "Failed to initialize the candidate window controller"; |
864 } | 866 } |
865 | 867 |
866 bool InputMethodManagerImpl::IsIBusConnectionAlive() { | 868 bool InputMethodManagerImpl::IsIBusConnectionAlive() { |
867 return DBusThreadManager::Get() && DBusThreadManager::Get()->GetIBusClient(); | 869 return DBusThreadManager::Get() && DBusThreadManager::Get()->GetIBusClient(); |
868 } | 870 } |
869 | 871 |
870 } // namespace input_method | 872 } // namespace input_method |
871 } // namespace chromeos | 873 } // namespace chromeos |
OLD | NEW |