summaryrefslogtreecommitdiffstats
path: root/content/renderer/background_sync/background_sync_client_impl.h
blob: d977ff12b0c4ca685314b955eefafe29d41b2ac8 (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
// 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_RENDERER_BACKGROUND_SYNC_BACKGROUND_SYNC_CLIENT_IMPL_H_
#define CONTENT_RENDERER_BACKGROUND_SYNC_BACKGROUND_SYNC_CLIENT_IMPL_H_

#include <stdint.h>

#include <map>

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "content/common/background_sync_service.mojom.h"
#include "content/common/content_export.h"
#include "mojo/public/cpp/bindings/strong_binding.h"

namespace content {

class CONTENT_EXPORT BackgroundSyncClientImpl
    : public NON_EXPORTED_BASE(mojom::BackgroundSyncServiceClient) {
 public:
  static void Create(
      mojo::InterfaceRequest<mojom::BackgroundSyncServiceClient> request);

  ~BackgroundSyncClientImpl() override;

 private:
  using SyncCallback = mojo::Callback<void(mojom::ServiceWorkerEventStatus)>;
  explicit BackgroundSyncClientImpl(
      mojo::InterfaceRequest<mojom::BackgroundSyncServiceClient> request);

  // BackgroundSyncServiceClient methods:
  void Sync(const mojo::String& tag,
            content::mojom::BackgroundSyncEventLastChance last_chance,
            const SyncCallback& callback) override;

  mojo::StrongBinding<mojom::BackgroundSyncServiceClient> binding_;

  DISALLOW_COPY_AND_ASSIGN(BackgroundSyncClientImpl);
};

}  // namespace content

#endif  // CONTENT_RENDERER_BACKGROUND_SYNC_BACKGROUND_SYNC_CLIENT_IMPL_H_