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

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

Issue 2678273003: Initial framework setup and skeleton for BackgroundFetchContext (Closed)
Patch Set: Removed unused browser_context_ stored member. Created 3 years, 10 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_
7
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/browser/background_fetch/background_fetch_data_manager.h"
11 #include "content/common/content_export.h"
12
13 namespace content {
14
15 class BrowserContext;
16 class FetchRequest;
17 class ServiceWorkerContextWrapper;
18
19 // The BackgroundFetchContext is the central moderator of ongoing background
20 // fetch requests from the Mojo service and from other callers.
21 // Background Fetch requests function similar to normal fetches except that
22 // they are persistent across Chromium or service worker shutdown.
23 class CONTENT_EXPORT BackgroundFetchContext
24 : public base::RefCountedThreadSafe<BackgroundFetchContext> {
25 public:
26 // The BackgroundFetchContext will watch the ServiceWorkerContextWrapper so
27 // that it can respond to service worker events such as unregister.
28 BackgroundFetchContext(
29 BrowserContext* browser_context,
30 const scoped_refptr<ServiceWorkerContextWrapper>& context);
31
32 // Init and Shutdown are for use on the UI thread when the StoragePartition is
33 // being setup and torn down.
34 void Init();
35
36 // Shutdown must be called before deleting this. Call on the UI thread.
37 void Shutdown();
38
39 BackgroundFetchDataManager* GetDataManagerForTesting() {
40 return &background_fetch_data_manager_;
41 }
42
43 private:
44 void CreateRequest(const FetchRequest& fetch_request);
45
46 friend class base::RefCountedThreadSafe<BackgroundFetchContext>;
47 ~BackgroundFetchContext();
48
49 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
50 BackgroundFetchDataManager background_fetch_data_manager_;
51
52 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchContext);
53 };
54
55 } // namespace content
56
57 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/browser/background_fetch/OWNERS ('k') | content/browser/background_fetch/background_fetch_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698