download_db_conversions.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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_DOWNLOAD_DATABASE_DOWNLOAD_DB_CONVERSIONS_H_
  5. #define COMPONENTS_DOWNLOAD_DATABASE_DOWNLOAD_DB_CONVERSIONS_H_
  6. #include "components/download/database/download_db_entry.h"
  7. #include "components/download/database/download_info.h"
  8. #include "components/download/database/download_namespace.h"
  9. #include "components/download/database/in_progress/download_entry.h"
  10. #include "components/download/database/in_progress/in_progress_info.h"
  11. #include "components/download/database/in_progress/ukm_info.h"
  12. #include "components/download/database/proto/download_entry.pb.h"
  13. #include "components/download/database/proto/download_source.pb.h"
  14. namespace download {
  15. class DownloadDBConversions {
  16. public:
  17. static DownloadEntry DownloadEntryFromProto(
  18. const download_pb::DownloadEntry& proto);
  19. static download_pb::DownloadEntry DownloadEntryToProto(
  20. const DownloadEntry& entry);
  21. static DownloadSource DownloadSourceFromProto(
  22. download_pb::DownloadSource download_source);
  23. static download_pb::DownloadSource DownloadSourceToProto(
  24. DownloadSource download_source);
  25. static std::vector<DownloadEntry> DownloadEntriesFromProto(
  26. const download_pb::DownloadEntries& proto);
  27. static download_pb::DownloadEntries DownloadEntriesToProto(
  28. const std::vector<DownloadEntry>& entries);
  29. static download_pb::HttpRequestHeader HttpRequestHeaderToProto(
  30. const std::pair<std::string, std::string>& header);
  31. static std::pair<std::string, std::string> HttpRequestHeaderFromProto(
  32. const download_pb::HttpRequestHeader& proto);
  33. static download_pb::InProgressInfo InProgressInfoToProto(
  34. const InProgressInfo& in_progress_info);
  35. static InProgressInfo InProgressInfoFromProto(
  36. const download_pb::InProgressInfo& proto);
  37. static download_pb::UkmInfo UkmInfoToProto(const UkmInfo& ukm_info);
  38. static UkmInfo UkmInfoFromProto(const download_pb::UkmInfo& proto);
  39. static download_pb::DownloadInfo DownloadInfoToProto(
  40. const DownloadInfo& download_info);
  41. static DownloadInfo DownloadInfoFromProto(
  42. const download_pb::DownloadInfo& proto);
  43. static download_pb::DownloadDBEntry DownloadDBEntryToProto(
  44. const DownloadDBEntry& entry);
  45. static DownloadDBEntry DownloadDBEntryFromProto(
  46. const download_pb::DownloadDBEntry& proto);
  47. static DownloadDBEntry DownloadDBEntryFromDownloadEntry(
  48. const DownloadEntry& entry);
  49. };
  50. } // namespace download
  51. #endif // COMPONENTS_DOWNLOAD_DATABASE_DOWNLOAD_DB_CONVERSIONS_H_