OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_PREF_STORE_H_ | 5 #ifndef CHROME_COMMON_PREF_STORE_H_ |
6 #define CHROME_COMMON_PREF_STORE_H_ | 6 #define CHROME_COMMON_PREF_STORE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 static bool IsUseDefaultSentinelValue(Value* value); | 63 static bool IsUseDefaultSentinelValue(Value* value); |
64 | 64 |
65 PrefStore() {} | 65 PrefStore() {} |
66 virtual ~PrefStore() {} | 66 virtual ~PrefStore() {} |
67 | 67 |
68 // Add and remove observers. | 68 // Add and remove observers. |
69 virtual void AddObserver(ObserverInterface* observer) {} | 69 virtual void AddObserver(ObserverInterface* observer) {} |
70 virtual void RemoveObserver(ObserverInterface* observer) {} | 70 virtual void RemoveObserver(ObserverInterface* observer) {} |
71 | 71 |
72 // Whether the store has completed all asynchronous initialization. | 72 // Whether the store has completed all asynchronous initialization. |
73 virtual bool IsInitializationComplete() { return true; } | 73 virtual bool IsInitializationComplete(); |
74 | 74 |
75 // Whether the store is in a pseudo-read-only mode where changes are not | 75 // Whether the store is in a pseudo-read-only mode where changes are not |
76 // actually persisted to disk. This happens in some cases when there are | 76 // actually persisted to disk. This happens in some cases when there are |
77 // read errors during startup. | 77 // read errors during startup. |
78 virtual bool ReadOnly() const { return true; } | 78 virtual bool ReadOnly() const; |
79 | 79 |
80 // TODO(danno): PrefValueStore shouldn't allow direct access to the | 80 // TODO(danno): PrefValueStore shouldn't allow direct access to the |
81 // DictionaryValue. Instead, it should have getters that return a | 81 // DictionaryValue. Instead, it should have getters that return a |
82 // richer set of information for a pref, including if the store | 82 // richer set of information for a pref, including if the store |
83 // wants to return the default value for a preference. | 83 // wants to return the default value for a preference. |
84 virtual DictionaryValue* prefs() const = 0; | 84 virtual DictionaryValue* prefs() const = 0; |
85 | 85 |
86 virtual PrefReadError ReadPrefs() = 0; | 86 virtual PrefReadError ReadPrefs() = 0; |
87 | 87 |
88 virtual bool WritePrefs() { return true; } | 88 virtual bool WritePrefs(); |
89 | 89 |
90 virtual void ScheduleWritePrefs() { } | 90 virtual void ScheduleWritePrefs() { } |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(PrefStore); | 92 DISALLOW_COPY_AND_ASSIGN(PrefStore); |
93 }; | 93 }; |
94 | 94 |
95 #endif // CHROME_COMMON_PREF_STORE_H_ | 95 #endif // CHROME_COMMON_PREF_STORE_H_ |
OLD | NEW |