Chromium Code Reviews| Index: content/browser/background_fetch/background_fetch_context.cc |
| diff --git a/content/browser/background_fetch/background_fetch_context.cc b/content/browser/background_fetch/background_fetch_context.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..746b0079e8995a8a07f5d9eea5801f4af72701c7 |
| --- /dev/null |
| +++ b/content/browser/background_fetch/background_fetch_context.cc |
| @@ -0,0 +1,49 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/browser/background_fetch/background_fetch_context.h" |
| + |
| +#include "content/browser/service_worker/service_worker_context_wrapper.h" |
| +#include "content/public/browser/browser_thread.h" |
| + |
| +namespace content { |
| + |
| +BackgroundFetchContext::BackgroundFetchContext( |
| + BrowserContext* browser_context, |
| + const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context) |
| + : browser_context_(browser_context), |
| + service_worker_context_(service_worker_context) { |
| + DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| + |
| + service_worker_context_->AddObserver(this); |
|
Peter Beverloo
2017/02/09 15:48:55
The Service Worker Context's observer list is thre
harkness
2017/02/13 17:20:05
I'll definitely look into this when I start cleani
Peter Beverloo
2017/02/13 18:35:05
Let's then have a TODO for registering an observer
|
| +} |
| + |
| +BackgroundFetchContext::~BackgroundFetchContext() { |
| + DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| + |
| + service_worker_context_->RemoveObserver(this); |
| +} |
| + |
| +void BackgroundFetchContext::Init() { |
| + DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| + |
| + // TODO(harkness) Create the Download observer. |
| + // TODO(harkness) Create the Data manager. |
| + // TODO(harkness) Create the Batch manager. |
| +} |
| + |
| +void BackgroundFetchContext::Shutdown() { |
| + DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| + |
| + // TODO(harkness) Clean up all the things. |
| +} |
| + |
| +void BackgroundFetchContext::OnRegistrationDeleted(int64_t registration_id, |
| + const GURL& pattern) { |
| + DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| + // TODO(harkness) Call into the data manager and delete metadata, this will |
| + // a call to the DownloadManager to abort any ongoing downloads. |
| +} |
| + |
| +} // namespace content |