| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_FILESYSTEM_JSON_PREF_STORE_H_ | 5 #ifndef COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_FILESYSTEM_JSON_PREF_STORE_H_ |
| 6 #define COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_FILESYSTEM_JSON_PREF_STORE_H_ | 6 #define COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_FILESYSTEM_JSON_PREF_STORE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // Opens the filesystem and calls |callback| when completed, whether | 133 // Opens the filesystem and calls |callback| when completed, whether |
| 134 // successfully or unsuccessfully. | 134 // successfully or unsuccessfully. |
| 135 void OpenFilesystem(base::Closure callback); | 135 void OpenFilesystem(base::Closure callback); |
| 136 | 136 |
| 137 // Callback method which verifies that there were no errors on opening the | 137 // Callback method which verifies that there were no errors on opening the |
| 138 // filesystem, and if there aren't, invokes the passed in callback. | 138 // filesystem, and if there aren't, invokes the passed in callback. |
| 139 void OnOpenFilesystem(base::Closure callback, FileError err); | 139 void OnOpenFilesystem(base::Closure callback, FileError err); |
| 140 | 140 |
| 141 // Asynchronous implementation details of PerformWrite(). | 141 // Asynchronous implementation details of PerformWrite(). |
| 142 void OnTempFileWriteStart(); | 142 void OnTempFileWriteStart(); |
| 143 void OnTempFileOpened(FileError err); | 143 void OnTempFileWrite(FileError err); |
| 144 void OnTempFileWrite(FileError err, uint32_t num_bytes_written); | |
| 145 void OnTempFileClosed(FileError err); | |
| 146 void OnTempFileRenamed(FileError err); | 144 void OnTempFileRenamed(FileError err); |
| 147 | 145 |
| 148 // Asynchronous implementation details of ReadPrefsAsync(). | 146 // Asynchronous implementation details of ReadPrefsAsync(). |
| 149 void OnPreferencesReadStart(); | 147 void OnPreferencesReadStart(); |
| 150 void OnPreferencesFileOpened(FileError err); | |
| 151 void OnPreferencesFileRead(FileError err, mojo::Array<uint8_t> contents); | 148 void OnPreferencesFileRead(FileError err, mojo::Array<uint8_t> contents); |
| 152 | 149 |
| 153 const std::string path_; | 150 const std::string path_; |
| 154 mojo::Binding<filesystem::FileSystemClient> binding_; | 151 mojo::Binding<filesystem::FileSystemClient> binding_; |
| 155 filesystem::FileSystemPtr filesystem_; | 152 filesystem::FileSystemPtr filesystem_; |
| 156 | 153 |
| 157 // |directory_| is only bound after the first attempt to access the | 154 // |directory_| is only bound after the first attempt to access the |
| 158 // |filesystem. See OpenFilesystem(). | 155 // |filesystem. See OpenFilesystem(). |
| 159 DirectoryPtr directory_; | 156 DirectoryPtr directory_; |
| 160 | 157 |
| 161 FilePtr preferences_file_; | |
| 162 FilePtr temporary_file_; | |
| 163 | |
| 164 scoped_ptr<base::DictionaryValue> prefs_; | 158 scoped_ptr<base::DictionaryValue> prefs_; |
| 165 | 159 |
| 166 bool read_only_; | 160 bool read_only_; |
| 167 | 161 |
| 168 scoped_ptr<PrefFilter> pref_filter_; | 162 scoped_ptr<PrefFilter> pref_filter_; |
| 169 base::ObserverList<PrefStore::Observer, true> observers_; | 163 base::ObserverList<PrefStore::Observer, true> observers_; |
| 170 | 164 |
| 171 scoped_ptr<ReadErrorDelegate> error_delegate_; | 165 scoped_ptr<ReadErrorDelegate> error_delegate_; |
| 172 | 166 |
| 173 bool initialized_; | 167 bool initialized_; |
| 174 bool filtering_in_progress_; | 168 bool filtering_in_progress_; |
| 175 bool pending_lossy_write_; | 169 bool pending_lossy_write_; |
| 176 PrefReadError read_error_; | 170 PrefReadError read_error_; |
| 177 | 171 |
| 178 DISALLOW_COPY_AND_ASSIGN(FilesystemJsonPrefStore); | 172 DISALLOW_COPY_AND_ASSIGN(FilesystemJsonPrefStore); |
| 179 }; | 173 }; |
| 180 | 174 |
| 181 } // namespace filesystem | 175 } // namespace filesystem |
| 182 | 176 |
| 183 #endif // COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_FILESYSTEM_JSON_PREF_STORE_H_ | 177 #endif // COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_FILESYSTEM_JSON_PREF_STORE_H_ |
| OLD | NEW |