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

Unified Diff: content/browser/background_fetch/background_fetch_context.cc

Issue 2777063008: Connect BackgroundFetch to the OfflineItemCollection
Patch Set: Fixed incognito check and added tests Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
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 f27666efc7abae886b1838eaba08b7b4ed69fa96..2e087b26459a85969ffd42e8672c0b682521e638 100644
--- a/content/browser/background_fetch/background_fetch_context.cc
+++ b/content/browser/background_fetch/background_fetch_context.cc
@@ -5,12 +5,14 @@
#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_event_dispatcher.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/blob_handle.h"
#include "content/public/browser/browser_context.h"
#include "net/url_request/url_request_context_getter.h"
@@ -42,8 +44,13 @@ BackgroundFetchContext::BackgroundFetchContext(
data_manager_(
base::MakeUnique<BackgroundFetchDataManager>(browser_context)),
event_dispatcher_(base::MakeUnique<BackgroundFetchEventDispatcher>(
- std::move(service_worker_context))) {
+ std::move(service_worker_context))),
+ client_proxy_(base::MakeUnique<BackgroundFetchClientProxy>(this)) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ BackgroundFetchClient* background_fetch_client =
+ browser_context_->GetBackgroundFetchClient();
+ if (background_fetch_client)
+ background_fetch_client->SetDelegate(client_proxy_.get());
}
BackgroundFetchContext::~BackgroundFetchContext() {
@@ -58,6 +65,7 @@ void BackgroundFetchContext::InitializeOnIOThread(
void BackgroundFetchContext::Shutdown() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&BackgroundFetchContext::ShutdownOnIO, this));
@@ -223,4 +231,27 @@ void BackgroundFetchContext::DeleteRegistration(
active_fetches_.erase(registration_id);
}
+void BackgroundFetchContext::CleanupAllTasks() {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ // TODO(harkness): Iterate over all tasks and cancel them.
+}
+
+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

Powered by Google App Engine
This is Rietveld 408576698