Alan Cutter | eb525cd0 | 2020-06-20 03:12:42 | [diff] [blame] | 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 | |
| 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 | |
| 14 | namespace web_app { |
| 15 | |
| 16 | using RepeatedIconInfosProto = |
| 17 | const ::google::protobuf::RepeatedPtrField<::sync_pb::WebAppIconInfo>; |
| 18 | |
| 19 | base::Optional<std::vector<WebApplicationIconInfo>> ParseWebAppIconInfos( |
Alan Cutter | 1e6a3ac4 | 2020-06-24 05:04:13 | [diff] [blame] | 20 | const char* container_name_for_logging, |
Alan Cutter | eb525cd0 | 2020-06-20 03:12:42 | [diff] [blame] | 21 | RepeatedIconInfosProto icon_infos_proto); |
| 22 | |
Glen Robertson | 2c6387b | 2020-07-10 06:31:59 | [diff] [blame] | 23 | // Use the given |app| to populate a |WebAppSpecifics| sync proto. |
| 24 | sync_pb::WebAppSpecifics WebAppToSyncProto(const WebApp& app); |
| 25 | |
Glen Robertson | 2585e8a9 | 2020-07-29 08:33:08 | [diff] [blame^] | 26 | // Use the given |icon_info| to populate a |WebAppIconInfo| sync proto. |
| 27 | sync_pb::WebAppIconInfo WebAppIconInfoToSyncProto( |
| 28 | const WebApplicationIconInfo& icon_info); |
| 29 | |
Alan Cutter | 40c10a6 | 2020-06-24 07:07:46 | [diff] [blame] | 30 | base::Optional<WebApp::SyncFallbackData> ParseSyncFallbackDataStruct( |
Alan Cutter | eb525cd0 | 2020-06-20 03:12:42 | [diff] [blame] | 31 | const sync_pb::WebAppSpecifics& sync_proto); |
| 32 | |
Glen Robertson | 2c6387b | 2020-07-10 06:31:59 | [diff] [blame] | 33 | ::sync_pb::WebAppSpecifics::UserDisplayMode ToWebAppSpecificsUserDisplayMode( |
|
|