| 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_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 int64_t size, | 236 int64_t size, |
| 237 const std::string& title) { | 237 const std::string& title) { |
| 238 DCHECK(reading_list_model_->loaded()); | 238 DCHECK(reading_list_model_->loaded()); |
| 239 URLDownloader::SuccessState real_success_value = success; | 239 URLDownloader::SuccessState real_success_value = success; |
| 240 if (distilled_path.empty()) { | 240 if (distilled_path.empty()) { |
| 241 real_success_value = URLDownloader::ERROR; | 241 real_success_value = URLDownloader::ERROR; |
| 242 } | 242 } |
| 243 switch (real_success_value) { | 243 switch (real_success_value) { |
| 244 case URLDownloader::DOWNLOAD_SUCCESS: | 244 case URLDownloader::DOWNLOAD_SUCCESS: |
| 245 case URLDownloader::DOWNLOAD_EXISTS: { | 245 case URLDownloader::DOWNLOAD_EXISTS: { |
| 246 int64_t now = | 246 reading_list_model_->SetEntryDistilledInfo( |
| 247 (base::Time::Now() - base::Time::UnixEpoch()).InMicroseconds(); | 247 url, distilled_path, distilled_url, size, base::Time::Now()); |
| 248 reading_list_model_->SetEntryDistilledInfo(url, distilled_path, | |
| 249 distilled_url, size, now); | |
| 250 | 248 |
| 251 std::string trimmed_title = base::CollapseWhitespaceASCII(title, false); | 249 std::string trimmed_title = base::CollapseWhitespaceASCII(title, false); |
| 252 if (!trimmed_title.empty()) | 250 if (!trimmed_title.empty()) |
| 253 reading_list_model_->SetEntryTitle(url, trimmed_title); | 251 reading_list_model_->SetEntryTitle(url, trimmed_title); |
| 254 | 252 |
| 255 const ReadingListEntry* entry = reading_list_model_->GetEntryByURL(url); | 253 const ReadingListEntry* entry = reading_list_model_->GetEntryByURL(url); |
| 256 if (entry) | 254 if (entry) |
| 257 UMA_HISTOGRAM_COUNTS_100("ReadingList.Download.Failures", | 255 UMA_HISTOGRAM_COUNTS_100("ReadingList.Download.Failures", |
| 258 entry->FailedDownloadCounter()); | 256 entry->FailedDownloadCounter()); |
| 259 UMA_HISTOGRAM_ENUMERATION("ReadingList.Download.Status", SUCCESS, | 257 UMA_HISTOGRAM_ENUMERATION("ReadingList.Download.Status", SUCCESS, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 for (auto& url : url_to_download_cellular_) { | 295 for (auto& url : url_to_download_cellular_) { |
| 298 ScheduleDownloadEntry(url); | 296 ScheduleDownloadEntry(url); |
| 299 } | 297 } |
| 300 } | 298 } |
| 301 if (type == net::NetworkChangeNotifier::CONNECTION_WIFI) { | 299 if (type == net::NetworkChangeNotifier::CONNECTION_WIFI) { |
| 302 for (auto& url : url_to_download_wifi_) { | 300 for (auto& url : url_to_download_wifi_) { |
| 303 ScheduleDownloadEntry(url); | 301 ScheduleDownloadEntry(url); |
| 304 } | 302 } |
| 305 } | 303 } |
| 306 } | 304 } |
| OLD | NEW |