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

Side by Side Diff: chrome/browser/chromeos/input_method/xkeyboard.h

Issue 11558017: Decouple input_method from BrowserThread (and content/). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build failure. Created 8 years 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
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 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_XKEYBOARD_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_XKEYBOARD_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_XKEYBOARD_H_ 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_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 "base/memory/ref_counted.h"
13
14 namespace base {
15 class SequencedTaskRunner;
16 } // namespace base
12 17
13 namespace chromeos { 18 namespace chromeos {
14 namespace input_method { 19 namespace input_method {
15 20
16 struct AutoRepeatRate { 21 struct AutoRepeatRate {
17 AutoRepeatRate() : initial_delay_in_ms(0), repeat_interval_in_ms(0) {} 22 AutoRepeatRate() : initial_delay_in_ms(0), repeat_interval_in_ms(0) {}
18 unsigned int initial_delay_in_ms; 23 unsigned int initial_delay_in_ms;
19 unsigned int repeat_interval_in_ms; 24 unsigned int repeat_interval_in_ms;
20 }; 25 };
21 26
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 virtual unsigned int GetNumLockMask() = 0; 97 virtual unsigned int GetNumLockMask() = 0;
93 98
94 // Set true on |out_caps_lock_enabled| if Caps Lock is enabled. Set true on 99 // 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 100 // |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. 101 // NULL. Do not call the function from non-UI threads.
97 virtual void GetLockedModifiers(bool* out_caps_lock_enabled, 102 virtual void GetLockedModifiers(bool* out_caps_lock_enabled,
98 bool* out_num_lock_enabled) = 0; 103 bool* out_num_lock_enabled) = 0;
99 104
100 // Turns on and off the auto-repeat of the keyboard. Returns true on success. 105 // Turns on and off the auto-repeat of the keyboard. Returns true on success.
101 // Do not call the function from non-UI threads. 106 // Do not call the function from non-UI threads.
102 // TODO(yusukes): Make this function non-static so we can mock it. 107 virtual bool SetAutoRepeatEnabled(bool enabled) = 0;
103 static bool SetAutoRepeatEnabled(bool enabled);
104 108
105 // Sets the auto-repeat rate of the keyboard, initial delay in ms, and repeat 109 // 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 110 // interval in ms. Returns true on success. Do not call the function from
107 // non-UI threads. 111 // non-UI threads.
108 // TODO(yusukes): Make this function non-static so we can mock it. 112 virtual bool SetAutoRepeatRate(const AutoRepeatRate& rate) = 0;
109 static bool SetAutoRepeatRate(const AutoRepeatRate& rate);
110 113
111 // Returns true if auto repeat is enabled. This function is protected: for 114 // Returns true if auto repeat is enabled.
112 // testability.
113 static bool GetAutoRepeatEnabledForTesting(); 115 static bool GetAutoRepeatEnabledForTesting();
114 116
115 // On success, set current auto repeat rate on |out_rate| and returns true. 117 // On success, set current auto repeat rate on |out_rate| and returns true.
116 // Returns false otherwise. This function is protected: for testability. 118 // Returns false otherwise.
117 static bool GetAutoRepeatRateForTesting(AutoRepeatRate* out_rate); 119 static bool GetAutoRepeatRateForTesting(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 bool CheckLayoutNameForTesting(const std::string& layout_name);
121 123
124 // Creates an instance of XKeyboard. |default_task_runner| is used to verify
125 // thread-safe usage (all methods must be invoked in the context of
126 // default_task_runner).
122 // Note: At this moment, classes other than InputMethodManager should not 127 // Note: At this moment, classes other than InputMethodManager should not
123 // instantiate the XKeyboard class. 128 // instantiate the XKeyboard class.
124 static XKeyboard* Create(const InputMethodUtil& util); 129 static XKeyboard* Create(
130 const InputMethodUtil& util,
131 const scoped_refptr<base::SequencedTaskRunner>& default_task_runner);
125 }; 132 };
126 133
127 } // namespace input_method 134 } // namespace input_method
128 } // namespace chromeos 135 } // namespace chromeos
129 136
130 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_XKEYBOARD_H_ 137 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_XKEYBOARD_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/mock_xkeyboard.cc ('k') | chrome/browser/chromeos/input_method/xkeyboard.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698