opt_out_blocklist_delegate.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 COMPONENTS_BLOCKLIST_OPT_OUT_BLOCKLIST_OPT_OUT_BLOCKLIST_DELEGATE_H_
  5. #define COMPONENTS_BLOCKLIST_OPT_OUT_BLOCKLIST_OPT_OUT_BLOCKLIST_DELEGATE_H_
  6. #include <string>
  7. #include "base/time/time.h"
  8. namespace blocklist {
  9. // An interface for a delegate to the opt out blocklist. This interface is for
  10. // responding to events occurring in the opt out blocklist (e.g. New blocklisted
  11. // host and user is blocklisted).
  12. class OptOutBlocklistDelegate {
  13. public:
  14. OptOutBlocklistDelegate() = default;
  15. virtual ~OptOutBlocklistDelegate() = default;
  16. // Notifies |this| that |host| has been blocklisted at |time|. This method is
  17. // guaranteed to be called when a previously allowlisted host is now
  18. // blocklisted.
  19. virtual void OnNewBlocklistedHost(const std::string& host, base::Time time) {}
  20. // Notifies |this| that the user blocklisted has changed, and it is
  21. // guaranteed to be called when the user blocklisted status is changed.
  22. virtual void OnUserBlocklistedStatusChange(bool blocklisted) {}
  23. // Notifies |this| the blocklist loaded state changed to |is_loaded|.
  24. virtual void OnLoadingStateChanged(bool is_loaded) {}
  25. // Notifies |this| that the blocklist is cleared at |time|.
  26. virtual void OnBlocklistCleared(base::Time time) {}
  27. };
  28. } // namespace blocklist
  29. #endif // COMPONENTS_BLOCKLIST_OPT_OUT_BLOCKLIST_OPT_OUT_BLOCKLIST_DELEGATE_H_