Index: content/common/background_fetch/background_fetch_struct_traits.cc |
diff --git a/content/common/background_fetch/background_fetch_struct_traits.cc b/content/common/background_fetch/background_fetch_struct_traits.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..50dd6d654cb5c7fbe5d9be00f462bd9c704a6514 |
--- /dev/null |
+++ b/content/common/background_fetch/background_fetch_struct_traits.cc |
@@ -0,0 +1,47 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/common/background_fetch/background_fetch_struct_traits.h" |
+ |
+#include "mojo/public/cpp/bindings/array_data_view.h" |
+ |
+namespace mojo { |
+ |
+// static |
+bool StructTraits<blink::mojom::BackgroundFetchOptionsDataView, |
+ content::BackgroundFetchOptions>:: |
+ Read(blink::mojom::BackgroundFetchOptionsDataView data, |
+ content::BackgroundFetchOptions* options) { |
+ if (!data.ReadIcons(&options->icons) || !data.ReadTitle(&options->title)) |
+ return false; |
+ |
+ options->total_download_size = data.total_download_size(); |
+ return true; |
+} |
+ |
+// static |
+bool StructTraits<blink::mojom::BackgroundFetchRegistrationDataView, |
+ content::BackgroundFetchRegistration>:: |
+ Read(blink::mojom::BackgroundFetchRegistrationDataView data, |
+ content::BackgroundFetchRegistration* registration) { |
+ if (!data.ReadTag(®istration->tag) || |
+ !data.ReadIcons(®istration->icons) || |
+ !data.ReadTitle(®istration->title)) { |
+ return false; |
+ } |
+ |
+ registration->total_download_size = data.total_download_size(); |
+ return true; |
+} |
+ |
+// static |
+bool StructTraits< |
+ blink::mojom::IconDefinitionDataView, |
+ content::IconDefinition>::Read(blink::mojom::IconDefinitionDataView data, |
+ content::IconDefinition* definition) { |
+ return data.ReadSrc(&definition->src) && data.ReadSizes(&definition->sizes) && |
+ data.ReadType(&definition->type); |
+} |
+ |
+} // namespace mojo |