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

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

Issue 2774343002: Hook up BackgroundFetchServiceImpl::Fetch() to start a fetch (Closed)
Patch Set: rebase 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_job_controller.cc
diff --git a/content/browser/background_fetch/background_fetch_job_controller.cc b/content/browser/background_fetch/background_fetch_job_controller.cc
index 12bf80d738cbb9a3b7d7d7308b8aa930be318a8f..5d7ddab5a99594ffefdc513ce0a75dc73db673bb 100644
--- a/content/browser/background_fetch/background_fetch_job_controller.cc
+++ b/content/browser/background_fetch/background_fetch_job_controller.cc
@@ -7,6 +7,7 @@
#include <string>
#include "base/bind.h"
+#include "base/guid.h"
#include "base/memory/ptr_util.h"
#include "content/browser/background_fetch/background_fetch_data_manager.h"
#include "content/browser/background_fetch/background_fetch_request_info.h"
@@ -18,16 +19,17 @@
namespace content {
BackgroundFetchJobController::BackgroundFetchJobController(
- const std::string& job_guid,
+ const BackgroundFetchRegistrationId& registration_id,
BrowserContext* browser_context,
StoragePartition* storage_partition,
BackgroundFetchDataManager* data_manager,
- base::OnceClosure completed_closure)
- : job_guid_(job_guid),
+ CompletedCallback completed_callback)
+ : registration_id_(registration_id),
+ job_guid_(base::GenerateGUID()),
browser_context_(browser_context),
storage_partition_(storage_partition),
data_manager_(data_manager),
- completed_closure_(std::move(completed_closure)),
+ completed_callback_(std::move(completed_callback)),
weak_ptr_factory_(this) {}
BackgroundFetchJobController::~BackgroundFetchJobController() = default;
@@ -99,7 +101,7 @@ void BackgroundFetchJobController::OnDownloadUpdated(DownloadItem* item) {
ProcessRequest(
data_manager_->GetNextBackgroundFetchRequestInfo(job_guid_));
} else if (data_manager_->IsComplete(job_guid_)) {
- std::move(completed_closure_).Run();
+ std::move(completed_callback_).Run(registration_id_);
}
break;
case DownloadItem::DownloadState::INTERRUPTED:

Powered by Google App Engine
This is Rietveld 408576698