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_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_SERVICE_IMPL_H_ |
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_SERVICE_IMPL_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_SERVICE_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.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 url { | 16 namespace url { |
17 class Origin; | 17 class Origin; |
18 } | 18 } |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 class BackgroundFetchContext; | 22 class BackgroundFetchContext; |
23 struct BackgroundFetchOptions; | 23 struct BackgroundFetchOptions; |
24 class ServiceWorkerContextWrapper; | 24 class ServiceWorkerContextWrapper; |
25 | 25 |
26 class BackgroundFetchServiceImpl : public blink::mojom::BackgroundFetchService { | 26 class BackgroundFetchServiceImpl : public blink::mojom::BackgroundFetchService { |
27 public: | 27 public: |
28 BackgroundFetchServiceImpl( | 28 explicit BackgroundFetchServiceImpl( |
29 scoped_refptr<BackgroundFetchContext> background_fetch_context, | 29 scoped_refptr<BackgroundFetchContext> background_fetch_context); |
30 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); | |
31 ~BackgroundFetchServiceImpl() override; | 30 ~BackgroundFetchServiceImpl() override; |
32 | 31 |
33 static void Create( | 32 static void Create( |
34 scoped_refptr<BackgroundFetchContext> background_fetch_context, | 33 scoped_refptr<BackgroundFetchContext> background_fetch_context, |
35 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context, | |
36 blink::mojom::BackgroundFetchServiceRequest request); | 34 blink::mojom::BackgroundFetchServiceRequest request); |
37 | 35 |
38 // blink::mojom::BackgroundFetchService implementation. | 36 // blink::mojom::BackgroundFetchService implementation. |
39 void Fetch(int64_t service_worker_registration_id, | 37 void Fetch(int64_t service_worker_registration_id, |
40 const url::Origin& origin, | 38 const url::Origin& origin, |
41 const std::string& tag, | 39 const std::string& tag, |
42 const BackgroundFetchOptions& options, | 40 const BackgroundFetchOptions& options, |
43 const FetchCallback& callback) override; | 41 const FetchCallback& callback) override; |
44 void UpdateUI(int64_t service_worker_registration_id, | 42 void UpdateUI(int64_t service_worker_registration_id, |
45 const url::Origin& origin, | 43 const url::Origin& origin, |
46 const std::string& tag, | 44 const std::string& tag, |
47 const std::string& title, | 45 const std::string& title, |
48 const UpdateUICallback& callback) override; | 46 const UpdateUICallback& callback) override; |
49 void Abort(int64_t service_worker_registration_id, | 47 void Abort(int64_t service_worker_registration_id, |
50 const url::Origin& origin, | 48 const url::Origin& origin, |
51 const std::string& tag, | 49 const std::string& tag, |
52 const AbortCallback& callback) override; | 50 const AbortCallback& callback) override; |
53 void GetRegistration(int64_t service_worker_registration_id, | 51 void GetRegistration(int64_t service_worker_registration_id, |
54 const url::Origin& origin, | 52 const url::Origin& origin, |
55 const std::string& tag, | 53 const std::string& tag, |
56 const GetRegistrationCallback& callback) override; | 54 const GetRegistrationCallback& callback) override; |
57 void GetTags(int64_t service_worker_registration_id, | 55 void GetTags(int64_t service_worker_registration_id, |
58 const url::Origin& origin, | 56 const url::Origin& origin, |
59 const GetTagsCallback& callback) override; | 57 const GetTagsCallback& callback) override; |
60 | 58 |
61 private: | 59 private: |
62 scoped_refptr<BackgroundFetchContext> background_fetch_context_; | 60 scoped_refptr<BackgroundFetchContext> background_fetch_context_; |
63 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | |
64 | 61 |
65 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchServiceImpl); | 62 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchServiceImpl); |
66 }; | 63 }; |
67 | 64 |
68 } // namespace content | 65 } // namespace content |
69 | 66 |
70 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_SERVICE_IMPL_H_ | 67 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_SERVICE_IMPL_H_ |
OLD | NEW |