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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/input_method/xkeyboard.h
diff --git a/chrome/browser/chromeos/input_method/xkeyboard.h b/chrome/browser/chromeos/input_method/xkeyboard.h
index ab16015010b13bcf841836f8c9e2f0f8b3b2a342..dff46c9cee794cdd2744e8cad3acb301cf6c72d4 100644
--- a/chrome/browser/chromeos/input_method/xkeyboard.h
+++ b/chrome/browser/chromeos/input_method/xkeyboard.h
@@ -9,6 +9,11 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+
+namespace base {
+class SequencedTaskRunner;
+} // namespace base
namespace chromeos {
namespace input_method {
@@ -99,29 +104,31 @@ class XKeyboard {
// Turns on and off the auto-repeat of the keyboard. Returns true on success.
// Do not call the function from non-UI threads.
- // TODO(yusukes): Make this function non-static so we can mock it.
- static bool SetAutoRepeatEnabled(bool enabled);
+ virtual bool SetAutoRepeatEnabled(bool enabled) = 0;
// Sets the auto-repeat rate of the keyboard, initial delay in ms, and repeat
// interval in ms. Returns true on success. Do not call the function from
// non-UI threads.
- // TODO(yusukes): Make this function non-static so we can mock it.
- static bool SetAutoRepeatRate(const AutoRepeatRate& rate);
+ virtual bool SetAutoRepeatRate(const AutoRepeatRate& rate) = 0;
- // Returns true if auto repeat is enabled. This function is protected: for
- // testability.
+ // Returns true if auto repeat is enabled.
static bool GetAutoRepeatEnabledForTesting();
// On success, set current auto repeat rate on |out_rate| and returns true.
- // Returns false otherwise. This function is protected: for testability.
+ // Returns false otherwise.
static bool GetAutoRepeatRateForTesting(AutoRepeatRate* out_rate);
// Returns false if |layout_name| contains a bad character.
static bool CheckLayoutNameForTesting(const std::string& layout_name);
+ // Creates an instance of XKeyboard. |default_task_runner| is used to verify
+ // thread-safe usage (all methods must be invoked in the context of
+ // default_task_runner).
// Note: At this moment, classes other than InputMethodManager should not
// instantiate the XKeyboard class.
- static XKeyboard* Create(const InputMethodUtil& util);
+ static XKeyboard* Create(
+ const InputMethodUtil& util,
+ const scoped_refptr<base::SequencedTaskRunner>& default_task_runner);
};
} // namespace input_method
« 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