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

Unified Diff: content/browser/background_fetch/background_fetch_client_proxy.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_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,

Powered by Google App Engine
This is Rietveld 408576698