Index: content/public/browser/background_fetch_client.h |
diff --git a/content/public/browser/background_fetch_client.h b/content/public/browser/background_fetch_client.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1aad804e99a75da39665dfa15c39279bbc84c773 |
--- /dev/null |
+++ b/content/public/browser/background_fetch_client.h |
@@ -0,0 +1,49 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_CLIENT_H_ |
+#define CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_CLIENT_H_ |
+ |
+#include <string> |
+ |
+#include "content/common/content_export.h" |
+ |
+namespace content { |
+ |
+// The Background Fetch client enables the embedder to be given information |
+// about the active Background Fetches, for example to provide a user interface, |
+// and for the embedder to control the state of such fetches. |
+class CONTENT_EXPORT BackgroundFetchClient { |
+ public: |
+ // Class for access to the BackgroundFetch system. Manages in progress fetches |
+ // and supports pause, resume, cancel, and UI update. |
+ class CONTENT_EXPORT Delegate { |
+ public: |
+ // Cleans up all tasks, whether in progress or completed. |
+ virtual void CleanupAllTasks() = 0; |
+ |
+ // Cancel all fetches associated with the |registration_id|. |
+ virtual void CancelDownload(const std::string& registration_id) = 0; |
+ |
+ // Pause all fetches associated with the |registration_id|. |
+ virtual void PauseDownload(const std::string& registration_id) = 0; |
+ |
+ // Resume any fetches associated with the |registration_id|. |
+ virtual void ResumeDownload(const std::string& registration_id) = 0; |
+ |
+ protected: |
+ virtual ~Delegate() {} |
+ }; |
+ |
+ // The client will maintain a weak reference to |delegate|. The provider must |
+ // reset the delegate back to a `nullptr` when it's being destructed. |
+ virtual void SetDelegate(Delegate* delegate) = 0; |
+ |
+ protected: |
+ virtual ~BackgroundFetchClient() {} |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_CLIENT_H_ |