OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_CLIENT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_CLIENT_H_ |
6 #define CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_CLIENT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "url/gurl.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 // The Background Fetch client enables the embedder to be given information | 15 // 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 // 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 // and for the embedder to control the state of such fetches. |
17 class CONTENT_EXPORT BackgroundFetchClient { | 18 class CONTENT_EXPORT BackgroundFetchClient { |
18 public: | 19 public: |
19 // Class for access to the BackgroundFetch system. Manages in progress fetches | 20 // Class for access to the BackgroundFetch system. Manages in progress fetches |
20 // and supports pause, resume, cancel, and UI update. | 21 // and supports pause, resume, cancel, and UI update. |
(...skipping 12 matching lines...) Expand all Loading... |
33 virtual void ResumeDownload(const std::string& registration_id) = 0; | 34 virtual void ResumeDownload(const std::string& registration_id) = 0; |
34 | 35 |
35 protected: | 36 protected: |
36 virtual ~Delegate() {} | 37 virtual ~Delegate() {} |
37 }; | 38 }; |
38 | 39 |
39 // The client will maintain a weak reference to |delegate|. The provider must | 40 // 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 // reset the delegate back to a `nullptr` when it's being destructed. |
41 virtual void SetDelegate(Delegate* delegate) = 0; | 42 virtual void SetDelegate(Delegate* delegate) = 0; |
42 | 43 |
| 44 // Notify the client that a Background Fetch download has started, including |
| 45 // all information needed to display a notification of the download. |
| 46 virtual void AddDownload(const GURL& url, |
| 47 const std::string& registration_id, |
| 48 const std::string& title, |
| 49 int64_t total_download_size) = 0; |
| 50 |
43 protected: | 51 protected: |
44 virtual ~BackgroundFetchClient() {} | 52 virtual ~BackgroundFetchClient() {} |
45 }; | 53 }; |
46 | 54 |
47 } // namespace content | 55 } // namespace content |
48 | 56 |
49 #endif // CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_CLIENT_H_ | 57 #endif // CONTENT_PUBLIC_BROWSER_BACKGROUND_FETCH_CLIENT_H_ |
OLD | NEW |