OLD | NEW |
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 CHROME_BROWSER_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_ | 5 #ifndef CHROME_BROWSER_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_ |
6 #define CHROME_BROWSER_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_ | 6 #define CHROME_BROWSER_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // read-only state are the boolean OR of the underlying stores' properties. | 30 // read-only state are the boolean OR of the underlying stores' properties. |
31 class SegregatedPrefStore : public PersistentPrefStore { | 31 class SegregatedPrefStore : public PersistentPrefStore { |
32 public: | 32 public: |
33 // Creates an instance that delegates to |selected_pref_store| for the | 33 // Creates an instance that delegates to |selected_pref_store| for the |
34 // preferences named in |selected_pref_names| and to |default_pref_store| | 34 // preferences named in |selected_pref_names| and to |default_pref_store| |
35 // for all others. If an unselected preference is present in | 35 // for all others. If an unselected preference is present in |
36 // |selected_pref_store| (i.e. because it was previously selected) it will | 36 // |selected_pref_store| (i.e. because it was previously selected) it will |
37 // be migrated back to |default_pref_store| upon access via a non-const | 37 // be migrated back to |default_pref_store| upon access via a non-const |
38 // method. | 38 // method. |
39 // |on_initialization| will be invoked when both stores have been initialized, | 39 // |on_initialization| will be invoked when both stores have been initialized, |
40 // before observers of the combined store are notified. | 40 // before observers of the SegregatedPrefStore store are notified. |
41 SegregatedPrefStore( | 41 SegregatedPrefStore( |
42 const scoped_refptr<PersistentPrefStore>& default_pref_store, | 42 const scoped_refptr<PersistentPrefStore>& default_pref_store, |
43 const scoped_refptr<PersistentPrefStore>& selected_pref_store, | 43 const scoped_refptr<PersistentPrefStore>& selected_pref_store, |
44 const std::set<std::string>& selected_pref_names, | 44 const std::set<std::string>& selected_pref_names, |
45 const base::Closure& on_initialization); | 45 const base::Closure& on_initialization); |
46 | 46 |
47 // PrefStore implementation | 47 // PrefStore implementation |
48 virtual void AddObserver(Observer* observer) OVERRIDE; | 48 virtual void AddObserver(Observer* observer) OVERRIDE; |
49 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 49 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
50 virtual bool HasObservers() const OVERRIDE; | 50 virtual bool HasObservers() const OVERRIDE; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 base::Closure on_initialization_; | 105 base::Closure on_initialization_; |
106 | 106 |
107 scoped_ptr<PersistentPrefStore::ReadErrorDelegate> read_error_delegate_; | 107 scoped_ptr<PersistentPrefStore::ReadErrorDelegate> read_error_delegate_; |
108 ObserverList<PrefStore::Observer, true> observers_; | 108 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 // CHROME_BROWSER_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_ | 114 #endif // CHROME_BROWSER_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_ |
OLD | NEW |