OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_TOUCHPAD_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_TOUCHPAD_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "chrome/common/notification_observer.h" |
| 11 #include "chrome/common/pref_member.h" |
| 12 |
| 13 class PrefService; |
| 14 |
| 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 |
| 17 // preferences. And whenever the preference changes, we change the touchpad |
| 18 // setting to reflect the new value. |
| 19 // |
| 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 |
| 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. |
| 24 class Touchpad : public NotificationObserver { |
| 25 public: |
| 26 explicit Touchpad() {} |
| 27 virtual ~Touchpad() {} |
| 28 |
| 29 // This method will register the prefs associated with touchpad settings. |
| 30 static void RegisterUserPrefs(PrefService* prefs); |
| 31 |
| 32 // This method will initialize touchpad settings to values in user prefs. |
| 33 virtual void Init(PrefService* prefs); |
| 34 |
| 35 // Overridden from NotificationObserver: |
| 36 virtual void Observe(NotificationType type, |
| 37 const NotificationSource& source, |
| 38 const NotificationDetails& details); |
| 39 |
| 40 protected: |
| 41 virtual void NotifyPrefChanged(const std::wstring* pref_name); |
| 42 |
| 43 private: |
| 44 // This methods makes a system call to synclient to change touchpad settings. |
| 45 // The system call will be invoked on the file thread. |
| 46 void SetSynclientParam(const std::string& param, const std::string& value); |
| 47 |
| 48 void SetTapToClick(); |
| 49 void SetVertEdgeScroll(); |
| 50 |
| 51 BooleanPrefMember tap_to_click_enabled_; |
| 52 BooleanPrefMember vert_edge_scroll_enabled_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(Touchpad); |
| 55 }; |
| 56 |
| 57 #endif // CHROME_BROWSER_CHROMEOS_TOUCHPAD_H_ |
OLD | NEW |