OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This provides a way to access the application's current preferences. | 5 // This provides a way to access the application's current preferences. |
6 | 6 |
7 #ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_H_ | 7 #ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_H_ |
8 #define CHROME_BROWSER_PREFS_PREF_SERVICE_H_ | 8 #define CHROME_BROWSER_PREFS_PREF_SERVICE_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 Value::ValueType type_; | 118 Value::ValueType type_; |
119 | 119 |
120 // Reference to the PrefService in which this pref was created. | 120 // Reference to the PrefService in which this pref was created. |
121 const PrefService* pref_service_; | 121 const PrefService* pref_service_; |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(Preference); | 123 DISALLOW_COPY_AND_ASSIGN(Preference); |
124 }; | 124 }; |
125 | 125 |
126 // Factory method that creates a new instance of a PrefService with the | 126 // Factory method that creates a new instance of a PrefService with the |
127 // applicable PrefStores. The |pref_filename| points to the user preference | 127 // applicable PrefStores. The |pref_filename| points to the user preference |
128 // file. The |profile| is the one to which these preferences apply; it may be | 128 // file. This is the usual way to create a new PrefService. |
129 // NULL if we're dealing with the local state. This is the usual way to create | 129 // |extension_pref_store| is used as the source for extension-controlled |
130 // a new PrefService. |extension_pref_store| is used as the source for | 130 // preferences and may be NULL. The PrefService takes ownership of |
131 // extension-controlled preferences and may be NULL. The PrefService takes | 131 // |extension_pref_store|. If |async| is true, asynchronous version is used. |
132 // ownership of |extension_pref_store|. If |async| is true, asynchronous | 132 // Notifies using PREF_INITIALIZATION_COMPLETED in the end. Details is set to |
133 // version is used. Notifies using PREF_INITIALIZATION_COMPLETED in the end. | 133 // the created PrefService or NULL if creation has failed. Note, it is |
134 // Details is set to the created PrefService or NULL if creation has failed. | 134 // guaranteed that in asynchronous version initialization happens after this |
135 // Note, it is guaranteed that in asynchronous version initialization happens | 135 // function returned. |
136 // after this function returned. | |
137 static PrefService* CreatePrefService(const FilePath& pref_filename, | 136 static PrefService* CreatePrefService(const FilePath& pref_filename, |
138 PrefStore* extension_pref_store, | 137 PrefStore* extension_pref_store, |
139 Profile* profile, | |
140 bool async); | 138 bool async); |
141 | 139 |
142 // Creates an incognito copy of the pref service that shares most pref stores | 140 // Creates an incognito copy of the pref service that shares most pref stores |
143 // but uses a fresh non-persistent overlay for the user pref store and an | 141 // but uses a fresh non-persistent overlay for the user pref store and an |
144 // individual extension pref store (to cache the effective extension prefs for | 142 // individual extension pref store (to cache the effective extension prefs for |
145 // incognito windows). | 143 // incognito windows). |
146 PrefService* CreateIncognitoPrefService(PrefStore* incognito_extension_prefs); | 144 PrefService* CreateIncognitoPrefService(PrefStore* incognito_extension_prefs); |
147 | 145 |
148 virtual ~PrefService(); | 146 virtual ~PrefService(); |
149 | 147 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 // of registered preferences are. | 387 // of registered preferences are. |
390 mutable PreferenceSet prefs_; | 388 mutable PreferenceSet prefs_; |
391 | 389 |
392 // The model associator that maintains the links with the sync db. | 390 // The model associator that maintains the links with the sync db. |
393 scoped_ptr<PrefModelAssociator> pref_sync_associator_; | 391 scoped_ptr<PrefModelAssociator> pref_sync_associator_; |
394 | 392 |
395 DISALLOW_COPY_AND_ASSIGN(PrefService); | 393 DISALLOW_COPY_AND_ASSIGN(PrefService); |
396 }; | 394 }; |
397 | 395 |
398 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_ | 396 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_ |
OLD | NEW |