tracked_preferences_migration.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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
  3. // found in the LICENSE file.
  4. #ifndef SERVICES_PREFERENCES_TRACKED_TRACKED_PREFERENCES_MIGRATION_H_
  5. #define SERVICES_PREFERENCES_TRACKED_TRACKED_PREFERENCES_MIGRATION_H_
  6. #include <memory>
  7. #include <set>
  8. #include <string>
  9. #include "base/callback_forward.h"
  10. #include "services/preferences/tracked/pref_hash_store.h"
  11. class InterceptablePrefFilter;
  12. class PrefHashStore;
  13. // Sets up InterceptablePrefFilter::FilterOnLoadInterceptors on
  14. // |unprotected_pref_filter| and |protected_pref_filter| which prevents each
  15. // filter from running their on load operations until the interceptors decide to
  16. // hand the prefs back to them (after migration is complete). |
  17. // (un)protected_store_cleaner| and
  18. // |register_on_successful_(un)protected_store_write_callback| are used to do
  19. // post-migration cleanup tasks. Those should be bound to weak pointers to avoid
  20. // blocking shutdown. |(un)protected_pref_hash_store| is used to migrate MACs
  21. // along with their protected preferences. Migrated MACs will only be cleared
  22. // from their old location in a subsequent run. The migration framework is
  23. // resilient to a failed cleanup (it will simply try again in the next Chrome
  24. // run).
  25. void SetupTrackedPreferencesMigration(
  26. const std::set<std::string>& unprotected_pref_names,
  27. const std::set<std::string>& protected_pref_names,
  28. const base::RepeatingCallback<void(const std::string& key)>&
  29. unprotected_store_cleaner,
  30. const base::RepeatingCallback<void(const std::string& key)>&
  31. protected_store_cleaner,
  32. const base::RepeatingCallback<void(base::OnceClosure)>&
  33. register_on_successful_unprotected_store_write_callback,
  34. const base::RepeatingCallback<void(base::OnceClosure)>&
  35. register_on_successful_protected_store_write_callback,
  36. std::unique_ptr<PrefHashStore> unprotected_pref_hash_store,
  37. std::unique_ptr<PrefHashStore> protected_pref_hash_store,
  38. InterceptablePrefFilter* unprotected_pref_filter,
  39. InterceptablePrefFilter* protected_pref_filter);
  40. #endif // SERVICES_PREFERENCES_TRACKED_TRACKED_PREFERENCES_MIGRATION_H_