OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/ash/ime_controller_chromeos.h" |
| 6 |
| 7 #include "ui/base/accelerators/accelerator.h" |
| 8 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 9 |
| 10 bool ImeController::CanCycleIme() { |
| 11 chromeos::input_method::InputMethodManager* manager = |
| 12 chromeos::input_method::InputMethodManager::Get(); |
| 13 DCHECK(manager); |
| 14 if (!manager->GetActiveIMEState()) { |
| 15 LOG(WARNING) << "Cannot cycle through input methods as they are not " |
| 16 "initialized yet."; |
| 17 return false; |
| 18 } |
| 19 return manager->GetActiveIMEState()->CanCycleInputMethod(); |
| 20 } |
| 21 |
| 22 void ImeController::HandleNextIme() { |
| 23 chromeos::input_method::InputMethodManager* manager = |
| 24 chromeos::input_method::InputMethodManager::Get(); |
| 25 manager->GetActiveIMEState()->SwitchToNextInputMethod(); |
| 26 } |
| 27 |
| 28 void ImeController::HandlePreviousIme() { |
| 29 chromeos::input_method::InputMethodManager* manager = |
| 30 chromeos::input_method::InputMethodManager::Get(); |
| 31 manager->GetActiveIMEState()->SwitchToPreviousInputMethod(); |
| 32 } |
| 33 |
| 34 bool ImeController::CanSwitchIme(const ui::Accelerator& accelerator) { |
| 35 chromeos::input_method::InputMethodManager* manager = |
| 36 chromeos::input_method::InputMethodManager::Get(); |
| 37 DCHECK(manager); |
| 38 if (!manager->GetActiveIMEState()) { |
| 39 LOG(WARNING) << "Cannot switch input methods as they are not " |
| 40 "initialized yet."; |
| 41 return false; |
| 42 } |
| 43 return manager->GetActiveIMEState()->CanSwitchInputMethod(accelerator); |
| 44 } |
| 45 |
| 46 void ImeController::HandleSwitchIme(const ui::Accelerator& accelerator) { |
| 47 chromeos::input_method::InputMethodManager* manager = |
| 48 chromeos::input_method::InputMethodManager::Get(); |
| 49 manager->GetActiveIMEState()->SwitchInputMethod(accelerator); |
| 50 } |
OLD | NEW |