| 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 "ash/ime/input_method_menu_item.h" | 9 #include "ash/ime/input_method_menu_item.h" |
| 10 #include "ash/ime/input_method_menu_manager.h" | 10 #include "ash/ime/input_method_menu_manager.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 const std::string& layout) const { | 50 const std::string& layout) const { |
| 51 return util_.IsLoginKeyboard(layout); | 51 return util_.IsLoginKeyboard(layout); |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool InputMethodManagerImpl::MigrateInputMethods( | 54 bool InputMethodManagerImpl::MigrateInputMethods( |
| 55 std::vector<std::string>* input_method_ids) { | 55 std::vector<std::string>* input_method_ids) { |
| 56 return util_.MigrateInputMethods(input_method_ids); | 56 return util_.MigrateInputMethods(input_method_ids); |
| 57 } | 57 } |
| 58 | 58 |
| 59 InputMethodManagerImpl::InputMethodManagerImpl( | 59 InputMethodManagerImpl::InputMethodManagerImpl( |
| 60 scoped_ptr<InputMethodDelegate> delegate) | 60 scoped_ptr<InputMethodDelegate> delegate, bool enable_extension_loading) |
| 61 : delegate_(delegate.Pass()), | 61 : delegate_(delegate.Pass()), |
| 62 state_(STATE_LOGIN_SCREEN), | 62 state_(STATE_LOGIN_SCREEN), |
| 63 util_(delegate_.get()), | 63 util_(delegate_.get()), |
| 64 component_extension_ime_manager_(new ComponentExtensionIMEManager()) { | 64 component_extension_ime_manager_(new ComponentExtensionIMEManager()), |
| 65 enable_extension_loading_(enable_extension_loading) { |
| 65 if (base::SysInfo::IsRunningOnChromeOS()) | 66 if (base::SysInfo::IsRunningOnChromeOS()) |
| 66 keyboard_.reset(ImeKeyboard::Create()); | 67 keyboard_.reset(ImeKeyboard::Create()); |
| 67 else | 68 else |
| 68 keyboard_.reset(new FakeImeKeyboard()); | 69 keyboard_.reset(new FakeImeKeyboard()); |
| 69 } | 70 } |
| 70 | 71 |
| 71 InputMethodManagerImpl::~InputMethodManagerImpl() { | 72 InputMethodManagerImpl::~InputMethodManagerImpl() { |
| 72 if (candidate_window_controller_.get()) | 73 if (candidate_window_controller_.get()) |
| 73 candidate_window_controller_->RemoveObserver(this); | 74 candidate_window_controller_->RemoveObserver(this); |
| 74 } | 75 } |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 // to an existing IME. | 413 // to an existing IME. |
| 413 std::vector<std::string> unfiltered_input_method_ids; | 414 std::vector<std::string> unfiltered_input_method_ids; |
| 414 unfiltered_input_method_ids.swap(active_input_method_ids_); | 415 unfiltered_input_method_ids.swap(active_input_method_ids_); |
| 415 for (size_t i = 0; i < unfiltered_input_method_ids.size(); ++i) { | 416 for (size_t i = 0; i < unfiltered_input_method_ids.size(); ++i) { |
| 416 if (!extension_ime_util::IsComponentExtensionIME( | 417 if (!extension_ime_util::IsComponentExtensionIME( |
| 417 unfiltered_input_method_ids[i])) { | 418 unfiltered_input_method_ids[i])) { |
| 418 // Legacy IMEs or xkb layouts are alwayes active. | 419 // Legacy IMEs or xkb layouts are alwayes active. |
| 419 active_input_method_ids_.push_back(unfiltered_input_method_ids[i]); | 420 active_input_method_ids_.push_back(unfiltered_input_method_ids[i]); |
| 420 } else if (component_extension_ime_manager_->IsWhitelisted( | 421 } else if (component_extension_ime_manager_->IsWhitelisted( |
| 421 unfiltered_input_method_ids[i])) { | 422 unfiltered_input_method_ids[i])) { |
| 422 component_extension_ime_manager_->LoadComponentExtensionIME( | 423 if (enable_extension_loading_) |
| 423 unfiltered_input_method_ids[i]); | 424 component_extension_ime_manager_->LoadComponentExtensionIME( |
| 425 unfiltered_input_method_ids[i]); |
| 424 active_input_method_ids_.push_back(unfiltered_input_method_ids[i]); | 426 active_input_method_ids_.push_back(unfiltered_input_method_ids[i]); |
| 425 } | 427 } |
| 426 } | 428 } |
| 427 } | 429 } |
| 428 | 430 |
| 429 void InputMethodManagerImpl::ActivateInputMethodMenuItem( | 431 void InputMethodManagerImpl::ActivateInputMethodMenuItem( |
| 430 const std::string& key) { | 432 const std::string& key) { |
| 431 DCHECK(!key.empty()); | 433 DCHECK(!key.empty()); |
| 432 | 434 |
| 433 if (ash::ime::InputMethodMenuManager::GetInstance()-> | 435 if (ash::ime::InputMethodMenuManager::GetInstance()-> |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 if (candidate_window_controller_.get()) | 895 if (candidate_window_controller_.get()) |
| 894 return; | 896 return; |
| 895 | 897 |
| 896 candidate_window_controller_.reset( | 898 candidate_window_controller_.reset( |
| 897 CandidateWindowController::CreateCandidateWindowController()); | 899 CandidateWindowController::CreateCandidateWindowController()); |
| 898 candidate_window_controller_->AddObserver(this); | 900 candidate_window_controller_->AddObserver(this); |
| 899 } | 901 } |
| 900 | 902 |
| 901 } // namespace input_method | 903 } // namespace input_method |
| 902 } // namespace chromeos | 904 } // namespace chromeos |
| OLD | NEW |