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

Side by Side Diff: chrome/browser/prefs/tracked/segregated_pref_store.h

Issue 218583003: Separate storage for protected preferences into Protected Preferences file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments. Created 6 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 | Annotate | Revision Log
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 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"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/observer_list.h" 15 #include "base/observer_list.h"
16 #include "base/prefs/persistent_pref_store.h" 16 #include "base/prefs/persistent_pref_store.h"
17 17
18 // Provides a unified PersistentPrefStore implementation that splits its storage 18 // Provides a unified PersistentPrefStore implementation that splits its storage
19 // and retrieval between two underlying PersistentPrefStore instances: a set of 19 // and retrieval between two underlying PersistentPrefStore instances: a set of
20 // preference names is used to partition the preferences. 20 // preference names is used to partition the preferences.
21 //
22 // Combines properties of the two stores as follows:
23 // * The unified read error will be:
24 // Selected Store Error
25 // Default Store Error | NO_ERROR | NO_FILE | other selected |
26 // NO_ERROR | NO_ERROR | NO_ERROR | other selected |
27 // NO_FILE | NO_FILE | NO_FILE | NO_FILE |
28 // other default | other default | other default | other default |
29 // * The unified initialization success, initialization completion, and
30 // read-only state are the boolean OR of the underlying stores' properties.
21 class SegregatedPrefStore : public PersistentPrefStore { 31 class SegregatedPrefStore : public PersistentPrefStore {
22 public: 32 public:
23 // Creates an instance that delegates to |selected_pref_store| for the 33 // Creates an instance that delegates to |selected_pref_store| for the
24 // preferences named in |selected_pref_names| and to |default_pref_store| 34 // preferences named in |selected_pref_names| and to |default_pref_store|
25 // for all others. If an unselected preference is present in 35 // for all others. If an unselected preference is present in
26 // |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
27 // 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
28 // method. 38 // method.
29 // |on_initialization| will be invoked when both stores have been initialized, 39 // |on_initialization| will be invoked when both stores have been initialized,
30 // before observers of the combined store are notified. 40 // before observers of the combined store are notified.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 base::Closure on_initialization_; 105 base::Closure on_initialization_;
96 106
97 scoped_ptr<PersistentPrefStore::ReadErrorDelegate> read_error_delegate_; 107 scoped_ptr<PersistentPrefStore::ReadErrorDelegate> read_error_delegate_;
98 ObserverList<PrefStore::Observer, true> observers_; 108 ObserverList<PrefStore::Observer, true> observers_;
99 AggregatingObserver aggregating_observer_; 109 AggregatingObserver aggregating_observer_;
100 110
101 DISALLOW_COPY_AND_ASSIGN(SegregatedPrefStore); 111 DISALLOW_COPY_AND_ASSIGN(SegregatedPrefStore);
102 }; 112 };
103 113
104 #endif // CHROME_BROWSER_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_ 114 #endif // CHROME_BROWSER_PREFS_TRACKED_SEGREGATED_PREF_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698