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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_PREFERENCES_H_
6 #define CHROME_BROWSER_CHROMEOS_PREFERENCES_H_
11 #include "ash/shell_observer.h"
12 #include "base/compiler_specific.h"
13 #include "base/prefs/pref_member.h"
14 #include "chrome/browser/chromeos/language_preferences.h"
15 #include "chrome/browser/prefs/pref_service_syncable_observer.h"
17 class PrefRegistrySimple
;
19 class PrefServiceSyncable
;
23 namespace user_prefs
{
24 class PrefRegistrySyncable
;
29 namespace input_method
{
30 class InputMethodManager
;
33 // The Preferences class handles Chrome OS preferences. When the class
34 // is first initialized, it will initialize the OS settings to what's stored in
35 // the preferences. These include touchpad settings, etc.
36 // When the preferences change, we change the settings to reflect the new value.
37 class Preferences
: public PrefServiceSyncableObserver
,
38 public ash::ShellObserver
{
42 input_method::InputMethodManager
* input_method_manager
); // for testing
43 virtual ~Preferences();
45 // These method will register the prefs associated with Chrome OS settings.
46 static void RegisterPrefs(PrefRegistrySimple
* registry
);
47 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable
* registry
);
49 // This method will initialize Chrome OS settings to values in user prefs.
50 void Init(PrefServiceSyncable
* prefs
);
52 void InitUserPrefsForTesting(PrefServiceSyncable
* prefs
);
53 void SetInputMethodListForTesting();
56 // Initializes all member prefs.
57 void InitUserPrefs(PrefServiceSyncable
* prefs
);
59 // Callback method for preference changes.
60 void OnPreferenceChanged(const std::string
& pref_name
);
62 // This will set the OS settings when the preference changes.
63 // If this method is called with NULL, it will set all OS settings to what's
64 // stored in the preferences.
65 void NotifyPrefChanged(const std::string
* pref_name
);
67 // A variant of SetLanguageConfigStringList. You can pass comma-separated
68 // values. Examples of |value|: "", "Control+space,Hiragana"
69 void SetLanguageConfigStringListAsCSV(const char* section
,
71 const std::string
& value
);
73 // Restores the user's preferred input method / keyboard layout on signing in.
74 void SetInputMethodList();
76 // Updates the initial key repeat delay and key repeat interval following
77 // current prefs values. We set the delay and interval at once since an
78 // underlying XKB API requires it.
79 void UpdateAutoRepeatRate();
81 // Force natural scroll to on if --enable-natural-scroll-default is specified
83 void ForceNaturalScrollDefault();
85 // PrefServiceSyncableObserver implementation.
86 virtual void OnIsSyncingChanged() OVERRIDE
;
88 // Overriden from ash::ShellObserver.
89 virtual void OnTouchHudProjectionToggled(bool enabled
) OVERRIDE
;
91 PrefServiceSyncable
* prefs_
;
93 input_method::InputMethodManager
* input_method_manager_
;
94 scoped_ptr
<TracingManager
> tracing_manager_
;
96 BooleanPrefMember performance_tracing_enabled_
;
97 BooleanPrefMember tap_to_click_enabled_
;
98 BooleanPrefMember tap_dragging_enabled_
;
99 BooleanPrefMember three_finger_click_enabled_
;
100 BooleanPrefMember natural_scroll_
;
101 BooleanPrefMember vert_edge_scroll_enabled_
;
102 BooleanPrefMember a11y_spoken_feedback_enabled_
;
103 BooleanPrefMember a11y_high_contrast_enabled_
;
104 BooleanPrefMember a11y_screen_magnifier_enabled_
;
105 IntegerPrefMember a11y_screen_magnifier_type_
;
106 DoublePrefMember a11y_screen_magnifier_scale_
;
107 IntegerPrefMember speed_factor_
;
108 IntegerPrefMember mouse_sensitivity_
;
109 IntegerPrefMember touchpad_sensitivity_
;
110 BooleanPrefMember primary_mouse_button_right_
;
111 BooleanPrefMember use_24hour_clock_
;
112 BooleanPrefMember disable_drive_
;
113 BooleanPrefMember disable_drive_over_cellular_
;
114 BooleanPrefMember disable_drive_hosted_files_
;
115 FilePathPrefMember download_default_directory_
;
116 FilePathPrefMember select_file_last_directory_
;
117 FilePathPrefMember save_file_default_directory_
;
118 BooleanPrefMember touch_hud_projection_enabled_
;
120 // Input method preferences.
121 StringPrefMember preferred_languages_
;
122 StringPrefMember preload_engines_
;
123 StringPrefMember current_input_method_
;
124 StringPrefMember previous_input_method_
;
125 StringPrefMember enabled_extension_imes_
;
127 BooleanPrefMember xkb_auto_repeat_enabled_
;
128 IntegerPrefMember xkb_auto_repeat_delay_pref_
;
129 IntegerPrefMember xkb_auto_repeat_interval_pref_
;
131 DISALLOW_COPY_AND_ASSIGN(Preferences
);
134 } // namespace chromeos
136 #endif // CHROME_BROWSER_CHROMEOS_PREFERENCES_H_