| 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; | |
| 25 | 24 |
| 26 class BackgroundFetchServiceImpl : public blink::mojom::BackgroundFetchService { | 25 class BackgroundFetchServiceImpl : public blink::mojom::BackgroundFetchService { |
| 27 public: | 26 public: |
| 28 BackgroundFetchServiceImpl( | 27 BackgroundFetchServiceImpl( |
| 29 scoped_refptr<BackgroundFetchContext> background_fetch_context, | 28 int render_process_id, |
| 30 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); | 29 scoped_refptr<BackgroundFetchContext> background_fetch_context); |
| 31 ~BackgroundFetchServiceImpl() override; | 30 ~BackgroundFetchServiceImpl() override; |
| 32 | 31 |
| 33 static void Create( | 32 static void Create( |
| 33 int render_process_id, |
| 34 scoped_refptr<BackgroundFetchContext> background_fetch_context, | 34 scoped_refptr<BackgroundFetchContext> background_fetch_context, |
| 35 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context, | |
| 36 blink::mojom::BackgroundFetchServiceRequest request); | 35 blink::mojom::BackgroundFetchServiceRequest request); |
| 37 | 36 |
| 38 // blink::mojom::BackgroundFetchService implementation. | 37 // blink::mojom::BackgroundFetchService implementation. |
| 39 void Fetch(int64_t service_worker_registration_id, | 38 void Fetch(int64_t service_worker_registration_id, |
| 40 const url::Origin& origin, | 39 const url::Origin& origin, |
| 41 const std::string& tag, | 40 const std::string& tag, |
| 42 const BackgroundFetchOptions& options, | 41 const BackgroundFetchOptions& options, |
| 43 const FetchCallback& callback) override; | 42 const FetchCallback& callback) override; |
| 44 void UpdateUI(int64_t service_worker_registration_id, | 43 void UpdateUI(int64_t service_worker_registration_id, |
| 45 const url::Origin& origin, | 44 const url::Origin& origin, |
| 46 const std::string& tag, | 45 const std::string& tag, |
| 47 const std::string& title, | 46 const std::string& title, |
| 48 const UpdateUICallback& callback) override; | 47 const UpdateUICallback& callback) override; |
| 49 void Abort(int64_t service_worker_registration_id, | 48 void Abort(int64_t service_worker_registration_id, |
| 50 const url::Origin& origin, | 49 const url::Origin& origin, |
| 51 const std::string& tag, | 50 const std::string& tag, |
| 52 const AbortCallback& callback) override; | 51 const AbortCallback& callback) override; |
| 53 void GetRegistration(int64_t service_worker_registration_id, | 52 void GetRegistration(int64_t service_worker_registration_id, |
| 54 const url::Origin& origin, | 53 const url::Origin& origin, |
| 55 const std::string& tag, | 54 const std::string& tag, |
| 56 const GetRegistrationCallback& callback) override; | 55 const GetRegistrationCallback& callback) override; |
| 57 void GetTags(int64_t service_worker_registration_id, | 56 void GetTags(int64_t service_worker_registration_id, |
| 58 const url::Origin& origin, | 57 const url::Origin& origin, |
| 59 const GetTagsCallback& callback) override; | 58 const GetTagsCallback& callback) override; |
| 60 | 59 |
| 61 private: | 60 private: |
| 61 // Id of the renderer process that this service has been created for. |
| 62 int render_process_id_; |
| 63 |
| 64 // The Background Fetch context on which operations will be dispatched. |
| 62 scoped_refptr<BackgroundFetchContext> background_fetch_context_; | 65 scoped_refptr<BackgroundFetchContext> background_fetch_context_; |
| 63 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | |
| 64 | 66 |
| 65 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchServiceImpl); | 67 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchServiceImpl); |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 } // namespace content | 70 } // namespace content |
| 69 | 71 |
| 70 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_SERVICE_IMPL_H_ | 72 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_SERVICE_IMPL_H_ |
| OLD | NEW |