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/views/ash/ime_controller_chromeos.h" | 5 #include "chrome/browser/ui/views/ash/ime_controller_chromeos.h" |
6 | 6 |
7 #include "base/string_util.h" | |
7 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 8 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
8 | 9 |
10 #include "chrome/browser/browser_process.h" | |
11 #include "chrome/browser/prefs/pref_service.h" | |
12 #include "chrome/browser/chromeos/language_preferences.h" | |
13 | |
9 bool ImeController::HandleNextIme() { | 14 bool ImeController::HandleNextIme() { |
10 chromeos::input_method::InputMethodManager* manager = | 15 chromeos::input_method::InputMethodManager* manager = |
11 chromeos::input_method::InputMethodManager::GetInstance(); | 16 chromeos::input_method::InputMethodManager::GetInstance(); |
12 return manager->SwitchToNextInputMethod(); | 17 return manager->SwitchToNextInputMethod(); |
13 } | 18 } |
14 | 19 |
15 bool ImeController::HandlePreviousIme() { | 20 bool ImeController::HandlePreviousIme() { |
16 chromeos::input_method::InputMethodManager* manager = | 21 chromeos::input_method::InputMethodManager* manager = |
17 chromeos::input_method::InputMethodManager::GetInstance(); | 22 chromeos::input_method::InputMethodManager::GetInstance(); |
18 return manager->SwitchToPreviousInputMethod(); | 23 return manager->SwitchToPreviousInputMethod(); |
19 } | 24 } |
20 | 25 |
21 bool ImeController::HandleSwitchIme(const ui::Accelerator& accelerator) { | 26 bool ImeController::HandleSwitchIme(const ui::Accelerator& accelerator) { |
22 chromeos::input_method::InputMethodManager* manager = | 27 chromeos::input_method::InputMethodManager* manager = |
23 chromeos::input_method::InputMethodManager::GetInstance(); | 28 chromeos::input_method::InputMethodManager::GetInstance(); |
24 return manager->SwitchInputMethod(accelerator); | 29 return manager->SwitchInputMethod(accelerator); |
25 } | 30 } |
31 | |
32 bool ImeController::IsFrenchKeyboard() { | |
33 // First check the settings. | |
34 std::string layout = g_browser_process->local_state()->GetString( | |
35 chromeos::language_prefs::kPreferredKeyboardLayout); | |
Yusuke Sato
2012/05/29 08:29:11
please remove line 33-36. the pref is for login sc
Mr4D (OOO till 08-26)
2012/05/29 14:59:25
I don't think so. When a user overwrites the keybo
Yusuke Sato
2012/05/29 16:13:38
In short: the return value of GetCurrentInputMetho
Mr4D (OOO till 08-26)
2012/05/29 21:40:36
This is now really weird: I have tried this before
| |
36 if (layout == "") { | |
37 // If it is unset we check the hardware. | |
38 chromeos::input_method::InputMethodManager* manager = | |
39 chromeos::input_method::InputMethodManager::GetInstance(); | |
40 const chromeos::input_method::InputMethodDescriptor& descriptor = | |
41 manager->GetCurrentInputMethod(); | |
42 layout = descriptor.id(); | |
43 } | |
44 return EndsWith(layout, ":fra", false); | |
Yusuke Sato
2012/05/29 08:29:11
This matches the following 4 layouts: xkb:fr::fra,
Mr4D (OOO till 08-26)
2012/05/29 14:59:25
Done. I had no idea that there are even different
| |
45 } | |
OLD | NEW |