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_BROWSER_BACKGROUND_FETCH_REQUEST_INFO_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_FETCH_REQUEST_INFO_H_ |
6 #define CONTENT_BROWSER_BACKGROUND_FETCH_REQUEST_INFO_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_FETCH_REQUEST_INFO_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
| 11 #include "base/files/file_path.h" |
10 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
11 #include "content/public/browser/download_interrupt_reasons.h" | 13 #include "content/public/browser/download_interrupt_reasons.h" |
12 #include "content/public/browser/download_item.h" | 14 #include "content/public/browser/download_item.h" |
13 #include "url/gurl.h" | 15 #include "url/gurl.h" |
14 | 16 |
15 namespace content { | 17 namespace content { |
16 | 18 |
17 // Simple class to encapsulate the components of a fetch request. | 19 // Simple class to encapsulate the components of a fetch request. |
18 class CONTENT_EXPORT BackgroundFetchRequestInfo { | 20 class CONTENT_EXPORT BackgroundFetchRequestInfo { |
19 public: | 21 public: |
(...skipping 14 matching lines...) Expand all Loading... |
34 const std::string& download_guid() const { return download_guid_; } | 36 const std::string& download_guid() const { return download_guid_; } |
35 void set_download_guid(const std::string& download_guid) { | 37 void set_download_guid(const std::string& download_guid) { |
36 download_guid_ = download_guid; | 38 download_guid_ = download_guid; |
37 } | 39 } |
38 | 40 |
39 DownloadInterruptReason interrupt_reason() const { return interrupt_reason_; } | 41 DownloadInterruptReason interrupt_reason() const { return interrupt_reason_; } |
40 void set_interrupt_reason(DownloadInterruptReason reason) { | 42 void set_interrupt_reason(DownloadInterruptReason reason) { |
41 interrupt_reason_ = reason; | 43 interrupt_reason_ = reason; |
42 } | 44 } |
43 | 45 |
| 46 const base::FilePath& file_path() const { return file_path_; } |
| 47 void set_file_path(const base::FilePath& file_path) { |
| 48 file_path_ = file_path; |
| 49 } |
| 50 |
| 51 int64_t received_bytes() const { return received_bytes_; } |
| 52 void set_received_bytes(int64_t received_bytes) { |
| 53 received_bytes_ = received_bytes; |
| 54 } |
| 55 |
| 56 bool IsComplete() const; |
| 57 |
44 private: | 58 private: |
45 std::string guid_; | 59 std::string guid_; |
46 GURL url_; | 60 GURL url_; |
47 std::string tag_; | 61 std::string tag_; |
48 std::string download_guid_; | 62 std::string download_guid_; |
| 63 |
| 64 // The following members do not need to be persisted, they can be reset after |
| 65 // a chrome restart. |
49 DownloadItem::DownloadState state_ = | 66 DownloadItem::DownloadState state_ = |
50 DownloadItem::DownloadState::MAX_DOWNLOAD_STATE; | 67 DownloadItem::DownloadState::MAX_DOWNLOAD_STATE; |
51 DownloadInterruptReason interrupt_reason_ = | 68 DownloadInterruptReason interrupt_reason_ = |
52 DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE; | 69 DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE; |
| 70 base::FilePath file_path_; |
| 71 int64_t received_bytes_ = 0; |
53 }; | 72 }; |
54 | 73 |
55 using BackgroundFetchRequestInfos = std::vector<BackgroundFetchRequestInfo>; | |
56 | |
57 } // namespace content | 74 } // namespace content |
58 | 75 |
59 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_REQUEST_INFO_H_ | 76 #endif // CONTENT_BROWSER_BACKGROUND_FETCH_REQUEST_INFO_H_ |
OLD | NEW |