| 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
|
| index 5506585dfe2f993d31be576d4f4ef9297179a3a1..a3a48bf2f0d8caa9af00693d48dab2a31f9e6b63 100644
|
| --- a/content/browser/background_fetch/background_fetch_context.cc
|
| +++ b/content/browser/background_fetch/background_fetch_context.cc
|
| @@ -5,11 +5,13 @@
|
| #include "content/browser/background_fetch/background_fetch_context.h"
|
|
|
| #include "base/memory/ptr_util.h"
|
| +#include "content/browser/background_fetch/background_fetch_client_proxy.h"
|
| #include "content/browser/background_fetch/background_fetch_data_manager.h"
|
| #include "content/browser/background_fetch/background_fetch_job_controller.h"
|
| #include "content/browser/background_fetch/background_fetch_registration_id.h"
|
| #include "content/browser/service_worker/service_worker_context_wrapper.h"
|
| #include "content/browser/storage_partition_impl.h"
|
| +#include "content/public/browser/background_fetch_client.h"
|
| #include "content/public/browser/browser_context.h"
|
|
|
| namespace content {
|
| @@ -22,8 +24,12 @@ BackgroundFetchContext::BackgroundFetchContext(
|
| storage_partition_(storage_partition),
|
| service_worker_context_(service_worker_context),
|
| background_fetch_data_manager_(
|
| - base::MakeUnique<BackgroundFetchDataManager>(browser_context)) {
|
| + base::MakeUnique<BackgroundFetchDataManager>(browser_context)),
|
| + client_proxy_(base::MakeUnique<BackgroundFetchClientProxy>(this)) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| + BackgroundFetchClient* client = browser_context_->GetBackgroundFetchClient();
|
| + if (client)
|
| + client->SetDelegate(client_proxy_.get());
|
| }
|
|
|
| BackgroundFetchContext::~BackgroundFetchContext() {
|
| @@ -32,6 +38,11 @@ BackgroundFetchContext::~BackgroundFetchContext() {
|
|
|
| void BackgroundFetchContext::Shutdown() {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| +
|
| + BackgroundFetchClient* client = browser_context_->GetBackgroundFetchClient();
|
| + if (client)
|
| + client->SetDelegate(nullptr);
|
| +
|
| BrowserThread::PostTask(
|
| BrowserThread::IO, FROM_HERE,
|
| base::Bind(&BackgroundFetchContext::ShutdownOnIO, this));
|
| @@ -101,4 +112,22 @@ void BackgroundFetchContext::DidFinishFetch(
|
| active_fetches_.erase(registration_id);
|
| }
|
|
|
| +void BackgroundFetchContext::CancelFetch(
|
| + const BackgroundFetchRegistrationId& registration_id) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + // TODO(harkness): pass the command to the JobController for the given task.
|
| +}
|
| +
|
| +void BackgroundFetchContext::PauseFetch(
|
| + const BackgroundFetchRegistrationId& registration_id) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + // TODO(harkness): pass the command to the JobController for the given task.
|
| +}
|
| +
|
| +void BackgroundFetchContext::ResumeFetch(
|
| + const BackgroundFetchRegistrationId& registration_id) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + // TODO(harkness): pass the command to the JobController for the given task.
|
| +}
|
| +
|
| } // namespace content
|
|
|