| 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 if (!pending_input_method_.empty()) { | 341 if (!pending_input_method_.empty()) { |
| 342 ChangeInputMethod(pending_input_method_); | 342 ChangeInputMethod(pending_input_method_); |
| 343 pending_input_method_.clear(); | 343 pending_input_method_.clear(); |
| 344 } | 344 } |
| 345 | 345 |
| 346 } | 346 } |
| 347 | 347 |
| 348 void InputMethodManagerImpl::LoadNecessaryComponentExtensions() { | 348 void InputMethodManagerImpl::LoadNecessaryComponentExtensions() { |
| 349 if (!component_extension_ime_manager_->IsInitialized()) | 349 if (!component_extension_ime_manager_->IsInitialized()) |
| 350 return; | 350 return; |
| 351 for (size_t i = 0; i < active_input_method_ids_.size(); ++i) { | 351 // Load component extensions but also update |active_input_method_ids_| as |
| 352 if (component_extension_ime_manager_->IsWhitelisted( | 352 // some component extension IMEs may have been removed from the Chrome OS |
| 353 active_input_method_ids_[i])) { | 353 // image. If specified component extension IME no longer exists, falling back |
| 354 // to an existing IME. |
| 355 std::vector<std::string> unfiltered_input_method_ids = |
| 356 active_input_method_ids_; |
| 357 active_input_method_ids_.clear(); |
| 358 for (size_t i = 0; i < unfiltered_input_method_ids.size(); ++i) { |
| 359 if (!component_extension_ime_manager_->IsComponentExtensionIMEId( |
| 360 unfiltered_input_method_ids[i])) { |
| 361 // Legacy IMEs or xkb layouts are alwayes active. |
| 362 active_input_method_ids_.push_back(unfiltered_input_method_ids[i]); |
| 363 } else if (component_extension_ime_manager_->IsWhitelisted( |
| 364 unfiltered_input_method_ids[i])) { |
| 354 component_extension_ime_manager_->LoadComponentExtensionIME( | 365 component_extension_ime_manager_->LoadComponentExtensionIME( |
| 355 active_input_method_ids_[i]); | 366 unfiltered_input_method_ids[i]); |
| 367 active_input_method_ids_.push_back(unfiltered_input_method_ids[i]); |
| 356 } | 368 } |
| 357 } | 369 } |
| 358 } | 370 } |
| 359 | 371 |
| 360 void InputMethodManagerImpl::ActivateInputMethodProperty( | 372 void InputMethodManagerImpl::ActivateInputMethodProperty( |
| 361 const std::string& key) { | 373 const std::string& key) { |
| 362 DCHECK(!key.empty()); | 374 DCHECK(!key.empty()); |
| 363 ibus_controller_->ActivateInputMethodProperty(key); | 375 ibus_controller_->ActivateInputMethodProperty(key); |
| 364 } | 376 } |
| 365 | 377 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 candidate_window_controller_.reset( | 792 candidate_window_controller_.reset( |
| 781 CandidateWindowController::CreateCandidateWindowController()); | 793 CandidateWindowController::CreateCandidateWindowController()); |
| 782 if (candidate_window_controller_->Init(ibus_controller_.get())) | 794 if (candidate_window_controller_->Init(ibus_controller_.get())) |
| 783 candidate_window_controller_->AddObserver(this); | 795 candidate_window_controller_->AddObserver(this); |
| 784 else | 796 else |
| 785 DVLOG(1) << "Failed to initialize the candidate window controller"; | 797 DVLOG(1) << "Failed to initialize the candidate window controller"; |
| 786 } | 798 } |
| 787 | 799 |
| 788 } // namespace input_method | 800 } // namespace input_method |
| 789 } // namespace chromeos | 801 } // namespace chromeos |
| OLD | NEW |