Chromium Code Reviews| 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); |
| }; |