Chromium Code Reviews| 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_JSON_PREF_STORE_H_ | 5 #ifndef CHROME_COMMON_JSON_PREF_STORE_H_ |
| 6 #define CHROME_COMMON_JSON_PREF_STORE_H_ | 6 #define CHROME_COMMON_JSON_PREF_STORE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 13 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 16 #include "chrome/common/important_file_writer.h" | 17 #include "chrome/common/important_file_writer.h" |
| 17 #include "chrome/common/persistent_pref_store.h" | 18 #include "chrome/common/persistent_pref_store.h" |
| 18 | 19 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 42 virtual size_t NumberOfObservers() const OVERRIDE; | 43 virtual size_t NumberOfObservers() const OVERRIDE; |
| 43 virtual bool IsInitializationComplete() const OVERRIDE; | 44 virtual bool IsInitializationComplete() const OVERRIDE; |
| 44 | 45 |
| 45 // PersistentPrefStore overrides: | 46 // PersistentPrefStore overrides: |
| 46 virtual ReadResult GetMutableValue(const std::string& key, | 47 virtual ReadResult GetMutableValue(const std::string& key, |
| 47 base::Value** result) OVERRIDE; | 48 base::Value** result) OVERRIDE; |
| 48 virtual void SetValue(const std::string& key, base::Value* value) OVERRIDE; | 49 virtual void SetValue(const std::string& key, base::Value* value) OVERRIDE; |
| 49 virtual void SetValueSilently(const std::string& key, | 50 virtual void SetValueSilently(const std::string& key, |
| 50 base::Value* value) OVERRIDE; | 51 base::Value* value) OVERRIDE; |
| 51 virtual void RemoveValue(const std::string& key) OVERRIDE; | 52 virtual void RemoveValue(const std::string& key) OVERRIDE; |
| 53 virtual void MarkNeedsEmptyValue(const std::string& key) OVERRIDE; | |
| 52 virtual bool ReadOnly() const OVERRIDE; | 54 virtual bool ReadOnly() const OVERRIDE; |
| 53 virtual PrefReadError GetReadError() const OVERRIDE; | 55 virtual PrefReadError GetReadError() const OVERRIDE; |
| 54 virtual PrefReadError ReadPrefs() OVERRIDE; | 56 virtual PrefReadError ReadPrefs() OVERRIDE; |
| 55 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) OVERRIDE; | 57 virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) OVERRIDE; |
| 56 virtual void CommitPendingWrite() OVERRIDE; | 58 virtual void CommitPendingWrite() OVERRIDE; |
| 57 virtual void ReportValueChanged(const std::string& key) OVERRIDE; | 59 virtual void ReportValueChanged(const std::string& key) OVERRIDE; |
| 58 | 60 |
| 59 // This method is called after JSON file has been read. Method takes | 61 // This method is called after JSON file has been read. Method takes |
| 60 // ownership of the |value| pointer. Note, this method is used with | 62 // ownership of the |value| pointer. Note, this method is used with |
| 61 // asynchronous file reading, so class exposes it only for the internal needs. | 63 // asynchronous file reading, so class exposes it only for the internal needs. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 76 // Helper for safely writing pref data. | 78 // Helper for safely writing pref data. |
| 77 ImportantFileWriter writer_; | 79 ImportantFileWriter writer_; |
| 78 | 80 |
| 79 ObserverList<PrefStore::Observer, true> observers_; | 81 ObserverList<PrefStore::Observer, true> observers_; |
| 80 | 82 |
| 81 scoped_ptr<ReadErrorDelegate> error_delegate_; | 83 scoped_ptr<ReadErrorDelegate> error_delegate_; |
| 82 | 84 |
| 83 bool initialized_; | 85 bool initialized_; |
| 84 PrefReadError read_error_; | 86 PrefReadError read_error_; |
| 85 | 87 |
| 88 std::set<std::string> keys_needs_empty_value_; | |
|
battre
2012/04/11 21:55:51
grammar: keys (plural) vs. needs (singular)
xiyuan
2012/04/11 22:36:46
Done.
| |
| 89 | |
| 86 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); | 90 DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); |
| 87 }; | 91 }; |
| 88 | 92 |
| 89 #endif // CHROME_COMMON_JSON_PREF_STORE_H_ | 93 #endif // CHROME_COMMON_JSON_PREF_STORE_H_ |
| OLD | NEW |