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 #include "content/common/background_fetch/background_fetch_struct_traits.h" |
| 6 |
| 7 #include "mojo/public/cpp/bindings/array_data_view.h" |
| 8 |
| 9 namespace mojo { |
| 10 |
| 11 // static |
| 12 bool StructTraits<blink::mojom::BackgroundFetchOptionsDataView, |
| 13 content::BackgroundFetchOptions>:: |
| 14 Read(blink::mojom::BackgroundFetchOptionsDataView data, |
| 15 content::BackgroundFetchOptions* options) { |
| 16 if (!data.ReadIcons(&options->icons) || !data.ReadTitle(&options->title)) |
| 17 return false; |
| 18 |
| 19 options->total_download_size = data.total_download_size(); |
| 20 return true; |
| 21 } |
| 22 |
| 23 // static |
| 24 bool StructTraits<blink::mojom::BackgroundFetchRegistrationDataView, |
| 25 content::BackgroundFetchRegistration>:: |
| 26 Read(blink::mojom::BackgroundFetchRegistrationDataView data, |
| 27 content::BackgroundFetchRegistration* registration) { |
| 28 if (!data.ReadTag(®istration->tag) || |
| 29 !data.ReadIcons(®istration->icons) || |
| 30 !data.ReadTitle(®istration->title)) { |
| 31 return false; |
| 32 } |
| 33 |
| 34 registration->total_download_size = data.total_download_size(); |
| 35 return true; |
| 36 } |
| 37 |
| 38 // static |
| 39 bool StructTraits< |
| 40 blink::mojom::IconDefinitionDataView, |
| 41 content::IconDefinition>::Read(blink::mojom::IconDefinitionDataView data, |
| 42 content::IconDefinition* definition) { |
| 43 return data.ReadSrc(&definition->src) && data.ReadSizes(&definition->sizes) && |
| 44 data.ReadType(&definition->type); |
| 45 } |
| 46 |
| 47 } // namespace mojo |
OLD | NEW |