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