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 #include "content/browser/background_fetch/background_fetch_request_info.h" | 5 #include "content/browser/background_fetch/background_fetch_request_info.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/guid.h" | |
10 #include "content/public/browser/download_item.h" | 9 #include "content/public/browser/download_item.h" |
11 | 10 |
12 namespace content { | 11 namespace content { |
13 | 12 |
14 BackgroundFetchRequestInfo::BackgroundFetchRequestInfo() = default; | 13 BackgroundFetchRequestInfo::BackgroundFetchRequestInfo() = default; |
15 | 14 |
16 BackgroundFetchRequestInfo::BackgroundFetchRequestInfo( | 15 BackgroundFetchRequestInfo::BackgroundFetchRequestInfo( |
17 int request_index, | 16 int request_index, |
18 const ServiceWorkerFetchRequest& fetch_request) | 17 const ServiceWorkerFetchRequest& fetch_request) |
19 : request_index_(request_index), | 18 : request_index_(request_index), fetch_request_(fetch_request) {} |
20 fetch_request_(fetch_request), | |
21 guid_(base::GenerateGUID()) {} | |
22 | 19 |
23 BackgroundFetchRequestInfo::BackgroundFetchRequestInfo( | 20 BackgroundFetchRequestInfo::BackgroundFetchRequestInfo( |
24 const BackgroundFetchRequestInfo& request) | 21 const BackgroundFetchRequestInfo& request) |
25 : fetch_request_(request.fetch_request_), | 22 : request_index_(request.request_index_), |
26 guid_(request.guid_), | 23 fetch_request_(request.fetch_request_), |
27 download_guid_(request.download_guid_), | 24 download_guid_(request.download_guid_), |
28 state_(request.state_), | 25 state_(request.state_), |
29 interrupt_reason_(request.interrupt_reason_), | 26 interrupt_reason_(request.interrupt_reason_), |
30 file_path_(request.file_path_) {} | 27 file_path_(request.file_path_), |
| 28 received_bytes_(request.received_bytes_) {} |
31 | 29 |
32 BackgroundFetchRequestInfo::~BackgroundFetchRequestInfo() {} | 30 BackgroundFetchRequestInfo::~BackgroundFetchRequestInfo() {} |
33 | 31 |
34 bool BackgroundFetchRequestInfo::IsComplete() const { | 32 bool BackgroundFetchRequestInfo::IsComplete() const { |
35 return (state_ == DownloadItem::DownloadState::COMPLETE || | 33 return (state_ == DownloadItem::DownloadState::COMPLETE || |
36 state_ == DownloadItem::DownloadState::CANCELLED); | 34 state_ == DownloadItem::DownloadState::CANCELLED); |
37 } | 35 } |
38 | 36 |
39 const GURL& BackgroundFetchRequestInfo::GetURL() const { | 37 const GURL& BackgroundFetchRequestInfo::GetURL() const { |
40 return fetch_request_.url; | 38 return fetch_request_.url; |
41 } | 39 } |
42 | 40 |
43 } // namespace content | 41 } // namespace content |
OLD | NEW |