proto_conversion.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2020 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_QUERY_TILES_INTERNAL_PROTO_CONVERSION_H_
  5. #define COMPONENTS_QUERY_TILES_INTERNAL_PROTO_CONVERSION_H_
  6. #include "components/query_tiles/internal/tile_group.h"
  7. #include "components/query_tiles/proto/tile.pb.h"
  8. #include "components/query_tiles/proto/tile_response.pb.h"
  9. #include "components/query_tiles/tile.h"
  10. namespace query_tiles {
  11. using ResponseGroupProto = query_tiles::proto::ServerResponse;
  12. using ResponseTileProto = query_tiles::proto::TileInfo;
  13. using TileProto = query_tiles::proto::Tile;
  14. using TileGroupProto = query_tiles::proto::TileGroup;
  15. // Converts a Tile to proto.
  16. void TileToProto(Tile* entry, TileProto* proto);
  17. // Converts a proto to Tile.
  18. void TileFromProto(TileProto* proto, Tile* entry);
  19. // Converts a TileGroup to proto.
  20. void TileGroupToProto(TileGroup* group, TileGroupProto* proto);
  21. // Converts a proto to TileGroup.
  22. void TileGroupFromProto(TileGroupProto* proto, TileGroup* group);
  23. // Converts ServerResponseProto to TileGroup.
  24. void TileGroupFromResponse(const ResponseGroupProto& response,
  25. TileGroup* tile_group);
  26. } // namespace query_tiles
  27. #endif // COMPONENTS_QUERY_TILES_INTERNAL_PROTO_CONVERSION_H_