| 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_CONTEXT_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ |
| 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class Origin; | 24 class Origin; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 class BackgroundFetchDataManager; | 29 class BackgroundFetchDataManager; |
| 30 class BackgroundFetchEventDispatcher; | 30 class BackgroundFetchEventDispatcher; |
| 31 class BackgroundFetchJobController; | 31 class BackgroundFetchJobController; |
| 32 struct BackgroundFetchOptions; | 32 struct BackgroundFetchOptions; |
| 33 class BackgroundFetchRegistrationId; | 33 class BackgroundFetchRegistrationId; |
| 34 class BackgroundFetchRequestInfo; | |
| 35 class BlobHandle; | 34 class BlobHandle; |
| 36 class BrowserContext; | 35 class BrowserContext; |
| 37 class ServiceWorkerContextWrapper; | 36 class ServiceWorkerContextWrapper; |
| 38 struct ServiceWorkerFetchRequest; | 37 struct ServiceWorkerFetchRequest; |
| 39 | 38 |
| 40 // The BackgroundFetchContext is the central moderator of ongoing background | 39 // The BackgroundFetchContext is the central moderator of ongoing background |
| 41 // fetch requests from the Mojo service and from other callers. | 40 // fetch requests from the Mojo service and from other callers. |
| 42 // Background Fetch requests function similarly to normal fetches except that | 41 // Background Fetch requests function similarly to normal fetches except that |
| 43 // they are persistent across Chromium or service worker shutdown. | 42 // they are persistent across Chromium or service worker shutdown. |
| 44 class CONTENT_EXPORT BackgroundFetchContext | 43 class CONTENT_EXPORT BackgroundFetchContext |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 private: | 76 private: |
| 78 friend class base::DeleteHelper<BackgroundFetchContext>; | 77 friend class base::DeleteHelper<BackgroundFetchContext>; |
| 79 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; | 78 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
| 80 friend class base::RefCountedThreadSafe<BackgroundFetchContext, | 79 friend class base::RefCountedThreadSafe<BackgroundFetchContext, |
| 81 BrowserThread::DeleteOnIOThread>; | 80 BrowserThread::DeleteOnIOThread>; |
| 82 | 81 |
| 83 ~BackgroundFetchContext(); | 82 ~BackgroundFetchContext(); |
| 84 | 83 |
| 85 // Creates a new Job Controller for the given |registration_id| and |options|, | 84 // Creates a new Job Controller for the given |registration_id| and |options|, |
| 86 // which will start fetching the files that are part of the registration. | 85 // which will start fetching the files that are part of the registration. |
| 87 void CreateController( | 86 void CreateController(const BackgroundFetchRegistrationId& registration_id, |
| 88 const BackgroundFetchRegistrationId& registration_id, | 87 const BackgroundFetchOptions& options); |
| 89 const BackgroundFetchOptions& options, | |
| 90 std::vector<scoped_refptr<BackgroundFetchRequestInfo>> initial_requests); | |
| 91 | 88 |
| 92 // Called when a new registration has been created by the data manager. | 89 // Called when a new registration has been created by the data manager. |
| 93 void DidCreateRegistration( | 90 void DidCreateRegistration( |
| 94 const BackgroundFetchRegistrationId& registration_id, | 91 const BackgroundFetchRegistrationId& registration_id, |
| 95 const BackgroundFetchOptions& options, | 92 const BackgroundFetchOptions& options, |
| 96 blink::mojom::BackgroundFetchService::FetchCallback callback, | 93 blink::mojom::BackgroundFetchService::FetchCallback callback, |
| 97 blink::mojom::BackgroundFetchError error, | 94 blink::mojom::BackgroundFetchError error); |
| 98 std::vector<scoped_refptr<BackgroundFetchRequestInfo>> initial_requests); | |
| 99 | 95 |
| 100 // Called when the given |controller| has finished processing its job. | 96 // Called when the given |controller| has finished processing its job. |
| 101 void DidCompleteJob(BackgroundFetchJobController* controller); | 97 void DidCompleteJob(BackgroundFetchJobController* controller); |
| 102 | 98 |
| 103 // Called when the sequence of settled fetches for |registration_id| have been | 99 // Called when the sequence of settled fetches for |registration_id| have been |
| 104 // retrieved from storage, and the Service Worker event can be invoked. | 100 // retrieved from storage, and the Service Worker event can be invoked. |
| 105 void DidGetSettledFetches( | 101 void DidGetSettledFetches( |
| 106 const BackgroundFetchRegistrationId& registration_id, | 102 const BackgroundFetchRegistrationId& registration_id, |
| 107 blink::mojom::BackgroundFetchError error, | 103 blink::mojom::BackgroundFetchError error, |
| 108 bool background_fetch_succeeded, | 104 bool background_fetch_succeeded, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 129 active_fetches_; | 125 active_fetches_; |
| 130 | 126 |
| 131 base::WeakPtrFactory<BackgroundFetchContext> weak_factory_; // Must be last. | 127 base::WeakPtrFactory<BackgroundFetchContext> weak_factory_; // Must be last. |
| 132 | 128 |
| 133 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchContext); | 129 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchContext); |
| 134 }; | 130 }; |
| 135 | 131 |
| 136 } // namespace content | 132 } // namespace content |
| 137 | 133 |
| 138 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ | 134 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ |
| OLD | NEW |