reporting_browsing_data_remover.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2017 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_REPORTING_REPORTING_BROWSING_DATA_REMOVER_H_
  5. #define NET_REPORTING_REPORTING_BROWSING_DATA_REMOVER_H_
  6. #include "base/callback.h"
  7. #include "net/base/net_export.h"
  8. #include "url/origin.h"
  9. namespace net {
  10. class ReportingCache;
  11. // Clears browsing data (reports and clients) from the Reporting system.
  12. class NET_EXPORT ReportingBrowsingDataRemover {
  13. public:
  14. enum DataType {
  15. DATA_TYPE_REPORTS = 0x1,
  16. DATA_TYPE_CLIENTS = 0x2,
  17. };
  18. ReportingBrowsingDataRemover() = delete;
  19. ReportingBrowsingDataRemover(const ReportingBrowsingDataRemover&) = delete;
  20. ReportingBrowsingDataRemover& operator=(const ReportingBrowsingDataRemover&) =
  21. delete;
  22. // Removes browsing data from the Reporting system. |data_type_mask| specifies
  23. // which types of data to remove: reports queued by browser features and/or
  24. // clients (endpoints configured by origins). |origin_filter| specifies which
  25. // origins' data to remove.
  26. //
  27. // Note: Currently this does not clear the endpoint backoff data in
  28. // ReportingEndpointManager because that's not persisted to disk. If it's ever
  29. // persisted, it will need to be cleared as well.
  30. static void RemoveBrowsingData(
  31. ReportingCache* cache,
  32. uint64_t data_type_mask,
  33. const base::RepeatingCallback<bool(const url::Origin&)>& origin_filter);
  34. // Like RemoveBrowsingData except removes data for all origins without a
  35. // filter. Allows slight optimization over passing an always-true filter to
  36. // RemoveBrowsingData.
  37. static void RemoveAllBrowsingData(ReportingCache* cache,
  38. uint64_t data_type_mask);
  39. };
  40. } // namespace net
  41. #endif // NET_REPORTING_REPORTING_BROWSING_DATA_REMOVER_H_