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 "ash/shell_observer.h" | 11 #include "ash/shell_observer.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/weak_ptr.h" |
13 #include "base/prefs/pref_member.h" | 14 #include "base/prefs/pref_member.h" |
14 #include "chrome/browser/chromeos/language_preferences.h" | 15 #include "chrome/browser/chromeos/language_preferences.h" |
15 #include "chrome/browser/chromeos/login/users/user_manager.h" | 16 #include "chrome/browser/chromeos/login/users/user_manager.h" |
16 #include "chrome/browser/prefs/pref_service_syncable_observer.h" | 17 #include "chrome/browser/prefs/pref_service_syncable_observer.h" |
17 | 18 |
18 class PrefRegistrySimple; | 19 class PrefRegistrySimple; |
19 class PrefService; | 20 class PrefService; |
20 class PrefServiceSyncable; | 21 class PrefServiceSyncable; |
21 | 22 |
22 class TracingManager; | 23 class TracingManager; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // |REASON_PREF_CHANGED|, otherwise it is empty. | 78 // |REASON_PREF_CHANGED|, otherwise it is empty. |
78 void ApplyPreferences(ApplyReason reason, | 79 void ApplyPreferences(ApplyReason reason, |
79 const std::string& pref_name); | 80 const std::string& pref_name); |
80 | 81 |
81 // A variant of SetLanguageConfigStringList. You can pass comma-separated | 82 // A variant of SetLanguageConfigStringList. You can pass comma-separated |
82 // values. Examples of |value|: "", "Control+space,Hiragana" | 83 // values. Examples of |value|: "", "Control+space,Hiragana" |
83 void SetLanguageConfigStringListAsCSV(const char* section, | 84 void SetLanguageConfigStringListAsCSV(const char* section, |
84 const char* name, | 85 const char* name, |
85 const std::string& value); | 86 const std::string& value); |
86 | 87 |
| 88 void SetPreferredLanguages(scoped_ptr<std::string> languages); |
| 89 |
87 // Restores the user's preferred input method / keyboard layout on signing in. | 90 // Restores the user's preferred input method / keyboard layout on signing in. |
88 void SetInputMethodList(); | 91 void SetInputMethodList(); |
89 | 92 |
| 93 // Sets the enabled extension IMEs from kLanguageEnabledExtensionImes. |
| 94 void SetEnabledExtensionImes(); |
| 95 |
| 96 // Copies language and input method prefs to their syncable counterparts. |
| 97 void SetSyncableInputMethodPrefs(); |
| 98 |
| 99 // Add the input methods from the syncable prefs to the device-local prefs. |
| 100 // This should only be called once (after user's first sync) and only adds |
| 101 // to, not removes from, the user's local input method prefs. |
| 102 void MergeSyncedInputMethods(); |
| 103 |
90 // Updates the initial key repeat delay and key repeat interval following | 104 // Updates the initial key repeat delay and key repeat interval following |
91 // current prefs values. We set the delay and interval at once since an | 105 // current prefs values. We set the delay and interval at once since an |
92 // underlying XKB API requires it. | 106 // underlying XKB API requires it. |
93 void UpdateAutoRepeatRate(); | 107 void UpdateAutoRepeatRate(); |
94 | 108 |
95 // Force natural scroll to on if --enable-natural-scroll-default is specified | 109 // Force natural scroll to on if --enable-natural-scroll-default is specified |
96 // on the cmd line. | 110 // on the cmd line. |
97 void ForceNaturalScrollDefault(); | 111 void ForceNaturalScrollDefault(); |
98 | 112 |
99 // PrefServiceSyncableObserver implementation. | 113 // PrefServiceSyncableObserver implementation. |
(...skipping 17 matching lines...) Expand all Loading... |
117 BooleanPrefMember natural_scroll_; | 131 BooleanPrefMember natural_scroll_; |
118 BooleanPrefMember vert_edge_scroll_enabled_; | 132 BooleanPrefMember vert_edge_scroll_enabled_; |
119 IntegerPrefMember speed_factor_; | 133 IntegerPrefMember speed_factor_; |
120 IntegerPrefMember mouse_sensitivity_; | 134 IntegerPrefMember mouse_sensitivity_; |
121 IntegerPrefMember touchpad_sensitivity_; | 135 IntegerPrefMember touchpad_sensitivity_; |
122 BooleanPrefMember primary_mouse_button_right_; | 136 BooleanPrefMember primary_mouse_button_right_; |
123 FilePathPrefMember download_default_directory_; | 137 FilePathPrefMember download_default_directory_; |
124 BooleanPrefMember touch_hud_projection_enabled_; | 138 BooleanPrefMember touch_hud_projection_enabled_; |
125 | 139 |
126 // Input method preferences. | 140 // Input method preferences. |
| 141 // These can't sync, because different devices can have different hardware |
| 142 // keyboards or different extensions. |
| 143 StringPrefMember preferred_languages_; |
127 StringPrefMember preload_engines_; | 144 StringPrefMember preload_engines_; |
| 145 StringPrefMember enabled_extension_imes_; |
| 146 // Instead of syncing the above prefs, there are syncable variants which don't |
| 147 // change the device settings. We can set these to keep track of the user's |
| 148 // most recent choices. That way, after the initial post-OOBE sync, we can at |
| 149 // least add the user's synced choices to the values that have already been |
| 150 // chosen at OOBE. Besides that, the synced values are never used. |
| 151 StringPrefMember preferred_languages_syncable_; |
| 152 StringPrefMember preload_engines_syncable_; |
| 153 StringPrefMember enabled_extension_imes_syncable_; |
128 StringPrefMember current_input_method_; | 154 StringPrefMember current_input_method_; |
129 StringPrefMember previous_input_method_; | 155 StringPrefMember previous_input_method_; |
130 StringPrefMember enabled_extension_imes_; | |
131 | 156 |
132 BooleanPrefMember xkb_auto_repeat_enabled_; | 157 BooleanPrefMember xkb_auto_repeat_enabled_; |
133 IntegerPrefMember xkb_auto_repeat_delay_pref_; | 158 IntegerPrefMember xkb_auto_repeat_delay_pref_; |
134 IntegerPrefMember xkb_auto_repeat_interval_pref_; | 159 IntegerPrefMember xkb_auto_repeat_interval_pref_; |
135 | 160 |
136 // User owning these preferences. | 161 // User owning these preferences. |
137 const User* user_; | 162 const User* user_; |
138 | 163 |
139 // Whether user is a primary user. | 164 // Whether user is a primary user. |
140 bool user_is_primary_; | 165 bool user_is_primary_; |
141 | 166 |
| 167 base::WeakPtrFactory<Preferences> weak_factory_; |
| 168 |
142 DISALLOW_COPY_AND_ASSIGN(Preferences); | 169 DISALLOW_COPY_AND_ASSIGN(Preferences); |
143 }; | 170 }; |
144 | 171 |
145 } // namespace chromeos | 172 } // namespace chromeos |
146 | 173 |
147 #endif // CHROME_BROWSER_CHROMEOS_PREFERENCES_H_ | 174 #endif // CHROME_BROWSER_CHROMEOS_PREFERENCES_H_ |
OLD | NEW |