summaryrefslogtreecommitdiffstats
path: root/content/child/background_sync/background_sync_type_converters.h
blob: bd7c1f1de1ea79cf755d49a43d44358094a17c19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright 2015 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.

#ifndef CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_TYPE_CONVERTERS_H_
#define CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_TYPE_CONVERTERS_H_

#include "base/memory/scoped_ptr.h"
#include "content/common/background_sync_service.mojom.h"
#include "content/common/content_export.h"
#include "mojo/public/cpp/bindings/type_converter.h"
#include "third_party/WebKit/public/platform/modules/background_sync/WebSyncError.h"
#include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegistration.h"
#include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerContextProxy.h"

namespace mojo {

// blink::WebSyncRegistration::NetworkState <=>
//     content::mojom::BackgroundSyncNetworkState

template <>
struct CONTENT_EXPORT
    TypeConverter<blink::WebSyncRegistration::NetworkState,
                  content::mojom::BackgroundSyncNetworkState> {
  static blink::WebSyncRegistration::NetworkState Convert(
      content::mojom::BackgroundSyncNetworkState input);
};

template <>
struct CONTENT_EXPORT TypeConverter<content::mojom::BackgroundSyncNetworkState,
                                    blink::WebSyncRegistration::NetworkState> {
  static content::mojom::BackgroundSyncNetworkState Convert(
      blink::WebSyncRegistration::NetworkState input);
};

// blink::WebSyncRegistration <=>
//     content::mojom::SyncRegistration

template <>
struct CONTENT_EXPORT TypeConverter<scoped_ptr<blink::WebSyncRegistration>,
                                    content::mojom::SyncRegistrationPtr> {
  static scoped_ptr<blink::WebSyncRegistration> Convert(
      const content::mojom::SyncRegistrationPtr& input);
};

template <>
struct CONTENT_EXPORT TypeConverter<content::mojom::SyncRegistrationPtr,
                                    blink::WebSyncRegistration> {
  static content::mojom::SyncRegistrationPtr Convert(
      const blink::WebSyncRegistration& input);
};

// blink::WebServiceWorkerContextProxy::LastChanceOption <=>
//    content::mojom::BackgroundSyncEventLastChance

template <>
struct CONTENT_EXPORT
    TypeConverter<blink::WebServiceWorkerContextProxy::LastChanceOption,
                  content::mojom::BackgroundSyncEventLastChance> {
  static blink::WebServiceWorkerContextProxy::LastChanceOption Convert(
      content::mojom::BackgroundSyncEventLastChance input);
};

template <>
struct CONTENT_EXPORT
    TypeConverter<content::mojom::BackgroundSyncEventLastChance,
                  blink::WebServiceWorkerContextProxy::LastChanceOption> {
  static content::mojom::BackgroundSyncEventLastChance Convert(
      blink::WebServiceWorkerContextProxy::LastChanceOption input);
};

}  // namespace mojo

#endif  // CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_TYPE_CONVERTERS_H_