OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromeos/ime/fake_xkeyboard.h" | 5 #include "chromeos/ime/fake_xkeyboard.h" |
6 | 6 |
7 namespace chromeos { | 7 namespace chromeos { |
8 namespace input_method { | 8 namespace input_method { |
9 | 9 |
10 FakeXKeyboard::FakeXKeyboard() | 10 FakeXKeyboard::FakeXKeyboard() |
11 : set_current_keyboard_layout_by_name_count_(0), | 11 : set_current_keyboard_layout_by_name_count_(0), |
12 caps_lock_is_enabled_(false), | 12 caps_lock_is_enabled_(false), |
13 num_lock_is_enabled_(false), | |
14 auto_repeat_is_enabled_(false) { | 13 auto_repeat_is_enabled_(false) { |
15 } | 14 } |
16 | 15 |
17 bool FakeXKeyboard::SetCurrentKeyboardLayoutByName( | 16 bool FakeXKeyboard::SetCurrentKeyboardLayoutByName( |
18 const std::string& layout_name) { | 17 const std::string& layout_name) { |
19 ++set_current_keyboard_layout_by_name_count_; | 18 ++set_current_keyboard_layout_by_name_count_; |
20 last_layout_ = layout_name; | 19 last_layout_ = layout_name; |
21 return true; | 20 return true; |
22 } | 21 } |
23 | 22 |
24 bool FakeXKeyboard::ReapplyCurrentKeyboardLayout() { | 23 bool FakeXKeyboard::ReapplyCurrentKeyboardLayout() { |
25 return true; | 24 return true; |
26 } | 25 } |
27 | 26 |
28 void FakeXKeyboard::ReapplyCurrentModifierLockStatus() { | 27 void FakeXKeyboard::ReapplyCurrentModifierLockStatus() { |
29 } | 28 } |
30 | 29 |
31 void FakeXKeyboard::SetLockedModifiers(ModifierLockStatus new_caps_lock_status, | 30 void FakeXKeyboard::DisableNumLock() { |
32 ModifierLockStatus new_num_lock_status) { | |
33 if (new_caps_lock_status != kDontChange) { | |
34 caps_lock_is_enabled_ = | |
35 (new_caps_lock_status == kEnableLock) ? true : false; | |
36 } | |
37 if (new_num_lock_status != kDontChange) | |
38 num_lock_is_enabled_ = (new_num_lock_status == kEnableLock) ? true : false; | |
39 } | |
40 | |
41 void FakeXKeyboard::SetNumLockEnabled(bool enable_num_lock) { | |
42 num_lock_is_enabled_ = enable_num_lock; | |
43 } | 31 } |
44 | 32 |
45 void FakeXKeyboard::SetCapsLockEnabled(bool enable_caps_lock) { | 33 void FakeXKeyboard::SetCapsLockEnabled(bool enable_caps_lock) { |
46 caps_lock_is_enabled_ = enable_caps_lock; | 34 caps_lock_is_enabled_ = enable_caps_lock; |
47 } | 35 } |
48 | 36 |
49 bool FakeXKeyboard::NumLockIsEnabled() { | |
50 return num_lock_is_enabled_; | |
51 } | |
52 | |
53 bool FakeXKeyboard::CapsLockIsEnabled() { | 37 bool FakeXKeyboard::CapsLockIsEnabled() { |
54 return caps_lock_is_enabled_; | 38 return caps_lock_is_enabled_; |
55 } | 39 } |
56 | 40 |
57 unsigned int FakeXKeyboard::GetNumLockMask() { | |
58 return 1; | |
59 } | |
60 | |
61 void FakeXKeyboard::GetLockedModifiers(bool* out_caps_lock_enabled, | |
62 bool* out_num_lock_enabled) { | |
63 *out_caps_lock_enabled = caps_lock_is_enabled_; | |
64 *out_num_lock_enabled = num_lock_is_enabled_; | |
65 } | |
66 | |
67 bool FakeXKeyboard::SetAutoRepeatEnabled(bool enabled) { | 41 bool FakeXKeyboard::SetAutoRepeatEnabled(bool enabled) { |
68 auto_repeat_is_enabled_ = enabled; | 42 auto_repeat_is_enabled_ = enabled; |
69 return true; | 43 return true; |
70 } | 44 } |
71 | 45 |
72 bool FakeXKeyboard::SetAutoRepeatRate(const AutoRepeatRate& rate) { | 46 bool FakeXKeyboard::SetAutoRepeatRate(const AutoRepeatRate& rate) { |
73 last_auto_repeat_rate_ = rate; | 47 last_auto_repeat_rate_ = rate; |
74 return true; | 48 return true; |
75 } | 49 } |
76 | 50 |
77 } // namespace input_method | 51 } // namespace input_method |
78 } // namespace chromeos | 52 } // namespace chromeos |
OLD | NEW |