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; |