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

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

Issue 2833793002: Added AddDownload communication path and observers
Patch Set: 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..c69dab32f4816ca2603f8e2239fc6c25945cc980 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,13 @@ 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.
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(&BackgroundFetchClientProxy::AddDownload,
+ client_proxy_->GetWeakPtr(),
+ registration_id.Serialize(), options));
Peter Beverloo 2017/04/20 16:27:55 I'd like to encapsulate the thread-jumps to the Ba
Peter Beverloo 2017/04/20 16:27:55 Should the JobController make this call? It has be
Peter Beverloo 2017/04/24 14:39:14 Ping.
+
// 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