Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_manager_impl.cc

Issue 1136463005: Supports multiple profile in Chrome OS IMF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 void InputMethodManagerImpl::StateImpl::AddInputMethodExtension( 440 void InputMethodManagerImpl::StateImpl::AddInputMethodExtension(
441 const std::string& extension_id, 441 const std::string& extension_id,
442 const InputMethodDescriptors& descriptors, 442 const InputMethodDescriptors& descriptors,
443 InputMethodEngineInterface* engine) { 443 InputMethodEngineInterface* engine) {
444 if (manager_->ui_session_ == STATE_TERMINATING) 444 if (manager_->ui_session_ == STATE_TERMINATING)
445 return; 445 return;
446 446
447 DCHECK(engine); 447 DCHECK(engine);
448 448
449 manager_->engine_map_[extension_id] = engine; 449 manager_->engine_map_[profile][extension_id] = engine;
450 450
451 bool contain = false; 451 bool contain = false;
452 for (size_t i = 0; i < descriptors.size(); i++) { 452 for (size_t i = 0; i < descriptors.size(); i++) {
453 const InputMethodDescriptor& descriptor = descriptors[i]; 453 const InputMethodDescriptor& descriptor = descriptors[i];
454 const std::string& id = descriptor.id(); 454 const std::string& id = descriptor.id();
455 extra_input_methods[id] = descriptor; 455 extra_input_methods[id] = descriptor;
456 if (Contains(enabled_extension_imes, id)) { 456 if (Contains(enabled_extension_imes, id)) {
457 if (!Contains(active_input_method_ids, id)) { 457 if (!Contains(active_input_method_ids, id)) {
458 active_input_method_ids.push_back(id); 458 active_input_method_ids.push_back(id);
459 } else { 459 } else {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 i != extra_input_methods.end(); 496 i != extra_input_methods.end();
497 ++i) { 497 ++i) {
498 if (extension_id != 498 if (extension_id !=
499 extension_ime_util::GetExtensionIDFromInputMethodID(i->first)) 499 extension_ime_util::GetExtensionIDFromInputMethodID(i->first))
500 new_extra_input_methods[i->first] = i->second; 500 new_extra_input_methods[i->first] = i->second;
501 } 501 }
502 extra_input_methods.swap(new_extra_input_methods); 502 extra_input_methods.swap(new_extra_input_methods);
503 503
504 if (IsActive()) { 504 if (IsActive()) {
505 if (IMEBridge::Get()->GetCurrentEngineHandler() == 505 if (IMEBridge::Get()->GetCurrentEngineHandler() ==
506 manager_->engine_map_[extension_id]) { 506 manager_->engine_map_[profile][extension_id]) {
507 IMEBridge::Get()->SetCurrentEngineHandler(NULL); 507 IMEBridge::Get()->SetCurrentEngineHandler(NULL);
508 } 508 }
509 manager_->engine_map_.erase(extension_id); 509 manager_->engine_map_[profile].erase(extension_id);
510 } 510 }
511 511
512 // If |current_input_method| is no longer in |active_input_method_ids|, 512 // If |current_input_method| is no longer in |active_input_method_ids|,
513 // switch to the first one in |active_input_method_ids|. 513 // switch to the first one in |active_input_method_ids|.
514 ChangeInputMethod(current_input_method.id(), false); 514 ChangeInputMethod(current_input_method.id(), false);
515 } 515 }
516 516
517 void InputMethodManagerImpl::StateImpl::GetInputMethodExtensions( 517 void InputMethodManagerImpl::StateImpl::GetInputMethodExtensions(
518 InputMethodDescriptors* result) { 518 InputMethodDescriptors* result) {
519 // Build the extension input method descriptors from the extra input 519 // Build the extension input method descriptors from the extra input
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 if (engine) 1003 if (engine)
1004 engine->Disable(); 1004 engine->Disable();
1005 1005
1006 // Configure the next engine handler. 1006 // Configure the next engine handler.
1007 // This must be after |current_input_method| has been set to new input 1007 // This must be after |current_input_method| has been set to new input
1008 // method, because engine's Enable() method needs to access it. 1008 // method, because engine's Enable() method needs to access it.
1009 const std::string& extension_id = 1009 const std::string& extension_id =
1010 extension_ime_util::GetExtensionIDFromInputMethodID(descriptor.id()); 1010 extension_ime_util::GetExtensionIDFromInputMethodID(descriptor.id());
1011 const std::string& component_id = 1011 const std::string& component_id =
1012 extension_ime_util::GetComponentIDByInputMethodID(descriptor.id()); 1012 extension_ime_util::GetComponentIDByInputMethodID(descriptor.id());
1013 engine = engine_map_[extension_id]; 1013 engine = engine_map_[profile][extension_id];
1014 1014
1015 IMEBridge::Get()->SetCurrentEngineHandler(engine); 1015 IMEBridge::Get()->SetCurrentEngineHandler(engine);
1016 1016
1017 if (engine) { 1017 if (engine) {
1018 engine->Enable(component_id); 1018 engine->Enable(component_id);
1019 } else { 1019 } else {
1020 // If no engine to enable, cancel the virtual keyboard url override so that 1020 // If no engine to enable, cancel the virtual keyboard url override so that
1021 // it can use the fallback system virtual keyboard UI. 1021 // it can use the fallback system virtual keyboard UI.
1022 keyboard::SetOverrideContentUrl(GURL()); 1022 keyboard::SetOverrideContentUrl(GURL());
1023 keyboard::KeyboardController* keyboard_controller = 1023 keyboard::KeyboardController* keyboard_controller =
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698