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

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

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 #include "content/browser/background_fetch/background_fetch_context.h"
6
7 #include "content/browser/background_fetch/fetch_request.h"
8 #include "content/browser/service_worker/service_worker_context_wrapper.h"
9 #include "content/public/browser/browser_context.h"
10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/browser/download_manager.h"
12 #include "content/public/browser/storage_partition.h"
13
14 namespace content {
15
16 BackgroundFetchContext::BackgroundFetchContext(
17 BrowserContext* browser_context,
18 const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context)
19 : service_worker_context_(service_worker_context),
20 background_fetch_data_manager_(this) {
21 DCHECK_CURRENTLY_ON(BrowserThread::UI);
22 // TODO(harkness): BackgroundFetchContext should have
23 // ServiceWorkerContextObserver as a parent class and should register as an
24 // observer here.
25 }
26
27 BackgroundFetchContext::~BackgroundFetchContext() {
28 DCHECK_CURRENTLY_ON(BrowserThread::UI);
29 }
30
31 void BackgroundFetchContext::Init() {
32 DCHECK_CURRENTLY_ON(BrowserThread::UI);
33
34 // TODO(harkness): Create the Download observer.
35 // TODO(harkness): Create the Batch manager.
36 }
37
38 void BackgroundFetchContext::Shutdown() {
39 DCHECK_CURRENTLY_ON(BrowserThread::UI);
40 }
41
42 void BackgroundFetchContext::CreateRequest(const FetchRequest& fetch_request) {
43 DCHECK_CURRENTLY_ON(BrowserThread::UI);
44 // Inform the data manager about the new download.
45 background_fetch_data_manager_.CreateRequest(fetch_request);
46
47 // TODO(harkness): Make the request to the download manager.
48 }
49
50 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698