logo_observer.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2014 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_SEARCH_PROVIDER_LOGOS_LOGO_OBSERVER_H_
  5. #define COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_OBSERVER_H_
  6. #include "components/search_provider_logos/logo_common.h"
  7. namespace search_provider_logos {
  8. // Receives updates when the search provider's logo is available.
  9. class LogoObserver {
  10. public:
  11. virtual ~LogoObserver() {}
  12. // Called when the cached logo is available and possibly when a freshly
  13. // downloaded logo is available. |logo| will be NULL if no logo is available.
  14. // |from_cache| indicates whether the logo was loaded from the cache.
  15. //
  16. // If the fresh logo is the same as the cached logo, this will not be called
  17. // again.
  18. virtual void OnLogoAvailable(const Logo* logo, bool from_cache) = 0;
  19. // Called when it has been determined from server that the cached logo (or
  20. // null) is still valid. This is independent from OnLogoAvailable and is
  21. // intended for users who need to take some action that can only happen when a
  22. // logo won't later change.
  23. // A no-op implementation is provided for users who don't care about this.
  24. virtual void OnCachedLogoRevalidated() {}
  25. // Called when the LogoService will no longer send updates to this
  26. // LogoObserver. For example: after the cached logo is validated, after
  27. // OnFreshLogoAvailable() is called, or when the LogoService is destructed.
  28. // This is not called when an observer is removed using RemoveObserver().
  29. virtual void OnObserverRemoved() = 0;
  30. };
  31. } // namespace search_provider_logos
  32. #endif // COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_OBSERVER_H_