offline_page_visuals.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_OFFLINE_PAGES_CORE_OFFLINE_PAGE_VISUALS_H_
  5. #define COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_VISUALS_H_
  6. #include <stdint.h>
  7. #include <iosfwd>
  8. #include <string>
  9. #include "base/time/time.h"
  10. namespace offline_pages {
  11. // Visuals for an offline page. This maps to a row in the page_thumbnails
  12. // table.
  13. struct OfflinePageVisuals {
  14. public:
  15. OfflinePageVisuals();
  16. OfflinePageVisuals(int64_t offline_id,
  17. base::Time expiration,
  18. const std::string& thumbnail,
  19. const std::string& favicon);
  20. OfflinePageVisuals(const OfflinePageVisuals& other);
  21. OfflinePageVisuals(OfflinePageVisuals&& other);
  22. ~OfflinePageVisuals();
  23. OfflinePageVisuals& operator=(const OfflinePageVisuals& other) = default;
  24. bool operator==(const OfflinePageVisuals& other) const;
  25. bool operator<(const OfflinePageVisuals& other) const;
  26. std::string ToString() const;
  27. // The primary key/ID for the page in offline pages internal database.
  28. int64_t offline_id = 0;
  29. // The time at which the visuals can be removed from the table, but only
  30. // if the offline_id does not match an offline_id in the offline pages table.
  31. base::Time expiration;
  32. // The thumbnail raw image data.
  33. std::string thumbnail;
  34. // The favicon raw image data.
  35. std::string favicon;
  36. };
  37. std::ostream& operator<<(std::ostream& out, const OfflinePageVisuals& visuals);
  38. } // namespace offline_pages
  39. #endif // COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_VISUALS_H_