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

Unified Diff: chrome/browser/ui/ash/ime_controller_chromeos.cc

Issue 1544243002: ash::ImeController should not crash if IME is not initialized yet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/ime_controller_chromeos.cc
diff --git a/chrome/browser/ui/ash/ime_controller_chromeos.cc b/chrome/browser/ui/ash/ime_controller_chromeos.cc
index 07f10196c4586144ea5f7033ef9f78639de25dd5..75b131eadbaf7602cbd56d282969a3e13aa98c3f 100644
--- a/chrome/browser/ui/ash/ime_controller_chromeos.cc
+++ b/chrome/browser/ui/ash/ime_controller_chromeos.cc
@@ -59,8 +59,16 @@ ui::Accelerator ImeController::RemapAccelerator(
bool ImeController::UsingFrenchInputMethod() const {
chromeos::input_method::InputMethodManager* manager =
chromeos::input_method::InputMethodManager::Get();
+ const chromeos::input_method::InputMethodManager::State* state =
+ manager->GetActiveIMEState().get();
+
+ // KeyEvent can come before default user profile is initialized, so IM is
+ // still in global default state "en_US".
+ if (!state)
+ return false;
+
const chromeos::input_method::InputMethodDescriptor& descriptor =
- manager->GetActiveIMEState()->GetCurrentInputMethod();
+ state->GetCurrentInputMethod();
const std::string& layout = descriptor.id();
return (layout == "xkb:fr::fra" || layout == "xkb:be::fra");
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698