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_COMMON_PERSISTENT_PREF_STORE_H_ | 5 #ifndef CHROME_COMMON_PERSISTENT_PREF_STORE_H_ |
6 #define CHROME_COMMON_PERSISTENT_PREF_STORE_H_ | 6 #define CHROME_COMMON_PERSISTENT_PREF_STORE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include <chrome/common/pref_store.h> | 11 #include <chrome/common/pref_store.h> |
12 | 12 |
13 // This interface is complementary to the PrefStore interface, declaring | 13 // This interface is complementary to the PrefStore interface, declaring |
14 // additional functionality that adds support for setting values and persisting | 14 // additional functionality that adds support for setting values and persisting |
15 // the data to some backing store. | 15 // the data to some backing store. |
16 class PersistentPrefStore : public PrefStore { | 16 class PersistentPrefStore : public PrefStore { |
17 public: | 17 public: |
18 virtual ~PersistentPrefStore() {} | |
19 | |
20 // Unique integer code for each type of error so we can report them | 18 // Unique integer code for each type of error so we can report them |
21 // distinctly in a histogram. | 19 // distinctly in a histogram. |
22 // NOTE: Don't change the order here as it will change the server's meaning | 20 // NOTE: Don't change the order here as it will change the server's meaning |
23 // of the histogram. | 21 // of the histogram. |
24 enum PrefReadError { | 22 enum PrefReadError { |
25 PREF_READ_ERROR_NONE = 0, | 23 PREF_READ_ERROR_NONE = 0, |
26 PREF_READ_ERROR_JSON_PARSE, | 24 PREF_READ_ERROR_JSON_PARSE, |
27 PREF_READ_ERROR_JSON_TYPE, | 25 PREF_READ_ERROR_JSON_TYPE, |
28 PREF_READ_ERROR_ACCESS_DENIED, | 26 PREF_READ_ERROR_ACCESS_DENIED, |
29 PREF_READ_ERROR_FILE_OTHER, | 27 PREF_READ_ERROR_FILE_OTHER, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 virtual PrefReadError ReadPrefs() = 0; | 80 virtual PrefReadError ReadPrefs() = 0; |
83 | 81 |
84 // Reads the preferences from disk asynchronously. Notifies observers via | 82 // Reads the preferences from disk asynchronously. Notifies observers via |
85 // "PrefStore::OnInitializationCompleted" when done. Also it fires | 83 // "PrefStore::OnInitializationCompleted" when done. Also it fires |
86 // |error_delegate| if it is not NULL and reading error has occurred. | 84 // |error_delegate| if it is not NULL and reading error has occurred. |
87 // Owns |error_delegate|. | 85 // Owns |error_delegate|. |
88 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) = 0; | 86 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) = 0; |
89 | 87 |
90 // Lands any pending writes to disk. | 88 // Lands any pending writes to disk. |
91 virtual void CommitPendingWrite() = 0; | 89 virtual void CommitPendingWrite() = 0; |
| 90 |
| 91 protected: |
| 92 virtual ~PersistentPrefStore() {} |
92 }; | 93 }; |
93 | 94 |
94 #endif // CHROME_COMMON_PERSISTENT_PREF_STORE_H_ | 95 #endif // CHROME_COMMON_PERSISTENT_PREF_STORE_H_ |
OLD | NEW |