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 <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
438 | 438 |
439 void InputMethodManagerImpl::StateImpl::AddInputMethodExtension( | 439 void InputMethodManagerImpl::StateImpl::AddInputMethodExtension( |
440 const std::string& extension_id, | 440 const std::string& extension_id, |
441 const InputMethodDescriptors& descriptors, | 441 const InputMethodDescriptors& descriptors, |
442 InputMethodEngineInterface* engine) { | 442 InputMethodEngineInterface* engine) { |
443 if (manager_->ui_session_ == STATE_TERMINATING) | 443 if (manager_->ui_session_ == STATE_TERMINATING) |
444 return; | 444 return; |
445 | 445 |
446 DCHECK(engine); | 446 DCHECK(engine); |
447 | 447 |
448 manager_->engine_map_[extension_id] = engine; | 448 manager_->engine_map_[profile][extension_id] = engine; |
449 | 449 |
450 bool contain = false; | 450 bool contain = false; |
451 for (size_t i = 0; i < descriptors.size(); i++) { | 451 for (size_t i = 0; i < descriptors.size(); i++) { |
452 const InputMethodDescriptor& descriptor = descriptors[i]; | 452 const InputMethodDescriptor& descriptor = descriptors[i]; |
453 const std::string& id = descriptor.id(); | 453 const std::string& id = descriptor.id(); |
454 extra_input_methods[id] = descriptor; | 454 extra_input_methods[id] = descriptor; |
455 if (Contains(enabled_extension_imes, id)) { | 455 if (Contains(enabled_extension_imes, id)) { |
456 if (!Contains(active_input_method_ids, id)) { | 456 if (!Contains(active_input_method_ids, id)) { |
457 active_input_method_ids.push_back(id); | 457 active_input_method_ids.push_back(id); |
458 } else { | 458 } else { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
495 i != extra_input_methods.end(); | 495 i != extra_input_methods.end(); |
496 ++i) { | 496 ++i) { |
497 if (extension_id != | 497 if (extension_id != |
498 extension_ime_util::GetExtensionIDFromInputMethodID(i->first)) | 498 extension_ime_util::GetExtensionIDFromInputMethodID(i->first)) |
499 new_extra_input_methods[i->first] = i->second; | 499 new_extra_input_methods[i->first] = i->second; |
500 } | 500 } |
501 extra_input_methods.swap(new_extra_input_methods); | 501 extra_input_methods.swap(new_extra_input_methods); |
502 | 502 |
503 if (IsActive()) { | 503 if (IsActive()) { |
504 if (IMEBridge::Get()->GetCurrentEngineHandler() == | 504 if (IMEBridge::Get()->GetCurrentEngineHandler() == |
505 manager_->engine_map_[extension_id]) { | 505 manager_->engine_map_[profile][extension_id]) { |
506 IMEBridge::Get()->SetCurrentEngineHandler(NULL); | 506 IMEBridge::Get()->SetCurrentEngineHandler(NULL); |
507 } | 507 } |
508 manager_->engine_map_.erase(extension_id); | 508 manager_->engine_map_[profile].erase(extension_id); |
509 } | 509 } |
510 | 510 |
511 // If |current_input_method| is no longer in |active_input_method_ids|, | 511 // If |current_input_method| is no longer in |active_input_method_ids|, |
512 // switch to the first one in |active_input_method_ids|. | 512 // switch to the first one in |active_input_method_ids|. |
513 ChangeInputMethod(current_input_method.id(), false); | 513 ChangeInputMethod(current_input_method.id(), false); |
514 } | 514 } |
515 | 515 |
516 void InputMethodManagerImpl::StateImpl::GetInputMethodExtensions( | 516 void InputMethodManagerImpl::StateImpl::GetInputMethodExtensions( |
517 InputMethodDescriptors* result) { | 517 InputMethodDescriptors* result) { |
518 // Build the extension input method descriptors from the extra input | 518 // Build the extension input method descriptors from the extra input |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1002 if (engine) | 1002 if (engine) |
1003 engine->Disable(); | 1003 engine->Disable(); |
1004 | 1004 |
1005 // Configure the next engine handler. | 1005 // Configure the next engine handler. |
1006 // This must be after |current_input_method| has been set to new input | 1006 // This must be after |current_input_method| has been set to new input |
1007 // method, because engine's Enable() method needs to access it. | 1007 // method, because engine's Enable() method needs to access it. |
1008 const std::string& extension_id = | 1008 const std::string& extension_id = |
1009 extension_ime_util::GetExtensionIDFromInputMethodID(descriptor.id()); | 1009 extension_ime_util::GetExtensionIDFromInputMethodID(descriptor.id()); |
1010 const std::string& component_id = | 1010 const std::string& component_id = |
1011 extension_ime_util::GetComponentIDByInputMethodID(descriptor.id()); | 1011 extension_ime_util::GetComponentIDByInputMethodID(descriptor.id()); |
1012 engine = engine_map_[extension_id]; | 1012 engine = engine_map_[ProfileManager::GetActiveUserProfile()][extension_id]; |
Shu Chen
2015/05/08 07:56:48
After cl https://codereview.chromium.org/105586300
| |
1013 | 1013 |
1014 IMEBridge::Get()->SetCurrentEngineHandler(engine); | 1014 IMEBridge::Get()->SetCurrentEngineHandler(engine); |
1015 | 1015 |
1016 if (engine) { | 1016 if (engine) { |
1017 engine->Enable(component_id); | 1017 engine->Enable(component_id); |
1018 } else { | 1018 } else { |
1019 // If no engine to enable, cancel the virtual keyboard url override so that | 1019 // If no engine to enable, cancel the virtual keyboard url override so that |
1020 // it can use the fallback system virtual keyboard UI. | 1020 // it can use the fallback system virtual keyboard UI. |
1021 keyboard::SetOverrideContentUrl(GURL()); | 1021 keyboard::SetOverrideContentUrl(GURL()); |
1022 keyboard::KeyboardController* keyboard_controller = | 1022 keyboard::KeyboardController* keyboard_controller = |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1162 if (candidate_window_controller_.get()) | 1162 if (candidate_window_controller_.get()) |
1163 return; | 1163 return; |
1164 | 1164 |
1165 candidate_window_controller_.reset( | 1165 candidate_window_controller_.reset( |
1166 CandidateWindowController::CreateCandidateWindowController()); | 1166 CandidateWindowController::CreateCandidateWindowController()); |
1167 candidate_window_controller_->AddObserver(this); | 1167 candidate_window_controller_->AddObserver(this); |
1168 } | 1168 } |
1169 | 1169 |
1170 } // namespace input_method | 1170 } // namespace input_method |
1171 } // namespace chromeos | 1171 } // namespace chromeos |
OLD | NEW |