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

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

Issue 2777063008: Connect BackgroundFetch to the OfflineItemCollection
Patch Set: Added BackgroundFetchClientProxy to proxy calls to and from the Context. Created 3 years, 9 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 5506585dfe2f993d31be576d4f4ef9297179a3a1..86908fc11ed4097704c2494903f5f729f04f5a29 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,12 +24,20 @@ 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() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ BackgroundFetchClient* client = browser_context_->GetBackgroundFetchClient();
+ if (client)
+ client->SetDelegate(nullptr);
Peter Beverloo 2017/03/31 01:32:23 Thinking more about this, we should probably do th
harkness 2017/03/31 10:11:44 Excellent point. Done.
}
void BackgroundFetchContext::Shutdown() {
@@ -101,4 +111,19 @@ void BackgroundFetchContext::DidFinishFetch(
active_fetches_.erase(registration_id);
}
+void BackgroundFetchContext::CancelFetch(
+ const BackgroundFetchRegistrationId& registration_id) {
+ // TODO(harkness): pass the command to the JobController for the given task.
Peter Beverloo 2017/03/31 01:32:23 DCHECK_CURRENTLY_ON(BrowserThread::IO);
harkness 2017/03/31 10:11:44 Done.
+}
+
+void BackgroundFetchContext::PauseFetch(
+ const BackgroundFetchRegistrationId& registration_id) {
+ // TODO(harkness): pass the command to the JobController for the given task.
+}
+
+void BackgroundFetchContext::ResumeFetch(
+ const BackgroundFetchRegistrationId& registration_id) {
+ // TODO(harkness): pass the command to the JobController for the given task.
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698