Index: content/browser/background_fetch/background_fetch_client_proxy.cc |
diff --git a/content/browser/background_fetch/background_fetch_client_proxy.cc b/content/browser/background_fetch/background_fetch_client_proxy.cc |
index d1dd0316d0a5ae19990435925806c1da42781e04..a3f33547a50f1558de8ec06398175e34bc66b445 100644 |
--- a/content/browser/background_fetch/background_fetch_client_proxy.cc |
+++ b/content/browser/background_fetch/background_fetch_client_proxy.cc |
@@ -6,18 +6,39 @@ |
#include "content/browser/background_fetch/background_fetch_context.h" |
#include "content/browser/background_fetch/background_fetch_registration_id.h" |
+#include "content/common/background_fetch/background_fetch_types.h" |
+#include "content/public/browser/browser_context.h" |
#include "content/public/browser/browser_thread.h" |
namespace content { |
BackgroundFetchClientProxy::BackgroundFetchClientProxy( |
+ BrowserContext* browser_context, |
BackgroundFetchContext* background_fetch_context) |
- : background_fetch_context_(background_fetch_context) { |
+ : browser_context_(browser_context), |
+ background_fetch_context_(background_fetch_context), |
+ weak_ptr_factory_(this) { |
DCHECK(background_fetch_context); |
+ DCHECK(browser_context); |
} |
BackgroundFetchClientProxy::~BackgroundFetchClientProxy() = default; |
+base::WeakPtr<BackgroundFetchClientProxy> |
+BackgroundFetchClientProxy::GetWeakPtr() { |
+ return weak_ptr_factory_.GetWeakPtr(); |
+} |
+ |
+void BackgroundFetchClientProxy::AddDownload( |
Peter Beverloo
2017/04/20 16:27:55
Why do we call this "Download"?
harkness
2017/04/21 14:55:20
I went with Download because all of the Background
Peter Beverloo
2017/04/24 14:39:14
I mean, yeah, this feature is not just about downl
|
+ const std::string& registration_id, |
+ const BackgroundFetchOptions& options) { |
+ BackgroundFetchClient* client = browser_context_->GetBackgroundFetchClient(); |
+ if (client) { |
+ client->AddDownload(registration_id, options.title, |
+ options.total_download_size); |
+ } |
+} |
+ |
void BackgroundFetchClientProxy::CleanupAllTasks() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |