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_UI_WEBUI_NEARBY_SHARE_NEARBY_SHARE_MOJOM_TRAITS_H_
6 #define CHROME_BROWSER_UI_WEBUI_NEARBY_SHARE_NEARBY_SHARE_MOJOM_TRAITS_H_
7 
8 #include <string>
9 
10 #include "chrome/browser/nearby_sharing/share_target.h"
11 #include "chrome/browser/ui/webui/nearby_share/nearby_share.mojom.h"
12 #include "mojo/public/cpp/bindings/struct_traits.h"
13 
14 namespace mojo {
15 
16 template <>
17 struct StructTraits<nearby_share::mojom::ShareTargetDataView, ShareTarget> {
18   static base::UnguessableToken id(const ShareTarget& share_target);
19   static std::string name(const ShareTarget& share_target);
20   static nearby_share::mojom::ShareTargetType type(
21       const ShareTarget& share_target);
22   static bool Read(nearby_share::mojom::ShareTargetDataView data,
23                    ShareTarget* out);
24 };
25 
26 }  // namespace mojo
27 
28 #endif  // CHROME_BROWSER_UI_WEBUI_NEARBY_SHARE_NEARBY_SHARE_MOJOM_TRAITS_H_
29