OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_CLIENT_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_CLIENT_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "content/common/content_export.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 // The Background Fetch client enables the embedder to be given information |
| 15 // about the active Background Fetches, for example to provide a user interface, |
| 16 // and for the embedder to control the state of such fetches. |
| 17 class CONTENT_EXPORT BackgroundFetchClient { |
| 18 public: |
| 19 // Class for access to the BackgroundFetch system. Manages in progress fetches |
| 20 // and supports pause, resume, cancel, and UI update. |
| 21 class CONTENT_EXPORT Delegate { |
| 22 public: |
| 23 // Cleans up all tasks, whether in progress or completed. |
| 24 virtual void CleanupAllTasks() = 0; |
| 25 |
| 26 // Cancel all fetches associated with the |registration_id|. |
| 27 virtual void CancelDownload(const std::string& registration_id) = 0; |
| 28 |
| 29 // Pause all fetches associated with the |registration_id|. |
| 30 virtual void PauseDownload(const std::string& registration_id) = 0; |
| 31 |
| 32 // Resume any fetches associated with the |registration_id|. |
| 33 virtual void ResumeDownload(const std::string& registration_id) = 0; |
| 34 |
| 35 protected: |
| 36 virtual ~Delegate() {} |
| 37 }; |
| 38 |
| 39 // The client will maintain a weak reference to |delegate|. The provider must |
| 40 // reset the delegate back to a `nullptr` when it's being destructed. |
| 41 virtual void SetDelegate(Delegate* delegate) = 0; |
| 42 |
| 43 protected: |
| 44 virtual ~BackgroundFetchClient() {} |
| 45 }; |
| 46 |
| 47 } // namespace content |
| 48 |
| 49 #endif // CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_CLIENT_H_ |
OLD | NEW |