OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_TOUCHPAD_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_TOUCHPAD_H_ |
6 #define CHROME_BROWSER_CHROMEOS_TOUCHPAD_H_ | 6 #define CHROME_BROWSER_CHROMEOS_TOUCHPAD_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/common/notification_observer.h" | 10 #include "chrome/common/notification_observer.h" |
11 #include "chrome/common/pref_member.h" | 11 #include "chrome/common/pref_member.h" |
12 | 12 |
13 class PrefService; | 13 class PrefService; |
14 | 14 |
15 // The Touchpad class handles touchpad preferences. When the class is first | 15 // The Touchpad class handles touchpad preferences. When the class is first |
16 // initialized, it will initialize the touchpad settings to what's stored in the | 16 // initialized, it will initialize the touchpad settings to what's stored in the |
17 // preferences. And whenever the preference changes, we change the touchpad | 17 // preferences. And whenever the preference changes, we change the touchpad |
18 // setting to reflect the new value. | 18 // setting to reflect the new value. |
19 // | 19 // |
20 // For Synaptics touchpads, we use synclient to change settings on-the-fly. | 20 // For Synaptics touchpads, we use synclient to change settings on-the-fly. |
21 // See "man synaptics" for a list of settings that can be changed | 21 // See "man synaptics" for a list of settings that can be changed. |
22 // Since we are doing a system call to run the synclient binary, we make sure | 22 // Since we are doing a system call to run the synclient binary, we make sure |
23 // that we are running on the IO thread so that we don't block the UI thread. | 23 // that we are running on the File thread so that we don't block the UI thread. |
24 class Touchpad : public NotificationObserver { | 24 class Touchpad : public NotificationObserver { |
25 public: | 25 public: |
26 explicit Touchpad() {} | 26 explicit Touchpad() {} |
27 virtual ~Touchpad() {} | 27 virtual ~Touchpad() {} |
28 | 28 |
29 // This method will register the prefs associated with touchpad settings. | 29 // This method will register the prefs associated with touchpad settings. |
30 static void RegisterUserPrefs(PrefService* prefs); | 30 static void RegisterUserPrefs(PrefService* prefs); |
31 | 31 |
32 // This method will initialize touchpad settings to values in user prefs. | 32 // This method will initialize touchpad settings to values in user prefs. |
33 virtual void Init(PrefService* prefs); | 33 virtual void Init(PrefService* prefs); |
34 | 34 |
35 // Overridden from NotificationObserver: | 35 // Overridden from NotificationObserver: |
36 virtual void Observe(NotificationType type, | 36 virtual void Observe(NotificationType type, |
37 const NotificationSource& source, | 37 const NotificationSource& source, |
38 const NotificationDetails& details); | 38 const NotificationDetails& details); |
39 | 39 |
40 protected: | 40 protected: |
41 virtual void NotifyPrefChanged(const std::wstring* pref_name); | 41 virtual void NotifyPrefChanged(const std::wstring* pref_name); |
42 | 42 |
43 private: | 43 private: |
44 // This methods makes a system call to synclient to change touchpad settings. | 44 // This methods makes a system call to synclient to change touchpad settings. |
45 // The system call will be invoked on the file thread. | 45 // The system call will be invoked on the file thread. |
46 void SetSynclientParam(const std::string& param, const std::string& value); | 46 void SetSynclientParam(const std::string& param, const std::string& value); |
47 | 47 |
| 48 // Set tap-to-click to value stored in preference. |
48 void SetTapToClick(); | 49 void SetTapToClick(); |
| 50 |
| 51 // Set vertical edge scrolling to value stored in preference. |
49 void SetVertEdgeScroll(); | 52 void SetVertEdgeScroll(); |
50 | 53 |
| 54 // Set touchpad speed factor to value stored in preference. |
| 55 void SetSpeedFactor(); |
| 56 |
51 BooleanPrefMember tap_to_click_enabled_; | 57 BooleanPrefMember tap_to_click_enabled_; |
52 BooleanPrefMember vert_edge_scroll_enabled_; | 58 BooleanPrefMember vert_edge_scroll_enabled_; |
| 59 RealPrefMember speed_factor_; |
53 | 60 |
54 DISALLOW_COPY_AND_ASSIGN(Touchpad); | 61 DISALLOW_COPY_AND_ASSIGN(Touchpad); |
55 }; | 62 }; |
56 | 63 |
57 #endif // CHROME_BROWSER_CHROMEOS_TOUCHPAD_H_ | 64 #endif // CHROME_BROWSER_CHROMEOS_TOUCHPAD_H_ |
OLD | NEW |