Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: content/browser/background_fetch/background_fetch_context.h

Issue 2708943002: Create the BackgroundFetchBatchManager and initiate a download. (Closed)
Patch Set: fixed nits Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/background_fetch/background_fetch_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "content/browser/background_fetch/background_fetch_data_manager.h" 10 #include "content/browser/background_fetch/background_fetch_data_manager.h"
11 #include "content/browser/background_fetch/background_fetch_job_controller.h"
11 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
12 13
13 namespace content { 14 namespace content {
14 15
16 class BackgroundFetchJobInfo;
17 class BackgroundFetchRequestInfo;
15 class BrowserContext; 18 class BrowserContext;
16 class FetchRequest;
17 class ServiceWorkerContextWrapper; 19 class ServiceWorkerContextWrapper;
18 20
19 // The BackgroundFetchContext is the central moderator of ongoing background 21 // The BackgroundFetchContext is the central moderator of ongoing background
20 // fetch requests from the Mojo service and from other callers. 22 // fetch requests from the Mojo service and from other callers.
21 // Background Fetch requests function similar to normal fetches except that 23 // Background Fetch requests function similar to normal fetches except that
22 // they are persistent across Chromium or service worker shutdown. 24 // they are persistent across Chromium or service worker shutdown.
23 class CONTENT_EXPORT BackgroundFetchContext 25 class CONTENT_EXPORT BackgroundFetchContext
24 : public base::RefCountedThreadSafe<BackgroundFetchContext> { 26 : public base::RefCountedThreadSafe<BackgroundFetchContext> {
25 public: 27 public:
26 // The BackgroundFetchContext will watch the ServiceWorkerContextWrapper so 28 // The BackgroundFetchContext will watch the ServiceWorkerContextWrapper so
27 // that it can respond to service worker events such as unregister. 29 // that it can respond to service worker events such as unregister.
28 BackgroundFetchContext( 30 BackgroundFetchContext(
29 BrowserContext* browser_context, 31 BrowserContext* browser_context,
32 StoragePartition* storage_partition,
30 const scoped_refptr<ServiceWorkerContextWrapper>& context); 33 const scoped_refptr<ServiceWorkerContextWrapper>& context);
31 34
32 // Init and Shutdown are for use on the UI thread when the StoragePartition is 35 // Init and Shutdown are for use on the UI thread when the StoragePartition is
33 // being setup and torn down. 36 // being setup and torn down.
34 void Init(); 37 void Init();
35 38
36 // Shutdown must be called before deleting this. Call on the UI thread. 39 // Shutdown must be called before deleting this. Call on the UI thread.
37 void Shutdown(); 40 void Shutdown();
38 41
39 BackgroundFetchDataManager* GetDataManagerForTesting() { 42 BackgroundFetchDataManager* GetDataManagerForTesting() {
40 return &background_fetch_data_manager_; 43 return &background_fetch_data_manager_;
41 } 44 }
42 45
43 private: 46 private:
44 void CreateRequest(const FetchRequest& fetch_request); 47 void CreateRequest(const BackgroundFetchJobInfo& job_info,
48 std::vector<BackgroundFetchRequestInfo>& request_infos);
45 49
46 friend class base::RefCountedThreadSafe<BackgroundFetchContext>; 50 friend class base::RefCountedThreadSafe<BackgroundFetchContext>;
47 ~BackgroundFetchContext(); 51 ~BackgroundFetchContext();
48 52
49 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; 53 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
54 BackgroundFetchJobController background_fetch_job_controller_;
50 BackgroundFetchDataManager background_fetch_data_manager_; 55 BackgroundFetchDataManager background_fetch_data_manager_;
51 56
52 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchContext); 57 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchContext);
53 }; 58 };
54 59
55 } // namespace content 60 } // namespace content
56 61
57 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_ 62 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/background_fetch/background_fetch_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698