Saving and reading home tab icons to proto

Icons for the home tab within the tab strip specified in the manifest are saved (without filtering) through proto. Icons are saved as ImageResource, keeping the same shape it is set as in the manifest.

Change-Id: I2cce28fc171e2fc238cf2bc8fdc4205a2b6a0fd2
Bug: 1381377
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4136334
Reviewed-by: Peter Beverloo <[email protected]>
Reviewed-by: Eric Willigers <[email protected]>
Commit-Queue: Eric Willigers <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1094699}
diff --git a/chrome/browser/web_applications/web_app_proto_utils.h b/chrome/browser/web_applications/web_app_proto_utils.h
index 1a480b22..a07227e 100644
--- a/chrome/browser/web_applications/web_app_proto_utils.h
+++ b/chrome/browser/web_applications/web_app_proto_utils.h
@@ -10,6 +10,7 @@
 #include "chrome/browser/web_applications/proto/web_app.pb.h"
 #include "chrome/browser/web_applications/web_app.h"
 #include "components/sync/protocol/web_app_specifics.pb.h"
+#include "content/browser/background_fetch/background_fetch.pb.h"
 #include "third_party/abseil-cpp/absl/types/optional.h"
 
 namespace apps {
@@ -23,16 +24,27 @@
 using RepeatedIconInfosProto =
     const ::google::protobuf::RepeatedPtrField<::sync_pb::WebAppIconInfo>;
 
+using RepeatedImageResourceProto =
+    const ::google::protobuf::RepeatedPtrField<content::proto::ImageResource>;
+
 absl::optional<std::vector<apps::IconInfo>> ParseAppIconInfos(
     const char* container_name_for_logging,
     const RepeatedIconInfosProto& manifest_icons_proto);
 
+absl::optional<std::vector<blink::Manifest::ImageResource>>
+ParseAppImageResource(const char* container_name_for_logging,
+                      const RepeatedImageResourceProto& manifest_icons_proto);
+
 // Use the given |app| to populate a |WebAppSpecifics| sync proto.
 sync_pb::WebAppSpecifics WebAppToSyncProto(const WebApp& app);
 
 // Use the given |icon_info| to populate a |WebAppIconInfo| sync proto.
 sync_pb::WebAppIconInfo AppIconInfoToSyncProto(const apps::IconInfo& icon_info);
 
+// Use the given |image_resource| to populate a |ImageResource| proto.
+content::proto::ImageResource AppImageResourceToProto(
+    const blink::Manifest::ImageResource& image_resource);
+
 absl::optional<WebApp::SyncFallbackData> ParseSyncFallbackDataStruct(
     const sync_pb::WebAppSpecifics& sync_proto);