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

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

Issue 324493002: Move preference MACs to the protected preference stores. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pull some stuff from Persistent to WriteablePrefStore. Created 6 years, 6 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_TRACKED_PREFERENCES_MIGRATION_H_ 5 #ifndef CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCES_MIGRATION_H_
6 #define CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCES_MIGRATION_H_ 6 #define CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCES_MIGRATION_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/memory/scoped_ptr.h"
12 13
13 class InterceptablePrefFilter; 14 namespace base {
15 class DictionaryValue;
16 } // namespace base
17
18 class PrefHashStore;
19
20 class TrackedPreferencesMigrationDelegate {
gab 2014/06/06 21:55:00 As mentioned before, I agree that this delegate ma
erikwright (departed) 2014/06/10 20:27:48 I found it preferable to adding an additional two
gab 2014/06/11 18:23:55 Agreed, except that for the sake of simplicity on
21 public:
22 virtual ~TrackedPreferencesMigrationDelegate() {}
23
24 typedef base::Callback<void(bool prefs_altered)> InterceptCompletionCallback;
25
26 // A callback to be invoked from FilterOnLoad. It takes ownership of prefs
27 // and may modify them before handing them back to this
28 // InterceptablePrefFilter via |finalize_filter_on_load|.
29 typedef base::Callback<
30 void(const InterceptCompletionCallback& completion_callback,
31 base::DictionaryValue* prefs)> Intercept;
32
33 virtual void CleanPreference(const std::string& key) = 0;
34 virtual void NotifyOnSuccessfulWrite(
35 const base::Closure& on_successful_write) = 0;
36 virtual void InterceptLoadedPreferences(const Intercept& intercept) = 0;
37 virtual PrefHashStore* GetPrefHashStore() = 0;
38 };
14 39
15 // Sets up InterceptablePrefFilter::FilterOnLoadInterceptors on 40 // Sets up InterceptablePrefFilter::FilterOnLoadInterceptors on
16 // |unprotected_pref_filter| and |protected_pref_filter| which prevents each 41 // |unprotected_pref_filter| and |protected_pref_filter| which prevents each
17 // filter from running their on load operations until the interceptors decide to 42 // filter from running their on load operations until the interceptors decide to
18 // hand the prefs back to them (after migration is complete). | 43 // hand the prefs back to them (after migration is complete). |
19 // (un)protected_store_cleaner| and 44 // (un)protected_store_cleaner| and
20 // |register_on_successful_(un)protected_store_write_callback| are used to do 45 // |register_on_successful_(un)protected_store_write_callback| are used to do
21 // post-migration cleanup tasks. Those should be bound to weak pointers to avoid 46 // post-migration cleanup tasks. Those should be bound to weak pointers to avoid
22 // blocking shutdown. The migration framework is resilient to a failed cleanup 47 // blocking shutdown. The migration framework is resilient to a failed cleanup
23 // (it will simply try again in the next Chrome run). 48 // (it will simply try again in the next Chrome run).
24 void SetupTrackedPreferencesMigration( 49 void SetupTrackedPreferencesMigration(
25 const std::set<std::string>& unprotected_pref_names, 50 const std::set<std::string>& unprotected_pref_names,
26 const std::set<std::string>& protected_pref_names, 51 const std::set<std::string>& protected_pref_names,
27 const base::Callback<void(const std::string& key)>& 52 scoped_ptr<TrackedPreferencesMigrationDelegate> unprotected_delegate,
28 unprotected_store_cleaner, 53 scoped_ptr<TrackedPreferencesMigrationDelegate> protected_delegate,
29 const base::Callback<void(const std::string& key)>& protected_store_cleaner, 54 scoped_ptr<PrefHashStore> legacy_pref_hash_store);
30 const base::Callback<void(const base::Closure&)>&
31 register_on_successful_unprotected_store_write_callback,
32 const base::Callback<void(const base::Closure&)>&
33 register_on_successful_protected_store_write_callback,
34 InterceptablePrefFilter* unprotected_pref_filter,
35 InterceptablePrefFilter* protected_pref_filter);
36 55
37 #endif // CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCES_MIGRATION_H_ 56 #endif // CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCES_MIGRATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698