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

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

Issue 2833793002: Added AddDownload communication path and observers
Patch Set: Addressed comments and moved thrad jumps into the client proxy. 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 2e087b26459a85969ffd42e8672c0b682521e638..e422bda9613e8656e8129b2989319c894455101d 100644
--- a/content/browser/background_fetch/background_fetch_context.cc
+++ b/content/browser/background_fetch/background_fetch_context.cc
@@ -45,7 +45,8 @@ BackgroundFetchContext::BackgroundFetchContext(
base::MakeUnique<BackgroundFetchDataManager>(browser_context)),
event_dispatcher_(base::MakeUnique<BackgroundFetchEventDispatcher>(
std::move(service_worker_context))),
- client_proxy_(base::MakeUnique<BackgroundFetchClientProxy>(this)) {
+ client_proxy_(
+ base::MakeUnique<BackgroundFetchClientProxy>(browser_context, this)) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
BackgroundFetchClient* background_fetch_client =
browser_context_->GetBackgroundFetchClient();
@@ -103,6 +104,11 @@ void BackgroundFetchContext::DidCreateRegistration(
// Create the BackgroundFetchJobController, which will do the actual fetching.
CreateController(registration_id, options, std::move(initial_requests));
+ // Tell the BackgroundFetchClient that a job has started, which will allow
+ // embedders to display updates.
+ client_proxy_->AddDownload(GURL(registration_id.origin().Serialize()),
+ registration_id.Serialize(), options);
+
// Create the BackgroundFetchRegistration the renderer process will receive,
// which enables it to resolve the promise telling the developer it worked.
BackgroundFetchRegistration registration;

Powered by Google App Engine
This is Rietveld 408576698