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_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_STRUCT_TRAITS_H_ |
| 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_STRUCT_TRAITS_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "content/common/background_fetch/background_fetch_types.h" |
| 12 #include "content/common/content_export.h" |
| 13 #include "mojo/public/cpp/bindings/struct_traits.h" |
| 14 #include "third_party/WebKit/public/platform/modules/background_fetch/background
_fetch.mojom.h" |
| 15 |
| 16 namespace mojo { |
| 17 |
| 18 template <> |
| 19 struct CONTENT_EXPORT StructTraits<blink::mojom::BackgroundFetchOptionsDataView, |
| 20 content::BackgroundFetchOptions> { |
| 21 static const std::vector<content::IconDefinition>& icons( |
| 22 const content::BackgroundFetchOptions& options) { |
| 23 return options.icons; |
| 24 } |
| 25 static const std::string& title( |
| 26 const content::BackgroundFetchOptions& options) { |
| 27 return options.title; |
| 28 } |
| 29 static int64_t total_download_size( |
| 30 const content::BackgroundFetchOptions& options) { |
| 31 return options.total_download_size; |
| 32 } |
| 33 |
| 34 static bool Read(blink::mojom::BackgroundFetchOptionsDataView data, |
| 35 content::BackgroundFetchOptions* options); |
| 36 }; |
| 37 |
| 38 template <> |
| 39 struct CONTENT_EXPORT |
| 40 StructTraits<blink::mojom::BackgroundFetchRegistrationDataView, |
| 41 content::BackgroundFetchRegistration> { |
| 42 static const std::string& tag( |
| 43 const content::BackgroundFetchRegistration& registration) { |
| 44 return registration.tag; |
| 45 } |
| 46 static const std::vector<content::IconDefinition>& icons( |
| 47 const content::BackgroundFetchRegistration& registration) { |
| 48 return registration.icons; |
| 49 } |
| 50 static const std::string& title( |
| 51 const content::BackgroundFetchRegistration& registration) { |
| 52 return registration.title; |
| 53 } |
| 54 static int64_t total_download_size( |
| 55 const content::BackgroundFetchRegistration& registration) { |
| 56 return registration.total_download_size; |
| 57 } |
| 58 |
| 59 static bool Read(blink::mojom::BackgroundFetchRegistrationDataView data, |
| 60 content::BackgroundFetchRegistration* registration); |
| 61 }; |
| 62 |
| 63 template <> |
| 64 struct CONTENT_EXPORT StructTraits<blink::mojom::IconDefinitionDataView, |
| 65 content::IconDefinition> { |
| 66 static const std::string& src(const content::IconDefinition& definition) { |
| 67 return definition.src; |
| 68 } |
| 69 static const std::string& sizes(const content::IconDefinition& definition) { |
| 70 return definition.sizes; |
| 71 } |
| 72 static const std::string& type(const content::IconDefinition& definition) { |
| 73 return definition.type; |
| 74 } |
| 75 |
| 76 static bool Read(blink::mojom::IconDefinitionDataView data, |
| 77 content::IconDefinition* definition); |
| 78 }; |
| 79 |
| 80 } // namespace mojo |
| 81 |
| 82 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_STRUCT_TRAITS_H_ |
OLD | NEW |