OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |