OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 CONTENT_COMMON_PUSH_MESSAGING_PARAM_TRAITS_H_ |
| 6 #define CONTENT_COMMON_PUSH_MESSAGING_PARAM_TRAITS_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 |
| 10 #include "content/common/push_messaging.mojom.h" |
| 11 #include "mojo/public/cpp/bindings/struct_traits.h" |
| 12 |
| 13 namespace mojo { |
| 14 |
| 15 template <> |
| 16 struct StructTraits<content::mojom::PushSubscriptionOptionsDataView, |
| 17 content::PushSubscriptionOptions> { |
| 18 static bool user_visible_only(const content::PushSubscriptionOptions& r) { |
| 19 return r.user_visible_only; |
| 20 } |
| 21 static const std::string& sender_info( |
| 22 const content::PushSubscriptionOptions& r) { |
| 23 return r.sender_info; |
| 24 } |
| 25 static bool Read(content::mojom::PushSubscriptionOptionsDataView data, |
| 26 content::PushSubscriptionOptions* out); |
| 27 }; |
| 28 |
| 29 template <> |
| 30 struct EnumTraits<content::mojom::PushRegistrationStatus, |
| 31 content::PushRegistrationStatus> { |
| 32 static content::mojom::PushRegistrationStatus ToMojom( |
| 33 content::PushRegistrationStatus input); |
| 34 static bool FromMojom(content::mojom::PushRegistrationStatus input, |
| 35 content::PushRegistrationStatus* output); |
| 36 }; |
| 37 |
| 38 template <> |
| 39 struct EnumTraits<content::mojom::PushErrorType, |
| 40 blink::WebPushError::ErrorType> { |
| 41 static content::mojom::PushErrorType ToMojom( |
| 42 blink::WebPushError::ErrorType input); |
| 43 static bool FromMojom(content::mojom::PushErrorType input, |
| 44 blink::WebPushError::ErrorType* output); |
| 45 }; |
| 46 |
| 47 template <> |
| 48 struct EnumTraits<content::mojom::PushGetRegistrationStatus, |
| 49 content::PushGetRegistrationStatus> { |
| 50 static content::mojom::PushGetRegistrationStatus ToMojom( |
| 51 content::PushGetRegistrationStatus input); |
| 52 static bool FromMojom(content::mojom::PushGetRegistrationStatus input, |
| 53 content::PushGetRegistrationStatus* output); |
| 54 }; |
| 55 |
| 56 template <> |
| 57 struct EnumTraits<content::mojom::PushPermissionStatus, |
| 58 blink::WebPushPermissionStatus> { |
| 59 static content::mojom::PushPermissionStatus ToMojom( |
| 60 blink::WebPushPermissionStatus input); |
| 61 static bool FromMojom(content::mojom::PushPermissionStatus input, |
| 62 blink::WebPushPermissionStatus* output); |
| 63 }; |
| 64 |
| 65 } // namespace mojo |
| 66 |
| 67 #endif // CONTENT_COMMON_PUSH_MESSAGING_PARAM_TRAITS_H_ |
OLD | NEW |