tld_cleanup_util.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2013 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 NET_TOOLS_TLD_CLEANUP_TLD_CLEANUP_UTIL_H_
  5. #define NET_TOOLS_TLD_CLEANUP_TLD_CLEANUP_UTIL_H_
  6. #include <map>
  7. #include <string>
  8. namespace base {
  9. class FilePath;
  10. } // namespace base
  11. namespace net::tld_cleanup {
  12. struct Rule {
  13. bool exception;
  14. bool wildcard;
  15. bool is_private;
  16. };
  17. typedef std::map<std::string, Rule> RuleMap;
  18. // These result codes should be in increasing order of severity.
  19. typedef enum {
  20. kSuccess,
  21. kWarning,
  22. kError,
  23. } NormalizeResult;
  24. // Loads the file described by |in_filename|, converts it to the desired format
  25. // (see the file comments in tld_cleanup.cc), and saves it into |out_filename|.
  26. // Returns the most severe of the result codes encountered when normalizing the
  27. // rules.
  28. NormalizeResult NormalizeFile(const base::FilePath& in_filename,
  29. const base::FilePath& out_filename);
  30. // Parses |data|, and converts it to the internal data format RuleMap. Returns
  31. // the most severe of the result codes encountered when normalizing the rules.
  32. NormalizeResult NormalizeDataToRuleMap(const std::string data,
  33. RuleMap* rules);
  34. } // namespace net::tld_cleanup
  35. #endif // NET_TOOLS_TLD_CLEANUP_TLD_CLEANUP_UTIL_H_