Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: components/user_prefs/tracked/segregated_pref_store.h

Issue 1908143002: Convert //components/user_prefs from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore the rightful glory of <windows.h> Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_USER_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_ 5 #ifndef COMPONENTS_USER_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_
6 #define COMPONENTS_USER_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_ 6 #define COMPONENTS_USER_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
10 #include <set> 11 #include <set>
11 #include <string> 12 #include <string>
12 13
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "components/prefs/persistent_pref_store.h" 18 #include "components/prefs/persistent_pref_store.h"
19 19
20 // Provides a unified PersistentPrefStore implementation that splits its storage 20 // Provides a unified PersistentPrefStore implementation that splits its storage
21 // and retrieval between two underlying PersistentPrefStore instances: a set of 21 // and retrieval between two underlying PersistentPrefStore instances: a set of
22 // preference names is used to partition the preferences. 22 // preference names is used to partition the preferences.
23 // 23 //
24 // Combines properties of the two stores as follows: 24 // Combines properties of the two stores as follows:
25 // * The unified read error will be: 25 // * The unified read error will be:
26 // Selected Store Error 26 // Selected Store Error
(...skipping 21 matching lines...) Expand all
48 // PrefStore implementation 48 // PrefStore implementation
49 void AddObserver(Observer* observer) override; 49 void AddObserver(Observer* observer) override;
50 void RemoveObserver(Observer* observer) override; 50 void RemoveObserver(Observer* observer) override;
51 bool HasObservers() const override; 51 bool HasObservers() const override;
52 bool IsInitializationComplete() const override; 52 bool IsInitializationComplete() const override;
53 bool GetValue(const std::string& key, 53 bool GetValue(const std::string& key,
54 const base::Value** result) const override; 54 const base::Value** result) const override;
55 55
56 // WriteablePrefStore implementation 56 // WriteablePrefStore implementation
57 void SetValue(const std::string& key, 57 void SetValue(const std::string& key,
58 scoped_ptr<base::Value> value, 58 std::unique_ptr<base::Value> value,
59 uint32_t flags) override; 59 uint32_t flags) override;
60 void RemoveValue(const std::string& key, uint32_t flags) override; 60 void RemoveValue(const std::string& key, uint32_t flags) override;
61 61
62 // PersistentPrefStore implementation 62 // PersistentPrefStore implementation
63 bool GetMutableValue(const std::string& key, base::Value** result) override; 63 bool GetMutableValue(const std::string& key, base::Value** result) override;
64 void ReportValueChanged(const std::string& key, uint32_t flags) override; 64 void ReportValueChanged(const std::string& key, uint32_t flags) override;
65 void SetValueSilently(const std::string& key, 65 void SetValueSilently(const std::string& key,
66 scoped_ptr<base::Value> value, 66 std::unique_ptr<base::Value> value,
67 uint32_t flags) override; 67 uint32_t flags) override;
68 bool ReadOnly() const override; 68 bool ReadOnly() const override;
69 PrefReadError GetReadError() const override; 69 PrefReadError GetReadError() const override;
70 PrefReadError ReadPrefs() override; 70 PrefReadError ReadPrefs() override;
71 void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override; 71 void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override;
72 void CommitPendingWrite() override; 72 void CommitPendingWrite() override;
73 void SchedulePendingLossyWrites() override; 73 void SchedulePendingLossyWrites() override;
74 74
75 void ClearMutableValues() override; 75 void ClearMutableValues() override;
76 76
(...skipping 20 matching lines...) Expand all
97 97
98 // Returns |selected_pref_store| if |key| is selected and |default_pref_store| 98 // Returns |selected_pref_store| if |key| is selected and |default_pref_store|
99 // otherwise. 99 // otherwise.
100 PersistentPrefStore* StoreForKey(const std::string& key); 100 PersistentPrefStore* StoreForKey(const std::string& key);
101 const PersistentPrefStore* StoreForKey(const std::string& key) const; 101 const PersistentPrefStore* StoreForKey(const std::string& key) const;
102 102
103 scoped_refptr<PersistentPrefStore> default_pref_store_; 103 scoped_refptr<PersistentPrefStore> default_pref_store_;
104 scoped_refptr<PersistentPrefStore> selected_pref_store_; 104 scoped_refptr<PersistentPrefStore> selected_pref_store_;
105 std::set<std::string> selected_preference_names_; 105 std::set<std::string> selected_preference_names_;
106 106
107 scoped_ptr<PersistentPrefStore::ReadErrorDelegate> read_error_delegate_; 107 std::unique_ptr<PersistentPrefStore::ReadErrorDelegate> read_error_delegate_;
108 base::ObserverList<PrefStore::Observer, true> observers_; 108 base::ObserverList<PrefStore::Observer, true> observers_;
109 AggregatingObserver aggregating_observer_; 109 AggregatingObserver aggregating_observer_;
110 110
111 DISALLOW_COPY_AND_ASSIGN(SegregatedPrefStore); 111 DISALLOW_COPY_AND_ASSIGN(SegregatedPrefStore);
112 }; 112 };
113 113
114 #endif // COMPONENTS_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_ 114 #endif // COMPONENTS_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698