| 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_observer.h" |
| 12 #include "chrome/browser/api/prefs/pref_member.h" | 13 #include "chrome/browser/api/prefs/pref_member.h" |
| 13 #include "chrome/browser/chromeos/language_preferences.h" | 14 #include "chrome/browser/chromeos/language_preferences.h" |
| 14 #include "content/public/browser/notification_observer.h" | |
| 15 | 15 |
| 16 class PrefService; | 16 class PrefService; |
| 17 | 17 |
| 18 namespace chromeos { | 18 namespace chromeos { |
| 19 namespace input_method { | 19 namespace input_method { |
| 20 class InputMethodManager; | 20 class InputMethodManager; |
| 21 } // namespace input_method | 21 } // namespace input_method |
| 22 | 22 |
| 23 // The Preferences class handles Chrome OS preferences. When the class | 23 // 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 | 24 // is first initialized, it will initialize the OS settings to what's stored in |
| 25 // the preferences. These include touchpad settings, etc. | 25 // the preferences. These include touchpad settings, etc. |
| 26 // When the preferences change, we change the settings to reflect the new value. | 26 // When the preferences change, we change the settings to reflect the new value. |
| 27 class Preferences : public content::NotificationObserver { | 27 class Preferences : public PrefObserver { |
| 28 public: | 28 public: |
| 29 Preferences(); | 29 Preferences(); |
| 30 explicit Preferences( | 30 explicit Preferences( |
| 31 input_method::InputMethodManager* input_method_manager); // for testing | 31 input_method::InputMethodManager* input_method_manager); // for testing |
| 32 virtual ~Preferences(); | 32 virtual ~Preferences(); |
| 33 | 33 |
| 34 // This method will register the prefs associated with Chrome OS settings. | 34 // This method will register the prefs associated with Chrome OS settings. |
| 35 static void RegisterUserPrefs(PrefService* prefs); | 35 static void RegisterUserPrefs(PrefService* prefs); |
| 36 | 36 |
| 37 // This method will initialize Chrome OS settings to values in user prefs. | 37 // This method will initialize Chrome OS settings to values in user prefs. |
| 38 void Init(PrefService* prefs); | 38 void Init(PrefService* prefs); |
| 39 | 39 |
| 40 // Overridden from content::NotificationObserver: | 40 // Overridden from PrefObserver: |
| 41 virtual void Observe(int type, | 41 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 42 const content::NotificationSource& source, | 42 const std::string& pref_name) OVERRIDE; |
| 43 const content::NotificationDetails& details) OVERRIDE; | |
| 44 | 43 |
| 45 void InitUserPrefsForTesting(PrefService* prefs); | 44 void InitUserPrefsForTesting(PrefService* prefs); |
| 46 void SetInputMethodListForTesting(); | 45 void SetInputMethodListForTesting(); |
| 47 | 46 |
| 48 private: | 47 private: |
| 49 // Initializes all member prefs. | 48 // Initializes all member prefs. |
| 50 void InitUserPrefs(PrefService* prefs); | 49 void InitUserPrefs(PrefService* prefs); |
| 51 | 50 |
| 52 // This will set the OS settings when the preference changes. | 51 // This will set the OS settings when the preference changes. |
| 53 // 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 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 BooleanPrefMember enable_screen_lock_; | 147 BooleanPrefMember enable_screen_lock_; |
| 149 | 148 |
| 150 BooleanPrefMember enable_drm_; | 149 BooleanPrefMember enable_drm_; |
| 151 | 150 |
| 152 DISALLOW_COPY_AND_ASSIGN(Preferences); | 151 DISALLOW_COPY_AND_ASSIGN(Preferences); |
| 153 }; | 152 }; |
| 154 | 153 |
| 155 } // namespace chromeos | 154 } // namespace chromeos |
| 156 | 155 |
| 157 #endif // CHROME_BROWSER_CHROMEOS_PREFERENCES_H_ | 156 #endif // CHROME_BROWSER_CHROMEOS_PREFERENCES_H_ |
| OLD | NEW |