| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/reading_list/reading_list_download_service.h" | 5 #include "ios/chrome/browser/reading_list/reading_list_download_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 void ReadingListDownloadService::RemoveDownloadedEntry( | 171 void ReadingListDownloadService::RemoveDownloadedEntry( |
| 172 const ReadingListEntry& entry) { | 172 const ReadingListEntry& entry) { |
| 173 DCHECK(reading_list_model_->loaded()); | 173 DCHECK(reading_list_model_->loaded()); |
| 174 url_downloader_->RemoveOfflineURL(entry.URL()); | 174 url_downloader_->RemoveOfflineURL(entry.URL()); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void ReadingListDownloadService::OnDownloadEnd( | 177 void ReadingListDownloadService::OnDownloadEnd( |
| 178 const GURL& url, | 178 const GURL& url, |
| 179 URLDownloader::SuccessState success, | 179 URLDownloader::SuccessState success, |
| 180 const GURL& distilled_url, | 180 const base::FilePath& distilled_path, |
| 181 const std::string& title) { | 181 const std::string& title) { |
| 182 DCHECK(reading_list_model_->loaded()); | 182 DCHECK(reading_list_model_->loaded()); |
| 183 if ((success == URLDownloader::DOWNLOAD_SUCCESS || | 183 if ((success == URLDownloader::DOWNLOAD_SUCCESS || |
| 184 success == URLDownloader::DOWNLOAD_EXISTS) && | 184 success == URLDownloader::DOWNLOAD_EXISTS) && |
| 185 distilled_url.is_valid()) { | 185 !distilled_path.empty()) { |
| 186 reading_list_model_->SetEntryDistilledURL(url, distilled_url); | 186 reading_list_model_->SetEntryDistilledPath(url, distilled_path); |
| 187 | 187 |
| 188 } else if (success == URLDownloader::ERROR_RETRY) { | 188 } else if (success == URLDownloader::ERROR_RETRY) { |
| 189 reading_list_model_->SetEntryDistilledState(url, | 189 reading_list_model_->SetEntryDistilledState(url, |
| 190 ReadingListEntry::WILL_RETRY); | 190 ReadingListEntry::WILL_RETRY); |
| 191 ScheduleDownloadEntryFromURL(url); | 191 ScheduleDownloadEntryFromURL(url); |
| 192 | 192 |
| 193 } else if (success == URLDownloader::ERROR_PERMANENT) { | 193 } else if (success == URLDownloader::ERROR_PERMANENT) { |
| 194 reading_list_model_->SetEntryDistilledState(url, ReadingListEntry::ERROR); | 194 reading_list_model_->SetEntryDistilledState(url, ReadingListEntry::ERROR); |
| 195 } | 195 } |
| 196 } | 196 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 211 for (auto& url : url_to_download_cellular_) { | 211 for (auto& url : url_to_download_cellular_) { |
| 212 ScheduleDownloadEntryFromURL(url); | 212 ScheduleDownloadEntryFromURL(url); |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 if (type == net::NetworkChangeNotifier::CONNECTION_WIFI) { | 215 if (type == net::NetworkChangeNotifier::CONNECTION_WIFI) { |
| 216 for (auto& url : url_to_download_wifi_) { | 216 for (auto& url : url_to_download_wifi_) { |
| 217 ScheduleDownloadEntryFromURL(url); | 217 ScheduleDownloadEntryFromURL(url); |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 } | 220 } |
| OLD | NEW |