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

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

Issue 2678273003: Initial framework setup and skeleton for BackgroundFetchContext (Closed)
Patch Set: Removed unused browser_context_ stored member. Created 3 years, 10 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
new file mode 100644
index 0000000000000000000000000000000000000000..5e7301c48c1f952245b83300bd1c980d4d0e27b9
--- /dev/null
+++ b/content/browser/background_fetch/background_fetch_context.cc
@@ -0,0 +1,50 @@
+// 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/background_fetch/fetch_request.h"
+#include "content/browser/service_worker/service_worker_context_wrapper.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/download_manager.h"
+#include "content/public/browser/storage_partition.h"
+
+namespace content {
+
+BackgroundFetchContext::BackgroundFetchContext(
+ BrowserContext* browser_context,
+ const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context)
+ : service_worker_context_(service_worker_context),
+ background_fetch_data_manager_(this) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ // TODO(harkness): BackgroundFetchContext should have
+ // ServiceWorkerContextObserver as a parent class and should register as an
+ // observer here.
+}
+
+BackgroundFetchContext::~BackgroundFetchContext() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+}
+
+void BackgroundFetchContext::Init() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ // TODO(harkness): Create the Download observer.
+ // TODO(harkness): Create the Batch manager.
+}
+
+void BackgroundFetchContext::Shutdown() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+}
+
+void BackgroundFetchContext::CreateRequest(const FetchRequest& fetch_request) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ // Inform the data manager about the new download.
+ background_fetch_data_manager_.CreateRequest(fetch_request);
+
+ // TODO(harkness): Make the request to the download manager.
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698