| OLD | NEW |
| 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_PREFERENCES_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_PREFERENCES_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_PREFERENCES_H_ | 6 #define CHROME_BROWSER_CHROMEOS_PREFERENCES_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/prefs/public/pref_member.h" | 12 #include "base/prefs/public/pref_member.h" |
| 13 #include "chrome/browser/chromeos/language_preferences.h" | 13 #include "chrome/browser/chromeos/language_preferences.h" |
| 14 #include "chrome/browser/prefs/pref_service_observer.h" | 14 #include "chrome/browser/prefs/pref_service_observer.h" |
| 15 | 15 |
| 16 class PrefService; | 16 class PrefService; |
| 17 class PrefServiceSyncable; |
| 17 | 18 |
| 18 namespace chromeos { | 19 namespace chromeos { |
| 19 namespace input_method { | 20 namespace input_method { |
| 20 class InputMethodManager; | 21 class InputMethodManager; |
| 21 } // namespace input_method | 22 } // namespace input_method |
| 22 | 23 |
| 23 // The Preferences class handles Chrome OS preferences. When the class | 24 // The Preferences class handles Chrome OS preferences. When the class |
| 24 // is first initialized, it will initialize the OS settings to what's stored in | 25 // is first initialized, it will initialize the OS settings to what's stored in |
| 25 // the preferences. These include touchpad settings, etc. | 26 // the preferences. These include touchpad settings, etc. |
| 26 // When the preferences change, we change the settings to reflect the new value. | 27 // When the preferences change, we change the settings to reflect the new value. |
| 27 class Preferences : public PrefServiceObserver { | 28 class Preferences : public PrefServiceObserver { |
| 28 public: | 29 public: |
| 29 Preferences(); | 30 Preferences(); |
| 30 explicit Preferences( | 31 explicit Preferences( |
| 31 input_method::InputMethodManager* input_method_manager); // for testing | 32 input_method::InputMethodManager* input_method_manager); // for testing |
| 32 virtual ~Preferences(); | 33 virtual ~Preferences(); |
| 33 | 34 |
| 34 // This method will register the prefs associated with Chrome OS settings. | 35 // This method will register the prefs associated with Chrome OS settings. |
| 35 static void RegisterUserPrefs(PrefService* prefs); | 36 static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
| 36 | 37 |
| 37 // This method will initialize Chrome OS settings to values in user prefs. | 38 // This method will initialize Chrome OS settings to values in user prefs. |
| 38 void Init(PrefService* prefs); | 39 void Init(PrefServiceSyncable* prefs); |
| 39 | 40 |
| 40 void InitUserPrefsForTesting(PrefService* prefs); | 41 void InitUserPrefsForTesting(PrefServiceSyncable* prefs); |
| 41 void SetInputMethodListForTesting(); | 42 void SetInputMethodListForTesting(); |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 // Initializes all member prefs. | 45 // Initializes all member prefs. |
| 45 void InitUserPrefs(PrefService* prefs); | 46 void InitUserPrefs(PrefServiceSyncable* prefs); |
| 46 | 47 |
| 47 // Callback method for preference changes. | 48 // Callback method for preference changes. |
| 48 void OnPreferenceChanged(const std::string& pref_name); | 49 void OnPreferenceChanged(const std::string& pref_name); |
| 49 | 50 |
| 50 // This will set the OS settings when the preference changes. | 51 // This will set the OS settings when the preference changes. |
| 51 // If this method is called with NULL, it will set all OS settings to what's | 52 // If this method is called with NULL, it will set all OS settings to what's |
| 52 // stored in the preferences. | 53 // stored in the preferences. |
| 53 void NotifyPrefChanged(const std::string* pref_name); | 54 void NotifyPrefChanged(const std::string* pref_name); |
| 54 | 55 |
| 55 // Writes boolean |value| to the input method (IBus) configuration daemon. | 56 // Writes boolean |value| to the input method (IBus) configuration daemon. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // underlying XKB API requires it. | 92 // underlying XKB API requires it. |
| 92 void UpdateAutoRepeatRate(); | 93 void UpdateAutoRepeatRate(); |
| 93 | 94 |
| 94 // Force natural scroll to on if --enable-natural-scroll-default is specified | 95 // Force natural scroll to on if --enable-natural-scroll-default is specified |
| 95 // on the cmd line. | 96 // on the cmd line. |
| 96 void ForceNaturalScrollDefault(); | 97 void ForceNaturalScrollDefault(); |
| 97 | 98 |
| 98 // PrefServiceObserver implementation. | 99 // PrefServiceObserver implementation. |
| 99 virtual void OnIsSyncingChanged() OVERRIDE; | 100 virtual void OnIsSyncingChanged() OVERRIDE; |
| 100 | 101 |
| 101 PrefService* prefs_; | 102 PrefServiceSyncable* prefs_; |
| 102 | 103 |
| 103 input_method::InputMethodManager* input_method_manager_; | 104 input_method::InputMethodManager* input_method_manager_; |
| 104 | 105 |
| 105 BooleanPrefMember tap_to_click_enabled_; | 106 BooleanPrefMember tap_to_click_enabled_; |
| 106 BooleanPrefMember tap_dragging_enabled_; | 107 BooleanPrefMember tap_dragging_enabled_; |
| 107 BooleanPrefMember three_finger_click_enabled_; | 108 BooleanPrefMember three_finger_click_enabled_; |
| 108 BooleanPrefMember three_finger_swipe_enabled_; | 109 BooleanPrefMember three_finger_swipe_enabled_; |
| 109 BooleanPrefMember natural_scroll_; | 110 BooleanPrefMember natural_scroll_; |
| 110 BooleanPrefMember vert_edge_scroll_enabled_; | 111 BooleanPrefMember vert_edge_scroll_enabled_; |
| 111 BooleanPrefMember accessibility_enabled_; | 112 BooleanPrefMember accessibility_enabled_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 BooleanPrefMember enable_screen_lock_; | 157 BooleanPrefMember enable_screen_lock_; |
| 157 | 158 |
| 158 BooleanPrefMember enable_drm_; | 159 BooleanPrefMember enable_drm_; |
| 159 | 160 |
| 160 DISALLOW_COPY_AND_ASSIGN(Preferences); | 161 DISALLOW_COPY_AND_ASSIGN(Preferences); |
| 161 }; | 162 }; |
| 162 | 163 |
| 163 } // namespace chromeos | 164 } // namespace chromeos |
| 164 | 165 |
| 165 #endif // CHROME_BROWSER_CHROMEOS_PREFERENCES_H_ | 166 #endif // CHROME_BROWSER_CHROMEOS_PREFERENCES_H_ |
| OLD | NEW |