Commit 5c7d4b00 authored by Yuichiro Hanada's avatar Yuichiro Hanada Committed by Commit Bot

Initialize the proxy IME engine for ARC IMEs

to prevent crash when enabling ARC IMEs.

Bug: 845079
Change-Id: If927b31d1ebb2d27ba4a50dc33a96ca6b4979a0d
Reviewed-on: https://chromium-review.googlesource.com/1150005Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
Commit-Queue: Yuichiro Hanada <yhanada@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578177}
parent 1f7fc91e
......@@ -78,6 +78,42 @@ class ArcInputMethodManagerServiceFactory
} // namespace
class ArcInputMethodManagerService::ArcProxyInputMethodObserver
: public input_method::InputMethodEngineBase::Observer {
public:
ArcProxyInputMethodObserver() = default;
~ArcProxyInputMethodObserver() override = default;
// input_method::InputMethodEngineBase::Observer overrides:
// TODO(yhanada): Implement below methods to forward those events to ARC.
void OnActivate(const std::string& engine_id) override {}
void OnFocus(
const ui::IMEEngineHandlerInterface::InputContext& context) override {}
void OnBlur(int context_id) override {}
void OnKeyEvent(
const std::string& engine_id,
const input_method::InputMethodEngineBase::KeyboardEvent& event,
ui::IMEEngineHandlerInterface::KeyEventDoneCallback key_data) override {}
void OnReset(const std::string& engine_id) override {}
void OnDeactivated(const std::string& engine_id) override {}
void OnCompositionBoundsChanged(
const std::vector<gfx::Rect>& bounds) override {}
bool IsInterestedInKeyEvent() const override { return false; }
void OnSurroundingTextChanged(const std::string& engine_id,
const std::string& text,
int cursor_pos,
int anchor_pos,
int offset_pos) override {}
void OnInputContextUpdate(
const ui::IMEEngineHandlerInterface::InputContext& context) override {}
void OnCandidateClicked(
const std::string& component_id,
int candidate_id,
input_method::InputMethodEngineBase::MouseButtonEvent button) override {}
void OnMenuItemActivated(const std::string& component_id,
const std::string& menu_id) override {}
};
// static
ArcInputMethodManagerService*
ArcInputMethodManagerService::GetForBrowserContext(
......@@ -106,6 +142,9 @@ ArcInputMethodManagerService::ArcInputMethodManagerService(
auto* imm = chromeos::input_method::InputMethodManager::Get();
imm->AddObserver(this);
imm->AddImeMenuObserver(this);
proxy_ime_engine_->Initialize(std::make_unique<ArcProxyInputMethodObserver>(),
proxy_ime_extension_id_.c_str(), profile_);
}
ArcInputMethodManagerService::~ArcInputMethodManagerService() {
......
......@@ -65,6 +65,8 @@ class ArcInputMethodManagerService
bool show_message) override;
private:
class ArcProxyInputMethodObserver;
void EnableIme(const std::string& ime_id, bool enable);
void SwitchImeTo(const std::string& ime_id);
chromeos::input_method::InputMethodDescriptor BuildInputMethodDescriptor(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment