Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: ios/chrome/browser/reading_list/reading_list_download_service.cc

Issue 2650593003: Store distilled URL during distillation in Reading List on iOS (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 } 179 }
180 180
181 void ReadingListDownloadService::RemoveDownloadedEntry(const GURL& url) { 181 void ReadingListDownloadService::RemoveDownloadedEntry(const GURL& url) {
182 DCHECK(reading_list_model_->loaded()); 182 DCHECK(reading_list_model_->loaded());
183 url_downloader_->RemoveOfflineURL(url); 183 url_downloader_->RemoveOfflineURL(url);
184 } 184 }
185 185
186 void ReadingListDownloadService::OnDownloadEnd( 186 void ReadingListDownloadService::OnDownloadEnd(
187 const GURL& url, 187 const GURL& url,
188 const GURL& distilled_url,
188 URLDownloader::SuccessState success, 189 URLDownloader::SuccessState success,
189 const base::FilePath& distilled_path, 190 const base::FilePath& distilled_path,
190 const std::string& title) { 191 const std::string& title) {
191 DCHECK(reading_list_model_->loaded()); 192 DCHECK(reading_list_model_->loaded());
192 if ((success == URLDownloader::DOWNLOAD_SUCCESS || 193 if ((success == URLDownloader::DOWNLOAD_SUCCESS ||
193 success == URLDownloader::DOWNLOAD_EXISTS) && 194 success == URLDownloader::DOWNLOAD_EXISTS) &&
194 !distilled_path.empty()) { 195 !distilled_path.empty()) {
195 reading_list_model_->SetEntryDistilledInfo(url, distilled_path, url); 196 reading_list_model_->SetEntryDistilledInfo(url, distilled_path,
197 distilled_url);
196 if (!title.empty()) 198 if (!title.empty())
197 reading_list_model_->SetEntryTitle(url, title); 199 reading_list_model_->SetEntryTitle(url, title);
198 200
199 const ReadingListEntry* entry = reading_list_model_->GetEntryByURL(url); 201 const ReadingListEntry* entry = reading_list_model_->GetEntryByURL(url);
200 if (entry) 202 if (entry)
201 UMA_HISTOGRAM_COUNTS_100("ReadingList.Download.Failures", 203 UMA_HISTOGRAM_COUNTS_100("ReadingList.Download.Failures",
202 entry->FailedDownloadCounter()); 204 entry->FailedDownloadCounter());
203 UMA_HISTOGRAM_ENUMERATION("ReadingList.Download.Status", SUCCESS, 205 UMA_HISTOGRAM_ENUMERATION("ReadingList.Download.Status", SUCCESS,
204 STATUS_MAX); 206 STATUS_MAX);
205 207
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 for (auto& url : url_to_download_cellular_) { 244 for (auto& url : url_to_download_cellular_) {
243 ScheduleDownloadEntry(url); 245 ScheduleDownloadEntry(url);
244 } 246 }
245 } 247 }
246 if (type == net::NetworkChangeNotifier::CONNECTION_WIFI) { 248 if (type == net::NetworkChangeNotifier::CONNECTION_WIFI) {
247 for (auto& url : url_to_download_wifi_) { 249 for (auto& url : url_to_download_wifi_) {
248 ScheduleDownloadEntry(url); 250 ScheduleDownloadEntry(url);
249 } 251 }
250 } 252 }
251 } 253 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/reading_list/reading_list_download_service.h ('k') | ios/chrome/browser/reading_list/url_downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698