pref_util.h 941 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2016 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 COMPONENTS_NTP_SNIPPETS_PREF_UTIL_H_
  5. #define COMPONENTS_NTP_SNIPPETS_PREF_UTIL_H_
  6. #include <set>
  7. #include <string>
  8. class PrefService;
  9. namespace ntp_snippets {
  10. namespace prefs {
  11. // Reads a given preference and then deserializes it into a set of strings.
  12. std::set<std::string> ReadDismissedIDsFromPrefs(const PrefService& pref_service,
  13. const std::string& pref_name);
  14. // Serializes a set of strings into a given preference.
  15. void StoreDismissedIDsToPrefs(PrefService* pref_service,
  16. const std::string& pref_name,
  17. const std::set<std::string>& dismissed_ids);
  18. } // namespace prefs
  19. } // namespace ntp_snippets
  20. #endif // COMPONENTS_NTP_SNIPPETS_PREF_UTIL_H_