| 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() { |
| 11 chromeos::input_method::InputMethodManager* manager = | 11 chromeos::input_method::InputMethodManager* manager = |
| 12 chromeos::input_method::InputMethodManager::Get(); | 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 } |
| 13 return manager->GetActiveIMEState()->CanCycleInputMethod(); | 19 return manager->GetActiveIMEState()->CanCycleInputMethod(); |
| 14 } | 20 } |
| 15 | 21 |
| 16 void ImeController::HandleNextIme() { | 22 void ImeController::HandleNextIme() { |
| 17 chromeos::input_method::InputMethodManager* manager = | 23 chromeos::input_method::InputMethodManager* manager = |
| 18 chromeos::input_method::InputMethodManager::Get(); | 24 chromeos::input_method::InputMethodManager::Get(); |
| 19 manager->GetActiveIMEState()->SwitchToNextInputMethod(); | 25 manager->GetActiveIMEState()->SwitchToNextInputMethod(); |
| 20 } | 26 } |
| 21 | 27 |
| 22 void ImeController::HandlePreviousIme() { | 28 void ImeController::HandlePreviousIme() { |
| 23 chromeos::input_method::InputMethodManager* manager = | 29 chromeos::input_method::InputMethodManager* manager = |
| 24 chromeos::input_method::InputMethodManager::Get(); | 30 chromeos::input_method::InputMethodManager::Get(); |
| 25 manager->GetActiveIMEState()->SwitchToPreviousInputMethod(); | 31 manager->GetActiveIMEState()->SwitchToPreviousInputMethod(); |
| 26 } | 32 } |
| 27 | 33 |
| 28 bool ImeController::CanSwitchIme(const ui::Accelerator& accelerator) { | 34 bool ImeController::CanSwitchIme(const ui::Accelerator& accelerator) { |
| 29 chromeos::input_method::InputMethodManager* manager = | 35 chromeos::input_method::InputMethodManager* manager = |
| 30 chromeos::input_method::InputMethodManager::Get(); | 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 } |
| 31 return manager->GetActiveIMEState()->CanSwitchInputMethod(accelerator); | 43 return manager->GetActiveIMEState()->CanSwitchInputMethod(accelerator); |
| 32 } | 44 } |
| 33 | 45 |
| 34 void ImeController::HandleSwitchIme(const ui::Accelerator& accelerator) { | 46 void ImeController::HandleSwitchIme(const ui::Accelerator& accelerator) { |
| 35 chromeos::input_method::InputMethodManager* manager = | 47 chromeos::input_method::InputMethodManager* manager = |
| 36 chromeos::input_method::InputMethodManager::Get(); | 48 chromeos::input_method::InputMethodManager::Get(); |
| 37 manager->GetActiveIMEState()->SwitchInputMethod(accelerator); | 49 manager->GetActiveIMEState()->SwitchInputMethod(accelerator); |
| 38 } | 50 } |
| OLD | NEW |