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

Unified Diff: chrome/browser/chromeos/input_method/input_method_manager_impl.cc

Issue 190033005: [IME] Removes the duplicated IMEs in chrome://settings/languages, and support async component IMEs … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: try to make test green. Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/input_method/input_method_manager_impl.cc
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
index 8d3fcc6432298ac6891096bb75786889698fc9c8..4a8912e0ac55e03febd05a3d24c8b3bd7738d633 100644
--- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
+++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
@@ -112,7 +112,11 @@ void InputMethodManagerImpl::SetState(State new_state) {
scoped_ptr<InputMethodDescriptors>
InputMethodManagerImpl::GetSupportedInputMethods() const {
- return whitelist_.GetSupportedInputMethods();
+ scoped_ptr<InputMethodDescriptors> whitelist_imes =
+ whitelist_.GetSupportedInputMethods();
+ if (!extension_ime_util::UseWrappedExtensionKeyboardLayouts())
+ return whitelist_imes.Pass();
+ return scoped_ptr<InputMethodDescriptors>(new InputMethodDescriptors).Pass();
}
scoped_ptr<InputMethodDescriptors>
@@ -246,17 +250,12 @@ bool InputMethodManagerImpl::EnableInputMethodImpl(
// Starts or stops the system input method framework as needed.
void InputMethodManagerImpl::ReconfigureIMFramework() {
- if (component_extension_ime_manager_->IsInitialized())
- LoadNecessaryComponentExtensions();
-
- const bool need_engine =
- !ContainsOnlyKeyboardLayout(active_input_method_ids_);
+ LoadNecessaryComponentExtensions();
// Initialize candidate window controller and widgets such as
// candidate window, infolist and mode indicator. Note, mode
// indicator is used by only keyboard layout input methods.
- if (need_engine || active_input_method_ids_.size() > 1)
- MaybeInitializeCandidateWindowController();
+ MaybeInitializeCandidateWindowController();
}
bool InputMethodManagerImpl::EnableInputMethod(
@@ -352,7 +351,9 @@ bool InputMethodManagerImpl::ChangeInputMethodInternal(
engine->Disable();
// Configure the next engine handler.
- if (InputMethodUtil::IsKeyboardLayout(input_method_id_to_switch)) {
+ if (InputMethodUtil::IsKeyboardLayout(input_method_id_to_switch) &&
+ !extension_ime_util::IsKeyboardLayoutExtension(
+ input_method_id_to_switch)) {
IMEBridge::Get()->SetCurrentEngineHandler(NULL);
} else {
IMEEngineHandlerInterface* next_engine =
@@ -425,9 +426,8 @@ void InputMethodManagerImpl::LoadNecessaryComponentExtensions() {
// some component extension IMEs may have been removed from the Chrome OS
// image. If specified component extension IME no longer exists, falling back
// to an existing IME.
- std::vector<std::string> unfiltered_input_method_ids =
- active_input_method_ids_;
- active_input_method_ids_.clear();
+ std::vector<std::string> unfiltered_input_method_ids;
+ unfiltered_input_method_ids.swap(active_input_method_ids_);
for (size_t i = 0; i < unfiltered_input_method_ids.size(); ++i) {
if (!extension_ime_util::IsComponentExtensionIME(
unfiltered_input_method_ids[i])) {
@@ -440,6 +440,8 @@ void InputMethodManagerImpl::LoadNecessaryComponentExtensions() {
active_input_method_ids_.push_back(unfiltered_input_method_ids[i]);
}
}
+ // TODO(shuchen): move this call in ComponentExtensionIMEManager.
+ component_extension_ime_manager_->NotifyInitialized();
}
void InputMethodManagerImpl::ActivateInputMethodMenuItem(
@@ -835,15 +837,6 @@ bool InputMethodManagerImpl::InputMethodIsActivated(
return Contains(active_input_method_ids_, input_method_id);
}
-bool InputMethodManagerImpl::ContainsOnlyKeyboardLayout(
- const std::vector<std::string>& value) {
- for (size_t i = 0; i < value.size(); ++i) {
- if (!InputMethodUtil::IsKeyboardLayout(value[i]))
- return false;
- }
- return true;
-}
-
void InputMethodManagerImpl::MaybeInitializeCandidateWindowController() {
if (candidate_window_controller_.get())
return;

Powered by Google App Engine
This is Rietveld 408576698