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

Side by Side Diff: chromeos/ime/xkeyboard.h

Issue 12672008: Move xkeyboard.cc from c/b/chromeos/input_method to chromeos/ime (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 | « chromeos/ime/mock_xkeyboard.cc ('k') | chromeos/ime/xkeyboard.cc » ('j') | 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 2013 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 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_XKEYBOARD_H_ 5 #ifndef CHROMEOS_IME_XKEYBOARD_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_XKEYBOARD_H_ 6 #define CHROMEOS_IME_XKEYBOARD_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "chromeos/chromeos_export.h"
12 13
13 namespace chromeos { 14 namespace chromeos {
14 namespace input_method { 15 namespace input_method {
15 16
16 struct AutoRepeatRate { 17 struct AutoRepeatRate {
17 AutoRepeatRate() : initial_delay_in_ms(0), repeat_interval_in_ms(0) {} 18 AutoRepeatRate() : initial_delay_in_ms(0), repeat_interval_in_ms(0) {}
18 unsigned int initial_delay_in_ms; 19 unsigned int initial_delay_in_ms;
19 unsigned int repeat_interval_in_ms; 20 unsigned int repeat_interval_in_ms;
20 }; 21 };
21 22
22 enum ModifierLockStatus { 23 enum ModifierLockStatus {
23 kDisableLock = 0, 24 kDisableLock = 0,
24 kEnableLock, 25 kEnableLock,
25 kDontChange, 26 kDontChange,
26 }; 27 };
27 28
28 enum ModifierKey { 29 enum ModifierKey {
29 kSearchKey = 0, // Customizable. 30 kSearchKey = 0, // Customizable.
30 kControlKey, // Customizable. 31 kControlKey, // Customizable.
31 kAltKey, // Customizable. 32 kAltKey, // Customizable.
32 kVoidKey, 33 kVoidKey,
33 kCapsLockKey, 34 kCapsLockKey,
34 // IMPORTANT: You should update kCustomizableKeys[] in .cc file, if you 35 // IMPORTANT: You should update kCustomizableKeys[] in .cc file, if you
35 // add a customizable key. 36 // add a customizable key.
36 kNumModifierKeys, 37 kNumModifierKeys,
37 }; 38 };
38 39
39 class InputMethodUtil; 40 class InputMethodUtil;
40 41
41 class XKeyboard { 42 class CHROMEOS_EXPORT XKeyboard {
42 public: 43 public:
43 virtual ~XKeyboard() {} 44 virtual ~XKeyboard() {}
44 45
45 // Sets the current keyboard layout to |layout_name|. This function does not 46 // Sets the current keyboard layout to |layout_name|. This function does not
46 // change the current mapping of the modifier keys. Returns true on success. 47 // change the current mapping of the modifier keys. Returns true on success.
47 virtual bool SetCurrentKeyboardLayoutByName( 48 virtual bool SetCurrentKeyboardLayoutByName(
48 const std::string& layout_name) = 0; 49 const std::string& layout_name) = 0;
49 50
50 // Sets the current keyboard layout again. We have to call the function every 51 // Sets the current keyboard layout again. We have to call the function every
51 // time when "XI_HierarchyChanged" XInput2 event is sent to Chrome. See 52 // time when "XI_HierarchyChanged" XInput2 event is sent to Chrome. See
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 94
94 // Set true on |out_caps_lock_enabled| if Caps Lock is enabled. Set true on 95 // Set true on |out_caps_lock_enabled| if Caps Lock is enabled. Set true on
95 // |out_num_lock_enabled| if Num Lock is enabled. Both out parameters can be 96 // |out_num_lock_enabled| if Num Lock is enabled. Both out parameters can be
96 // NULL. Do not call the function from non-UI threads. 97 // NULL. Do not call the function from non-UI threads.
97 virtual void GetLockedModifiers(bool* out_caps_lock_enabled, 98 virtual void GetLockedModifiers(bool* out_caps_lock_enabled,
98 bool* out_num_lock_enabled) = 0; 99 bool* out_num_lock_enabled) = 0;
99 100
100 // Turns on and off the auto-repeat of the keyboard. Returns true on success. 101 // Turns on and off the auto-repeat of the keyboard. Returns true on success.
101 // Do not call the function from non-UI threads. 102 // Do not call the function from non-UI threads.
102 // TODO(yusukes): Make this function non-static so we can mock it. 103 // TODO(yusukes): Make this function non-static so we can mock it.
103 static bool SetAutoRepeatEnabled(bool enabled); 104 static CHROMEOS_EXPORT bool SetAutoRepeatEnabled(bool enabled);
104 105
105 // Sets the auto-repeat rate of the keyboard, initial delay in ms, and repeat 106 // Sets the auto-repeat rate of the keyboard, initial delay in ms, and repeat
106 // interval in ms. Returns true on success. Do not call the function from 107 // interval in ms. Returns true on success. Do not call the function from
107 // non-UI threads. 108 // non-UI threads.
108 // TODO(yusukes): Make this function non-static so we can mock it. 109 // TODO(yusukes): Make this function non-static so we can mock it.
109 static bool SetAutoRepeatRate(const AutoRepeatRate& rate); 110 static CHROMEOS_EXPORT bool SetAutoRepeatRate(const AutoRepeatRate& rate);
110 111
111 // Returns true if auto repeat is enabled. This function is protected: for 112 // Returns true if auto repeat is enabled. This function is protected: for
112 // testability. 113 // testability.
113 static bool GetAutoRepeatEnabledForTesting(); 114 static CHROMEOS_EXPORT bool GetAutoRepeatEnabledForTesting();
114 115
115 // On success, set current auto repeat rate on |out_rate| and returns true. 116 // On success, set current auto repeat rate on |out_rate| and returns true.
116 // Returns false otherwise. This function is protected: for testability. 117 // Returns false otherwise. This function is protected: for testability.
117 static bool GetAutoRepeatRateForTesting(AutoRepeatRate* out_rate); 118 static CHROMEOS_EXPORT bool GetAutoRepeatRateForTesting(
119 AutoRepeatRate* out_rate);
118 120
119 // Returns false if |layout_name| contains a bad character. 121 // Returns false if |layout_name| contains a bad character.
120 static bool CheckLayoutNameForTesting(const std::string& layout_name); 122 static CHROMEOS_EXPORT bool CheckLayoutNameForTesting(
123 const std::string& layout_name);
121 124
122 // Note: At this moment, classes other than InputMethodManager should not 125 // Note: At this moment, classes other than InputMethodManager should not
123 // instantiate the XKeyboard class. 126 // instantiate the XKeyboard class.
124 static XKeyboard* Create(); 127 static XKeyboard* Create();
125 }; 128 };
126 129
127 } // namespace input_method 130 } // namespace input_method
128 } // namespace chromeos 131 } // namespace chromeos
129 132
130 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_XKEYBOARD_H_ 133 #endif // CHROMEOS_IME_XKEYBOARD_H_
OLDNEW
« no previous file with comments | « chromeos/ime/mock_xkeyboard.cc ('k') | chromeos/ime/xkeyboard.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698