| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 ProcessNewEntry(url); | 105 ProcessNewEntry(url); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void ReadingListDownloadService::ReadingListDidMoveEntry( | 108 void ReadingListDownloadService::ReadingListDidMoveEntry( |
| 109 const ReadingListModel* model, | 109 const ReadingListModel* model, |
| 110 const GURL& url) { | 110 const GURL& url) { |
| 111 DCHECK_EQ(reading_list_model_, model); | 111 DCHECK_EQ(reading_list_model_, model); |
| 112 ProcessNewEntry(url); | 112 ProcessNewEntry(url); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void ReadingListDownloadService::Clear() { |
| 116 distiller_page_factory_->ReleaseAllRetainedWebState(); |
| 117 } |
| 118 |
| 115 void ReadingListDownloadService::ProcessNewEntry(const GURL& url) { | 119 void ReadingListDownloadService::ProcessNewEntry(const GURL& url) { |
| 116 const ReadingListEntry* entry = reading_list_model_->GetEntryByURL(url); | 120 const ReadingListEntry* entry = reading_list_model_->GetEntryByURL(url); |
| 117 if (!entry || entry->IsRead()) { | 121 if (!entry || entry->IsRead()) { |
| 118 url_downloader_->CancelDownloadOfflineURL(url); | 122 url_downloader_->CancelDownloadOfflineURL(url); |
| 119 } else { | 123 } else { |
| 120 ScheduleDownloadEntry(url); | 124 ScheduleDownloadEntry(url); |
| 121 } | 125 } |
| 122 } | 126 } |
| 123 | 127 |
| 124 void ReadingListDownloadService::SyncWithModel() { | 128 void ReadingListDownloadService::SyncWithModel() { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 for (auto& url : url_to_download_cellular_) { | 301 for (auto& url : url_to_download_cellular_) { |
| 298 ScheduleDownloadEntry(url); | 302 ScheduleDownloadEntry(url); |
| 299 } | 303 } |
| 300 } | 304 } |
| 301 if (type == net::NetworkChangeNotifier::CONNECTION_WIFI) { | 305 if (type == net::NetworkChangeNotifier::CONNECTION_WIFI) { |
| 302 for (auto& url : url_to_download_wifi_) { | 306 for (auto& url : url_to_download_wifi_) { |
| 303 ScheduleDownloadEntry(url); | 307 ScheduleDownloadEntry(url); |
| 304 } | 308 } |
| 305 } | 309 } |
| 306 } | 310 } |
| OLD | NEW |