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

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

Issue 165783002: Reland of: Split out InputMethodMenuManager from InputMethodManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comment; spelling Created 6 years, 10 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 719aeccd77f3a321013ca39735ff7ac88b30dbcc..b92f7d9b9296b46d224ea62c2e88e67011cd18ca 100644
--- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
+++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
@@ -6,6 +6,8 @@
#include <algorithm> // std::find
+#include "ash/ime/input_method_menu_item.h"
+#include "ash/ime/input_method_menu_manager.h"
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/location.h"
@@ -350,8 +352,11 @@ bool InputMethodManagerImpl::ChangeInputMethodInternal(
// extension IMEs via InputMethodEngine::(Set|Update)MenuItems.
// If the current input method is a keyboard layout, empty
// properties are sufficient.
- const InputMethodPropertyList empty_property_list;
- SetCurrentInputMethodProperties(empty_property_list);
+ const ash::ime::InputMethodMenuItemList empty_menu_item_list;
+ ash::ime::InputMethodMenuManager* input_method_menu_manager =
+ ash::ime::InputMethodMenuManager::GetInstance();
+ input_method_menu_manager->SetCurrentInputMethodMenuItemList(
+ empty_menu_item_list);
const InputMethodDescriptor* descriptor = NULL;
if (extension_ime_util::IsExtensionIME(input_method_id_to_switch)) {
@@ -419,21 +424,20 @@ void InputMethodManagerImpl::LoadNecessaryComponentExtensions() {
}
}
-void InputMethodManagerImpl::ActivateInputMethodProperty(
+void InputMethodManagerImpl::ActivateInputMethodMenuItem(
const std::string& key) {
DCHECK(!key.empty());
- for (size_t i = 0; i < property_list_.size(); ++i) {
- if (property_list_[i].key == key) {
- IMEEngineHandlerInterface* engine =
- IMEBridge::Get()->GetCurrentEngineHandler();
- if (engine)
- engine->PropertyActivate(key);
- return;
- }
+ if (ash::ime::InputMethodMenuManager::GetInstance()->
+ HasInputMethodMenuItemForKey(key)) {
+ IMEEngineHandlerInterface* engine =
+ IMEBridge::Get()->GetCurrentEngineHandler();
+ if (engine)
+ engine->PropertyActivate(key);
+ return;
}
- DVLOG(1) << "ActivateInputMethodProperty: unknown key: " << key;
+ DVLOG(1) << "ActivateInputMethodMenuItem: unknown key: " << key;
}
void InputMethodManagerImpl::AddInputMethodExtension(
@@ -687,21 +691,6 @@ InputMethodDescriptor InputMethodManagerImpl::GetCurrentInputMethod() const {
return current_input_method_;
}
-InputMethodPropertyList
-InputMethodManagerImpl::GetCurrentInputMethodProperties() const {
- // This check is necessary since an IME property (e.g. for Pinyin) might be
- // sent from ibus-daemon AFTER the current input method is switched to XKB.
- if (InputMethodUtil::IsKeyboardLayout(GetCurrentInputMethod().id()))
- return InputMethodPropertyList(); // Empty list.
- return property_list_;
-}
-
-void InputMethodManagerImpl::SetCurrentInputMethodProperties(
- const InputMethodPropertyList& property_list) {
- property_list_ = property_list;
- PropertyChanged();
-}
-
XKeyboard* InputMethodManagerImpl::GetXKeyboard() {
return xkeyboard_.get();
}
@@ -757,12 +746,6 @@ void InputMethodManagerImpl::InitializeComponentExtensionForTesting(
OnComponentExtensionInitialized(delegate.Pass());
}
-void InputMethodManagerImpl::PropertyChanged() {
- FOR_EACH_OBSERVER(InputMethodManager::Observer,
- observers_,
- InputMethodPropertyChanged(this));
-}
-
void InputMethodManagerImpl::CandidateClicked(int index) {
IMEEngineHandlerInterface* engine =
IMEBridge::Get()->GetCurrentEngineHandler();

Powered by Google App Engine
This is Rietveld 408576698