url_list_manager.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2018 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_BLOCKED_CONTENT_URL_LIST_MANAGER_H_
  5. #define COMPONENTS_BLOCKED_CONTENT_URL_LIST_MANAGER_H_
  6. #include <stdint.h>
  7. #include "base/observer_list.h"
  8. class GURL;
  9. namespace blocked_content {
  10. // This class manages lists of blocked URLs in order to drive UI surfaces.
  11. // Currently it is used by the redirect / popup blocked UIs.
  12. //
  13. // TODO(csharrison): Currently this object is composed within the framebust /
  14. // popup tab helpers. Eventually those objects could be replaced almost entirely
  15. // by shared logic here.
  16. class UrlListManager {
  17. public:
  18. class Observer {
  19. public:
  20. virtual ~Observer() {}
  21. virtual void BlockedUrlAdded(int32_t id, const GURL& url) = 0;
  22. };
  23. UrlListManager();
  24. UrlListManager(const UrlListManager&) = delete;
  25. UrlListManager& operator=(const UrlListManager&) = delete;
  26. ~UrlListManager();
  27. void AddObserver(Observer* observer);
  28. void RemoveObserver(Observer* observer);
  29. void NotifyObservers(int32_t id, const GURL& url);
  30. private:
  31. base::ObserverList<Observer>::Unchecked observers_;
  32. };
  33. } // namespace blocked_content
  34. #endif // COMPONENTS_BLOCKED_CONTENT_URL_LIST_MANAGER_H_