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

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

Issue 119133003: Make InputMethodEngine manage its descriptor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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_engine.cc
diff --git a/chrome/browser/chromeos/input_method/input_method_engine.cc b/chrome/browser/chromeos/input_method/input_method_engine.cc
index 9751fa22feccc256d3e92c082f73e53dee860b82..673a1ae8b90f55c612cc633ddcfbc89c0a2820af 100644
--- a/chrome/browser/chromeos/input_method/input_method_engine.cc
+++ b/chrome/browser/chromeos/input_method/input_method_engine.cc
@@ -65,7 +65,7 @@ InputMethodEngine::InputMethodEngine()
window_visible_(false) {}
InputMethodEngine::~InputMethodEngine() {
- input_method::InputMethodManager::Get()->RemoveInputMethodExtension(ibus_id_);
+ input_method::InputMethodManager::Get()->RemoveInputMethodExtension(imm_id_);
}
void InputMethodEngine::Initialize(
@@ -79,31 +79,45 @@ void InputMethodEngine::Initialize(
const GURL& input_view) {
DCHECK(observer) << "Observer must not be null.";
+ // TODO(komatsu): It is probably better to set observer out of Initialize.
observer_ = observer;
engine_id_ = engine_id;
input_method::InputMethodManager* manager =
input_method::InputMethodManager::Get();
- ComponentExtensionIMEManager* comp_ext_ime_manager
- = manager->GetComponentExtensionIMEManager();
+ ComponentExtensionIMEManager* comp_ext_ime_manager =
+ manager->GetComponentExtensionIMEManager();
if (comp_ext_ime_manager->IsInitialized() &&
comp_ext_ime_manager->IsWhitelistedExtension(extension_id)) {
- ibus_id_ = comp_ext_ime_manager->GetId(extension_id, engine_id);
+ imm_id_ = comp_ext_ime_manager->GetId(extension_id, engine_id);
} else {
- ibus_id_ = extension_ime_util::GetInputMethodID(extension_id, engine_id);
+ imm_id_ = extension_ime_util::GetInputMethodID(extension_id, engine_id);
}
input_view_url_ = input_view;
+ descriptor_ = input_method::InputMethodDescriptor(imm_id_,
+ engine_name,
+ layouts,
+ languages,
+ false, // is_login_keyboard
+ options_page,
+ input_view);
+
+ // TODO(komatsu): It is probably better to call AddInputMethodExtension
+ // out of Initialize.
+ manager->AddInputMethodExtension(imm_id_, this);
+}
- manager->AddInputMethodExtension(ibus_id_, engine_name, layouts, languages,
- options_page, input_view, this);
+const input_method::InputMethodDescriptor& InputMethodEngine::GetDescriptor()
+ const {
+ return descriptor_;
}
void InputMethodEngine::StartIme() {
input_method::InputMethodManager* manager =
input_method::InputMethodManager::Get();
- if (manager && ibus_id_ == manager->GetCurrentInputMethod().id())
+ if (manager && imm_id_ == manager->GetCurrentInputMethod().id())
Enable();
}

Powered by Google App Engine
This is Rietveld 408576698