blob: 4546b8a48944790571154096d1648f0480563b36 [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"
Carlos Frias514cf672020-08-13 23:53:4311#include "chrome/browser/web_applications/proto/web_app.pb.h"
Alan Cuttereb525cd02020-06-20 03:12:4212#include "chrome/browser/web_applications/web_app.h"
13#include "components/sync/protocol/web_app_specifics.pb.h"
14
15namespace web_app {
16
Carlos Frias514cf672020-08-13 23:53:4317enum class RunOnOsLoginMode;
18
Alan Cuttereb525cd02020-06-20 03:12:4219using RepeatedIconInfosProto =
20 const ::google::protobuf::RepeatedPtrField<::sync_pb::WebAppIconInfo>;
21
22base::Optional<std::vector<WebApplicationIconInfo>> ParseWebAppIconInfos(
Alan Cutter1e6a3ac42020-06-24 05:04:1323 const char* container_name_for_logging,
Alan Cuttereb525cd02020-06-20 03:12:4224 RepeatedIconInfosProto icon_infos_proto);
25
Glen Robertson2c6387b2020-07-10 06:31:5926// Use the given |app| to populate a |WebAppSpecifics| sync proto.
27sync_pb::WebAppSpecifics WebAppToSyncProto(const WebApp& app);
28
Glen Robertson2585e8a92020-07-29 08:33:0829// Use the given |icon_info| to populate a |WebAppIconInfo| sync proto.
30sync_pb::WebAppIconInfo WebAppIconInfoToSyncProto(
31 const WebApplicationIconInfo& icon_info);
32
Alan Cutter40c10a62020-06-24 07:07:4633base::Optional<WebApp::SyncFallbackData> ParseSyncFallbackDataStruct(
Alan Cuttereb525cd02020-06-20 03:12:4234 const sync_pb::WebAppSpecifics& sync_proto);
35
Glen Robertson2c6387b2020-07-10 06:31:5936::sync_pb::WebAppSpecifics::UserDisplayMode ToWebAppSpecificsUserDisplayMode(
37 DisplayMode user_display_mode);
38
Carlos Frias514cf672020-08-13 23:53:4339RunOnOsLoginMode ToRunOnOsLoginMode(WebAppProto::RunOnOsLoginMode mode);
40
41WebAppProto::RunOnOsLoginMode ToWebAppProtoRunOnOsLoginMode(
42 RunOnOsLoginMode mode);
43
Alan Cuttereb525cd02020-06-20 03:12:4244} // namespace web_app
45
46#endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROTO_UTILS_H_