Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: chrome/browser/chromeos/input_method/mock_xkeyboard.cc

Issue 10008107: Improve MockXKeyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/input_method/mock_xkeyboard.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/chromeos/input_method/mock_xkeyboard.h" 5 #include "chrome/browser/chromeos/input_method/mock_xkeyboard.h"
6 6
7 namespace chromeos { 7 namespace chromeos {
8 namespace input_method { 8 namespace input_method {
9 9
10 MockXKeyboard::MockXKeyboard() 10 MockXKeyboard::MockXKeyboard()
11 : set_current_keyboard_layout_by_name_count_(0) { 11 : set_current_keyboard_layout_by_name_count_(0),
12 caps_lock_is_enabled_(false),
13 num_lock_is_enabled_(true) {
12 } 14 }
13 15
14 bool MockXKeyboard::SetCurrentKeyboardLayoutByName( 16 bool MockXKeyboard::SetCurrentKeyboardLayoutByName(
15 const std::string& layout_name) { 17 const std::string& layout_name) {
16 ++set_current_keyboard_layout_by_name_count_; 18 ++set_current_keyboard_layout_by_name_count_;
17 last_layout_ = layout_name; 19 last_layout_ = layout_name;
18 return true; 20 return true;
19 } 21 }
20 22
21 bool MockXKeyboard::RemapModifierKeys(const ModifierMap& modifier_map) { 23 bool MockXKeyboard::RemapModifierKeys(const ModifierMap& modifier_map) {
22 return true; 24 return true;
23 } 25 }
24 26
25 bool MockXKeyboard::ReapplyCurrentKeyboardLayout() { 27 bool MockXKeyboard::ReapplyCurrentKeyboardLayout() {
26 return true; 28 return true;
27 } 29 }
28 30
29 void MockXKeyboard::ReapplyCurrentModifierLockStatus() { 31 void MockXKeyboard::ReapplyCurrentModifierLockStatus() {
30 } 32 }
31 33
32 void MockXKeyboard::SetLockedModifiers( 34 void MockXKeyboard::SetLockedModifiers(ModifierLockStatus new_caps_lock_status,
33 ModifierLockStatus new_caps_lock_status, 35 ModifierLockStatus new_num_lock_status) {
34 ModifierLockStatus new_num_lock_status) { 36 if (new_caps_lock_status != kDontChange) {
37 caps_lock_is_enabled_ =
38 (new_caps_lock_status == kEnableLock) ? true : false;
39 }
40 if (new_num_lock_status != kDontChange)
41 num_lock_is_enabled_ = (new_num_lock_status == kEnableLock) ? true : false;
35 } 42 }
36 43
37 void MockXKeyboard::SetNumLockEnabled(bool enable_num_lock) { 44 void MockXKeyboard::SetNumLockEnabled(bool enable_num_lock) {
45 num_lock_is_enabled_ = enable_num_lock;
38 } 46 }
39 47
40 void MockXKeyboard::SetCapsLockEnabled(bool enable_caps_lock) { 48 void MockXKeyboard::SetCapsLockEnabled(bool enable_caps_lock) {
49 caps_lock_is_enabled_ = enable_caps_lock;
41 } 50 }
42 51
43 bool MockXKeyboard::NumLockIsEnabled() { 52 bool MockXKeyboard::NumLockIsEnabled() {
44 return true; 53 return num_lock_is_enabled_;
45 } 54 }
46 55
47 bool MockXKeyboard::CapsLockIsEnabled() { 56 bool MockXKeyboard::CapsLockIsEnabled() {
48 return false; 57 return caps_lock_is_enabled_;
49 } 58 }
50 59
51 std::string MockXKeyboard::CreateFullXkbLayoutName( 60 std::string MockXKeyboard::CreateFullXkbLayoutName(
52 const std::string& layout_name, 61 const std::string& layout_name,
53 const ModifierMap& modifire_map) { 62 const ModifierMap& modifire_map) {
54 return ""; 63 return "";
55 } 64 }
56 65
57 unsigned int MockXKeyboard::GetNumLockMask() { 66 unsigned int MockXKeyboard::GetNumLockMask() {
58 return 1; 67 return 1;
59 } 68 }
60 69
61 void MockXKeyboard::GetLockedModifiers(bool* out_caps_lock_enabled, 70 void MockXKeyboard::GetLockedModifiers(bool* out_caps_lock_enabled,
62 bool* out_num_lock_enabled) { 71 bool* out_num_lock_enabled) {
72 *out_caps_lock_enabled = caps_lock_is_enabled_;
73 *out_num_lock_enabled = num_lock_is_enabled_;
63 } 74 }
64 75
65 } // namespace input_method 76 } // namespace input_method
66 } // namespace chromeos 77 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/mock_xkeyboard.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698