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 "mojo/public/cpp/bindings/struct_traits.h" | 13 #include "mojo/public/cpp/bindings/struct_traits.h" |
14 #include "third_party/WebKit/public/platform/modules/background_fetch/background
_fetch.mojom.h" | 14 #include "third_party/WebKit/public/platform/modules/background_fetch/background
_fetch.mojom.h" |
15 | 15 |
| 16 namespace content { |
| 17 namespace mojom { |
| 18 class BackgroundFetchSettledFetchDataView; |
| 19 } |
| 20 } |
| 21 |
16 namespace mojo { | 22 namespace mojo { |
17 | 23 |
18 template <> | 24 template <> |
19 struct CONTENT_EXPORT StructTraits<blink::mojom::BackgroundFetchOptionsDataView, | 25 struct CONTENT_EXPORT StructTraits<blink::mojom::BackgroundFetchOptionsDataView, |
20 content::BackgroundFetchOptions> { | 26 content::BackgroundFetchOptions> { |
21 static const std::vector<content::IconDefinition>& icons( | 27 static const std::vector<content::IconDefinition>& icons( |
22 const content::BackgroundFetchOptions& options) { | 28 const content::BackgroundFetchOptions& options) { |
23 return options.icons; | 29 return options.icons; |
24 } | 30 } |
25 static const std::string& title( | 31 static const std::string& title( |
(...skipping 28 matching lines...) Expand all Loading... |
54 static int64_t total_download_size( | 60 static int64_t total_download_size( |
55 const content::BackgroundFetchRegistration& registration) { | 61 const content::BackgroundFetchRegistration& registration) { |
56 return registration.total_download_size; | 62 return registration.total_download_size; |
57 } | 63 } |
58 | 64 |
59 static bool Read(blink::mojom::BackgroundFetchRegistrationDataView data, | 65 static bool Read(blink::mojom::BackgroundFetchRegistrationDataView data, |
60 content::BackgroundFetchRegistration* registration); | 66 content::BackgroundFetchRegistration* registration); |
61 }; | 67 }; |
62 | 68 |
63 template <> | 69 template <> |
| 70 struct CONTENT_EXPORT |
| 71 StructTraits<content::mojom::BackgroundFetchSettledFetchDataView, |
| 72 content::BackgroundFetchSettledFetch> { |
| 73 static const content::ServiceWorkerFetchRequest& request( |
| 74 const content::BackgroundFetchSettledFetch& fetch) { |
| 75 return fetch.request; |
| 76 } |
| 77 static const content::ServiceWorkerResponse& response( |
| 78 const content::BackgroundFetchSettledFetch& fetch) { |
| 79 return fetch.response; |
| 80 } |
| 81 |
| 82 static bool Read(content::mojom::BackgroundFetchSettledFetchDataView data, |
| 83 content::BackgroundFetchSettledFetch* definition); |
| 84 }; |
| 85 |
| 86 template <> |
64 struct CONTENT_EXPORT StructTraits<blink::mojom::IconDefinitionDataView, | 87 struct CONTENT_EXPORT StructTraits<blink::mojom::IconDefinitionDataView, |
65 content::IconDefinition> { | 88 content::IconDefinition> { |
66 static const std::string& src(const content::IconDefinition& definition) { | 89 static const std::string& src(const content::IconDefinition& definition) { |
67 return definition.src; | 90 return definition.src; |
68 } | 91 } |
69 static const std::string& sizes(const content::IconDefinition& definition) { | 92 static const std::string& sizes(const content::IconDefinition& definition) { |
70 return definition.sizes; | 93 return definition.sizes; |
71 } | 94 } |
72 static const std::string& type(const content::IconDefinition& definition) { | 95 static const std::string& type(const content::IconDefinition& definition) { |
73 return definition.type; | 96 return definition.type; |
74 } | 97 } |
75 | 98 |
76 static bool Read(blink::mojom::IconDefinitionDataView data, | 99 static bool Read(blink::mojom::IconDefinitionDataView data, |
77 content::IconDefinition* definition); | 100 content::IconDefinition* definition); |
78 }; | 101 }; |
79 | 102 |
80 } // namespace mojo | 103 } // namespace mojo |
81 | 104 |
82 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_STRUCT_TRAITS_H_ | 105 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_STRUCT_TRAITS_H_ |
OLD | NEW |