desktop-pwas: Made BMO sync install equivalent to bookmark app sync install

This CL unifies the BMO sync install flow to match the existing bookmark
app sync install flow.
Main changes:
 - Instead of applying sync fallback values on install failure we prime
   the initial WebApplicationInfo with sync fallback values.
 - Generalise the "is app already syncing" check to be the same for
   bookmark apps and BMO by checking if an install task is pending or in
   progress with the expected app ID or app is already completed sync
   installation.
 - New fields "scope" and "icon infos" added to sync data and proto.
 - New utils for parsing WebAppSpecifics and WebAppIconInfoProtos.

This fixes an issue where if start_url sync install fails we weren't
attempting to just fetch icon URLs as a fallback with BMO enabled.

Bug: 1090227
Change-Id: I2e231c838cf0ab3a7a51b534bd8fb4cb12def726
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2251563
Commit-Queue: Alan Cutter <[email protected]>
Reviewed-by: Marc Treib <[email protected]>
Reviewed-by: Alexey Baskakov <[email protected]>
Cr-Commit-Position: refs/heads/master@{#780552}
diff --git a/chrome/browser/web_applications/web_app_proto_utils.h b/chrome/browser/web_applications/web_app_proto_utils.h
new file mode 100644
index 0000000..9b52f93
--- /dev/null
+++ b/chrome/browser/web_applications/web_app_proto_utils.h
@@ -0,0 +1,28 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROTO_UTILS_H_
+#define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROTO_UTILS_H_
+
+#include <vector>
+
+#include "base/optional.h"
+#include "chrome/browser/web_applications/web_app.h"
+#include "components/sync/protocol/web_app_specifics.pb.h"
+
+namespace web_app {
+
+using RepeatedIconInfosProto =
+    const ::google::protobuf::RepeatedPtrField<::sync_pb::WebAppIconInfo>;
+
+base::Optional<std::vector<WebApplicationIconInfo>> ParseWebAppIconInfos(
+    const char* outer_container_name,
+    RepeatedIconInfosProto icon_infos_proto);
+
+base::Optional<WebApp::SyncData> ParseWebAppSyncData(
+    const sync_pb::WebAppSpecifics& sync_proto);
+
+}  // namespace web_app
+
+#endif  // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROTO_UTILS_H_