OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_STRUCT_TRAITS_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_STRUCT_TRAITS_H_ |
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_STRUCT_TRAITS_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "content/common/background_fetch/background_fetch_types.h" | 11 #include "content/common/background_fetch/background_fetch_types.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" |
13 #include "mojo/public/cpp/bindings/struct_traits.h" | 14 #include "mojo/public/cpp/bindings/struct_traits.h" |
14 #include "third_party/WebKit/public/platform/modules/background_fetch/background
_fetch.mojom.h" | 15 #include "third_party/WebKit/public/platform/modules/background_fetch/background
_fetch.mojom.h" |
15 | 16 |
16 namespace mojo { | 17 namespace mojo { |
17 | 18 |
18 template <> | 19 template <> |
19 struct CONTENT_EXPORT StructTraits<blink::mojom::BackgroundFetchOptionsDataView, | 20 struct CONTENT_EXPORT StructTraits<blink::mojom::BackgroundFetchOptionsDataView, |
20 content::BackgroundFetchOptions> { | 21 content::BackgroundFetchOptions> { |
21 static const std::vector<content::IconDefinition>& icons( | 22 static const std::vector<content::IconDefinition>& icons( |
22 const content::BackgroundFetchOptions& options) { | 23 const content::BackgroundFetchOptions& options) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 static int64_t total_download_size( | 55 static int64_t total_download_size( |
55 const content::BackgroundFetchRegistration& registration) { | 56 const content::BackgroundFetchRegistration& registration) { |
56 return registration.total_download_size; | 57 return registration.total_download_size; |
57 } | 58 } |
58 | 59 |
59 static bool Read(blink::mojom::BackgroundFetchRegistrationDataView data, | 60 static bool Read(blink::mojom::BackgroundFetchRegistrationDataView data, |
60 content::BackgroundFetchRegistration* registration); | 61 content::BackgroundFetchRegistration* registration); |
61 }; | 62 }; |
62 | 63 |
63 template <> | 64 template <> |
| 65 struct CONTENT_EXPORT |
| 66 StructTraits<content::mojom::BackgroundFetchSettledFetchDataView, |
| 67 content::BackgroundFetchSettledFetch> { |
| 68 static const content::ServiceWorkerFetchRequest& request( |
| 69 const content::BackgroundFetchSettledFetch& fetch) { |
| 70 return fetch.request; |
| 71 } |
| 72 static const content::ServiceWorkerResponse& response( |
| 73 const content::BackgroundFetchSettledFetch& fetch) { |
| 74 return fetch.response; |
| 75 } |
| 76 |
| 77 static bool Read(content::mojom::BackgroundFetchSettledFetchDataView data, |
| 78 content::BackgroundFetchSettledFetch* definition); |
| 79 }; |
| 80 |
| 81 template <> |
64 struct CONTENT_EXPORT StructTraits<blink::mojom::IconDefinitionDataView, | 82 struct CONTENT_EXPORT StructTraits<blink::mojom::IconDefinitionDataView, |
65 content::IconDefinition> { | 83 content::IconDefinition> { |
66 static const std::string& src(const content::IconDefinition& definition) { | 84 static const std::string& src(const content::IconDefinition& definition) { |
67 return definition.src; | 85 return definition.src; |
68 } | 86 } |
69 static const std::string& sizes(const content::IconDefinition& definition) { | 87 static const std::string& sizes(const content::IconDefinition& definition) { |
70 return definition.sizes; | 88 return definition.sizes; |
71 } | 89 } |
72 static const std::string& type(const content::IconDefinition& definition) { | 90 static const std::string& type(const content::IconDefinition& definition) { |
73 return definition.type; | 91 return definition.type; |
74 } | 92 } |
75 | 93 |
76 static bool Read(blink::mojom::IconDefinitionDataView data, | 94 static bool Read(blink::mojom::IconDefinitionDataView data, |
77 content::IconDefinition* definition); | 95 content::IconDefinition* definition); |
78 }; | 96 }; |
79 | 97 |
80 } // namespace mojo | 98 } // namespace mojo |
81 | 99 |
82 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_STRUCT_TRAITS_H_ | 100 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_STRUCT_TRAITS_H_ |
OLD | NEW |