OLD | NEW |
(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 |
OLD | NEW |