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

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

Issue 2678273003: Initial framework setup and skeleton for BackgroundFetchContext (Closed)
Patch Set: Remove BackgroundFetchDownloadObserver until it's used. 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_data_manager.cc
diff --git a/content/browser/background_fetch/background_fetch_data_manager.cc b/content/browser/background_fetch/background_fetch_data_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f796fa0f932082644cf18f3d0134674f7acf6866
--- /dev/null
+++ b/content/browser/background_fetch/background_fetch_data_manager.cc
@@ -0,0 +1,34 @@
+// 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_data_manager.h"
+
+#include "content/browser/background_fetch/background_fetch_context.h"
+#include "content/browser/background_fetch/fetch_request.h"
+
+namespace content {
+
+BackgroundFetchDataManager::BackgroundFetchDataManager(
+ BackgroundFetchContext* background_fetch_context)
+ : background_fetch_context_(background_fetch_context) {
+ DCHECK(background_fetch_context_);
+ // TODO(harkness) Read from persistent storage and recreate requests.
+}
+
+BackgroundFetchDataManager::~BackgroundFetchDataManager() {}
+
+void BackgroundFetchDataManager::CreateRequest(
+ const FetchRequest& fetch_request) {
+ FetchIdentifier id = {fetch_request.origin(), fetch_request.tag()};
Peter Beverloo 2017/02/13 18:35:05 nit: I think you can drop the " = " and call the c
harkness 2017/02/14 13:52:46 Done.
+ if (fetch_map_.find(id) != fetch_map_.end()) {
+ DLOG(ERROR) << "Origin " << fetch_request.origin()
+ << " has already created a fetch request with tag "
+ << fetch_request.tag();
+ // TODO(harkness) Figure out how to return errors like this.
+ return;
+ }
+ fetch_map_[id] = fetch_request;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698