Commit 69a9d28f authored by Alexander Alekseev's avatar Alexander Alekseev Committed by Commit Bot

Fix crash in InputImeEventRouter::RegisterImeExtension

Bug: 1147192,1147526
Test: Resolves reproducible crash on a test device

Change-Id: Ie9dadf1b1165e32c45fa2878ca7cd11be823b384
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2527845Reviewed-by: default avatarShu Chen <shuchen@chromium.org>
Reviewed-by: default avatarJeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Shu Chen <shuchen@chromium.org>
Auto-Submit: Alexander Alekseev <alemate@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826160}
parent 16547ad7
...@@ -586,14 +586,22 @@ bool InputImeEventRouter::RegisterImeExtension( ...@@ -586,14 +586,22 @@ bool InputImeEventRouter::RegisterImeExtension(
} }
Profile* profile = GetProfile(); Profile* profile = GetProfile();
// TODO(https://crbug.com/1140236): Investigate whether profile selection // TODO(https://crbug.com/1140236): Investigate whether profile selection
// is really needed. // is really needed.
if (chromeos::input_method::InputMethodManager::Get() bool is_login = false;
->GetActiveIMEState() // When Chrome starts with the Login screen, sometimes active IME State was
->GetUIStyle() == // not set yet. It's asynchronous process. So we need a fallback for that.
chromeos::input_method::InputMethodManager::UIStyle::kLogin && scoped_refptr<chromeos::input_method::InputMethodManager::State>
profile->HasPrimaryOTRProfile()) { active_state = chromeos::input_method::InputMethodManager::Get()
->GetActiveIMEState();
if (active_state) {
is_login = active_state->GetUIStyle() ==
chromeos::input_method::InputMethodManager::UIStyle::kLogin;
} else {
is_login = chromeos::ProfileHelper::IsSigninProfile(profile);
}
if (is_login && profile->HasPrimaryOTRProfile()) {
profile = profile->GetPrimaryOTRProfile(); profile = profile->GetPrimaryOTRProfile();
} }
......
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