Chromium Code Reviews| 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 : browser_context_(browser_context), | |
| 20 service_worker_context_(service_worker_context), | |
| 21 background_fetch_data_manager_(this) { | |
| 22 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 23 } | |
| 24 | |
| 25 BackgroundFetchContext::~BackgroundFetchContext() { | |
| 26 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 27 } | |
| 28 | |
| 29 void BackgroundFetchContext::Init() { | |
| 30 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 31 | |
| 32 // TODO(harkness) Create the Download observer. | |
| 33 // TODO(harkness) Create the Batch manager. | |
| 34 } | |
| 35 | |
| 36 void BackgroundFetchContext::Shutdown() { | |
| 37 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 38 } | |
| 39 | |
| 40 void BackgroundFetchContext::OnRegistrationDeleted(int64_t registration_id, | |
| 41 const GURL& pattern) { | |
| 42 // TODO(harkness) Call into the data manager and delete metadata, this will | |
| 43 // a call to the DownloadManager to abort any ongoing downloads. | |
| 44 } | |
| 45 | |
| 46 void BackgroundFetchContext::CreateRequest(const FetchRequest& fetch_request) { | |
| 47 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 48 // Inform the data manager about the new download. | |
| 49 background_fetch_data_manager_.CreateRequest(fetch_request); | |
| 50 | |
| 51 // TODO(harkness)ake the request to the download manager. | |
|
Peter Beverloo
2017/02/14 15:05:52
Please fix the grammar of this TODO
As a minor as
harkness
2017/02/15 13:48:44
Done.
| |
| 52 } | |
| 53 | |
| 54 } // namespace content | |
| OLD | NEW |