blob: 89afccd827957efa5b76ba0ff7adfd727223c120 [file] [log] [blame]
Alan Cuttereb525cd02020-06-20 03:12:421// 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
5#ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROTO_UTILS_H_
6#define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROTO_UTILS_H_
7
8#include <vector>
9
10#include "base/optional.h"
11#include "chrome/browser/web_applications/web_app.h"
12#include "components/sync/protocol/web_app_specifics.pb.h"
13
14namespace web_app {
15
16using RepeatedIconInfosProto =
17 const ::google::protobuf::RepeatedPtrField<::sync_pb::WebAppIconInfo>;
18
19base::Optional<std::vector<WebApplicationIconInfo>> ParseWebAppIconInfos(
Alan Cutter1e6a3ac42020-06-24 05:04:1320 const char* container_name_for_logging,
Alan Cuttereb525cd02020-06-20 03:12:4221 RepeatedIconInfosProto icon_infos_proto);
22
Glen Robertson2c6387b2020-07-10 06:31:5923// Use the given |app| to populate a |WebAppSpecifics| sync proto.
24sync_pb::WebAppSpecifics WebAppToSyncProto(const WebApp& app);
25
Glen Robertson2585e8a92020-07-29 08:33:0826// Use the given |icon_info| to populate a |WebAppIconInfo| sync proto.
27sync_pb::WebAppIconInfo WebAppIconInfoToSyncProto(
28 const WebApplicationIconInfo& icon_info);
29
Alan Cutter40c10a62020-06-24 07:07:4630base::Optional<WebApp::SyncFallbackData> ParseSyncFallbackDataStruct(
Alan Cuttereb525cd02020-06-20 03:12:4231 const sync_pb::WebAppSpecifics& sync_proto);
32
Glen Robertson2c6387b2020-07-10 06:31:5933::sync_pb::WebAppSpecifics::UserDisplayMode ToWebAppSpecificsUserDisplayMode(