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 BASE_PREFS_JSON_PREF_STORE_H_ | 5 #ifndef BASE_PREFS_JSON_PREF_STORE_H_ |
6 #define BASE_PREFS_JSON_PREF_STORE_H_ | 6 #define BASE_PREFS_JSON_PREF_STORE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 virtual ~JsonPrefStore(); | 102 virtual ~JsonPrefStore(); |
103 | 103 |
104 // ImportantFileWriter::DataSerializer overrides: | 104 // ImportantFileWriter::DataSerializer overrides: |
105 virtual bool SerializeData(std::string* output) OVERRIDE; | 105 virtual bool SerializeData(std::string* output) OVERRIDE; |
106 | 106 |
107 // This method is called after the JSON file has been read and the result has | 107 // This method is called after the JSON file has been read and the result has |
108 // potentially been intercepted and modified by |pref_filter_|. | 108 // potentially been intercepted and modified by |pref_filter_|. |
109 // |initialization_successful| is pre-determined by OnFileRead() and should | 109 // |initialization_successful| is pre-determined by OnFileRead() and should |
110 // be used when reporting OnInitializationCompleted(). | 110 // be used when reporting OnInitializationCompleted(). |
111 // |schedule_write| indicates whether a write should be immediately scheduled | 111 // |schedule_write| indicates whether a write should be immediately scheduled |
112 // (typically because the |pref_filter_| has already altered the |prefs|) -- | 112 // (typically because the |pref_filter_| has already altered the prefs) -- |
113 // this will be ignored if this store is read-only. | 113 // this will be ignored if this store is read-only. |
114 void FinalizeFileRead(bool initialization_successful, | 114 void FinalizeFileRead(bool initialization_successful, |
115 scoped_ptr<base::DictionaryValue> prefs, | |
116 bool schedule_write); | 115 bool schedule_write); |
117 | 116 |
118 base::FilePath path_; | 117 base::FilePath path_; |
119 const scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_; | 118 const scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_; |
120 | 119 |
121 scoped_ptr<base::DictionaryValue> prefs_; | 120 scoped_ptr<base::DictionaryValue> prefs_; |
122 | 121 |
123 bool read_only_; | 122 bool read_only_; |
124 | 123 |
125 // Helper for safely writing pref data. | 124 // Helper for safely writing pref data. |
126 base::ImportantFileWriter writer_; | 125 base::ImportantFileWriter writer_; |
127 | 126 |
128 scoped_ptr<PrefFilter> pref_filter_; | 127 scoped_ptr<PrefFilter> pref_filter_; |
129 ObserverList<PrefStore::Observer, true> observers_; | 128 ObserverList<PrefStore::Observer, true> observers_; |
130 | 129 |
131 scoped_ptr<ReadErrorDelegate> error_delegate_; | 130 scoped_ptr<ReadErrorDelegate> error_delegate_; |
132 | 131 |
133 bool initialized_; | 132 bool initialized_; |
134 bool filtering_in_progress_; | 133 bool filtering_in_progress_; |
135 PrefReadError read_error_; | 134 PrefReadError read_error_; |
136 | 135 |
137 std::set<std::string> keys_need_empty_value_; | 136 std::set<std::string> keys_need_empty_value_; |
138 | 137 |
139 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); | 138 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); |
140 }; | 139 }; |
141 | 140 |
142 #endif // BASE_PREFS_JSON_PREF_STORE_H_ | 141 #endif // BASE_PREFS_JSON_PREF_STORE_H_ |
OLD | NEW |