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

Side by Side 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 4 years, 12 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/ash/ime_controller_chromeos.h" 5 #include "chrome/browser/ui/ash/ime_controller_chromeos.h"
6 6
7 #include "ui/base/accelerators/accelerator.h" 7 #include "ui/base/accelerators/accelerator.h"
8 #include "ui/base/ime/chromeos/input_method_manager.h" 8 #include "ui/base/ime/chromeos/input_method_manager.h"
9 9
10 bool ImeController::CanCycleIme() { 10 bool ImeController::CanCycleIme() {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 ui::Accelerator remapped_accelerator(key, remapped_modifiers); 53 ui::Accelerator remapped_accelerator(key, remapped_modifiers);
54 remapped_accelerator.set_type(accelerator.type()); 54 remapped_accelerator.set_type(accelerator.type());
55 remapped_accelerator.set_is_repeat(accelerator.IsRepeat()); 55 remapped_accelerator.set_is_repeat(accelerator.IsRepeat());
56 return remapped_accelerator; 56 return remapped_accelerator;
57 } 57 }
58 58
59 bool ImeController::UsingFrenchInputMethod() const { 59 bool ImeController::UsingFrenchInputMethod() const {
60 chromeos::input_method::InputMethodManager* manager = 60 chromeos::input_method::InputMethodManager* manager =
61 chromeos::input_method::InputMethodManager::Get(); 61 chromeos::input_method::InputMethodManager::Get();
62 const chromeos::input_method::InputMethodManager::State* state =
63 manager->GetActiveIMEState().get();
64
65 // KeyEvent can come before default user profile is initialized, so IM is
66 // still in global default state "en_US".
67 if (!state)
68 return false;
69
62 const chromeos::input_method::InputMethodDescriptor& descriptor = 70 const chromeos::input_method::InputMethodDescriptor& descriptor =
63 manager->GetActiveIMEState()->GetCurrentInputMethod(); 71 state->GetCurrentInputMethod();
64 const std::string& layout = descriptor.id(); 72 const std::string& layout = descriptor.id();
65 return (layout == "xkb:fr::fra" || layout == "xkb:be::fra"); 73 return (layout == "xkb:fr::fra" || layout == "xkb:be::fra");
66 } 74 }
OLDNEW
« 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