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..1fccf99ee25d3ef8f1ef09ad98951d84f35629a9 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,18 @@ class BackgroundFetchContext; |
class CONTENT_EXPORT BackgroundFetchClientProxy |
: public BackgroundFetchClient::Delegate { |
public: |
- explicit BackgroundFetchClientProxy(BackgroundFetchContext* context); |
+ explicit BackgroundFetchClientProxy( |
+ BrowserContext* browser_context, |
harkness
2017/04/20 12:25:16
peter@ : I didn't really want to save the browser_
|
+ BackgroundFetchContext* background_fetch_context); |
~BackgroundFetchClientProxy() override; |
+ // Returns a weak pointer that can be used to post tasks to the proxy. |
+ base::WeakPtr<BackgroundFetchClientProxy> GetWeakPtr(); |
+ |
+ // Notify the BackgroundFetchClient that a new download item is available. |
+ void AddDownload(const std::string& registration_id, |
+ const BackgroundFetchOptions& options); |
+ |
// BackgroundFetchClient::Delegate implementation. |
void CleanupAllTasks() override; |
void CancelDownload(const std::string& registration_id) override; |
@@ -31,9 +43,14 @@ class CONTENT_EXPORT BackgroundFetchClientProxy |
void ResumeDownload(const std::string& registration_id) override; |
private: |
+ // The BackgroundFetchClientProxy is indirectly owned by the BrowserContext. |
+ BrowserContext* browser_context_; |
+ |
// The BackgroundFetchClientProxy is owned by the BackgroundFetchContext. |
BackgroundFetchContext* background_fetch_context_; |
+ base::WeakPtrFactory<BackgroundFetchClientProxy> weak_ptr_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(BackgroundFetchClientProxy); |
}; |