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..58be100a98eef1cf619fb397f34247d70a346aa1 |
--- /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 BackgroundFetchClient provides a communication path for BackgroundFetch |
+// to use functionality provided by embedders to display offline content and |
+// notifications about ongoing BackgroundFetch operations. It also provides a |
+// mechanism for BackgroundFetch to provide a Delegate to allow embedders to |
+// control ongoing BackgroundFetch operations. |
Peter Beverloo
2017/03/31 01:32:24
We use "Background Fetch" w/ space elsewhere.
I w
harkness
2017/03/31 10:11:45
Done.
|
+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: |
+ // 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 Delegate provided is owned by the content layer. If a |
+ // delegate has ever been set through SetDelegate, the content layer |
+ // guarantees to call SetDelegate with |nullptr| before destroying the |
+ // existing delegate. |
Peter Beverloo
2017/03/31 01:32:24
The content layer is rather large and hard to reas
harkness
2017/03/31 10:11:44
Done.
|
+ virtual void SetDelegate(Delegate* delegate) = 0; |
+ |
+ virtual ~BackgroundFetchClient() {} |
Peter Beverloo
2017/03/31 01:32:24
Can this be protected?
harkness
2017/03/31 10:11:45
Done.
|
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_CLIENT_H_ |