Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(913)

Side by Side Diff: content/common/background_fetch/background_fetch_struct_traits.cc

Issue 2762573003: Implement BackgroundFetchManager.fetch() and struct traits (Closed)
Patch Set: First round of comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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(&registration->tag) ||
29 !data.ReadIcons(&registration->icons) ||
30 !data.ReadTitle(&registration->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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698