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 "content/public/browser/download_item.h" | 9 #include "content/public/browser/download_item.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 void BackgroundFetchRequestInfo::PopulateResponseFromDownloadItem( | 31 void BackgroundFetchRequestInfo::PopulateResponseFromDownloadItem( |
32 DownloadItem* download_item) { | 32 DownloadItem* download_item) { |
33 DCHECK(!response_data_populated_); | 33 DCHECK(!response_data_populated_); |
34 | 34 |
35 url_chain_ = download_item->GetUrlChain(); | 35 url_chain_ = download_item->GetUrlChain(); |
36 file_path_ = download_item->GetTargetFilePath(); | 36 file_path_ = download_item->GetTargetFilePath(); |
37 file_size_ = download_item->GetReceivedBytes(); | 37 file_size_ = download_item->GetReceivedBytes(); |
38 response_time_ = download_item->GetEndTime(); | 38 response_time_ = download_item->GetEndTime(); |
| 39 response_type_ = download_item->GetMimeType(); |
39 | 40 |
40 response_data_populated_ = true; | 41 response_data_populated_ = true; |
41 } | 42 } |
42 | 43 |
43 const std::vector<GURL>& BackgroundFetchRequestInfo::GetURLChain() const { | 44 const std::vector<GURL>& BackgroundFetchRequestInfo::GetURLChain() const { |
44 DCHECK(response_data_populated_); | 45 DCHECK(response_data_populated_); |
45 return url_chain_; | 46 return url_chain_; |
46 } | 47 } |
47 | 48 |
48 const base::FilePath& BackgroundFetchRequestInfo::GetFilePath() const { | 49 const base::FilePath& BackgroundFetchRequestInfo::GetFilePath() const { |
49 DCHECK(response_data_populated_); | 50 DCHECK(response_data_populated_); |
50 return file_path_; | 51 return file_path_; |
51 } | 52 } |
52 | 53 |
53 int64_t BackgroundFetchRequestInfo::GetFileSize() const { | 54 int64_t BackgroundFetchRequestInfo::GetFileSize() const { |
54 DCHECK(response_data_populated_); | 55 DCHECK(response_data_populated_); |
55 return file_size_; | 56 return file_size_; |
56 } | 57 } |
57 | 58 |
58 const base::Time& BackgroundFetchRequestInfo::GetResponseTime() const { | 59 const base::Time& BackgroundFetchRequestInfo::GetResponseTime() const { |
59 DCHECK(response_data_populated_); | 60 DCHECK(response_data_populated_); |
60 return response_time_; | 61 return response_time_; |
61 } | 62 } |
62 | 63 |
| 64 const std::string& BackgroundFetchRequestInfo::GetResponseType() const { |
| 65 DCHECK(response_data_populated_); |
| 66 return response_type_; |
| 67 } |
| 68 |
63 } // namespace content | 69 } // namespace content |
OLD | NEW |