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

Unified Diff: content/browser/background_fetch/background_fetch_client_proxy.h

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_client_proxy.h
diff --git a/content/browser/background_fetch/background_fetch_client_proxy.h b/content/browser/background_fetch/background_fetch_client_proxy.h
index 3f57db173d3c6c4e15c8769a28ed7e4e8e9ef7be..62f5360976caa9a763a1824cf25110e1253460aa 100644
--- a/content/browser/background_fetch/background_fetch_client_proxy.h
+++ b/content/browser/background_fetch/background_fetch_client_proxy.h
@@ -8,11 +8,14 @@
#include <string>
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "content/public/browser/background_fetch_client.h"
namespace content {
class BackgroundFetchContext;
+class BrowserContext;
+struct BackgroundFetchOptions;
// The BackgroundFetchClientProxy exists to proxy calls from the
// BackgroundFetchContext, which lives on the IO thread, to the
@@ -21,9 +24,16 @@ class BackgroundFetchContext;
class CONTENT_EXPORT BackgroundFetchClientProxy
: public BackgroundFetchClient::Delegate {
public:
- explicit BackgroundFetchClientProxy(BackgroundFetchContext* context);
+ explicit BackgroundFetchClientProxy(
Peter Beverloo 2017/04/24 14:39:15 -explicit
+ BrowserContext* browser_context,
+ BackgroundFetchContext* background_fetch_context);
~BackgroundFetchClientProxy() override;
+ // Notify the BackgroundFetchClient that a new download item is available.
+ void AddDownload(const GURL& url,
+ const std::string& registration_id,
+ const BackgroundFetchOptions& options);
+
// BackgroundFetchClient::Delegate implementation.
void CleanupAllTasks() override;
void CancelDownload(const std::string& registration_id) override;
@@ -31,9 +41,20 @@ class CONTENT_EXPORT BackgroundFetchClientProxy
void ResumeDownload(const std::string& registration_id) override;
private:
+ void AddDownloadOnIO(const GURL& url,
+ const std::string& registration_id,
+ const BackgroundFetchOptions& options);
+
// The BackgroundFetchClientProxy is owned by the BackgroundFetchContext.
BackgroundFetchContext* background_fetch_context_;
+ // This is set during initialization and must be cleaned up by the
+ // BackgroundFetchContext during shutdown before the BrowserContext is
+ // destroyed.
+ BackgroundFetchClient* background_fetch_client_;
+
+ base::WeakPtrFactory<BackgroundFetchClientProxy> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(BackgroundFetchClientProxy);
};

Powered by Google App Engine
This is Rietveld 408576698