Chromium Code Reviews| Index: ios/chrome/browser/reading_list/url_downloader.cc |
| diff --git a/ios/chrome/browser/reading_list/url_downloader.cc b/ios/chrome/browser/reading_list/url_downloader.cc |
| index f321384337e3cb55175306392a0981a2be100928..93afe9b1f05c3ae1798f94bbfc4740e80127747f 100644 |
| --- a/ios/chrome/browser/reading_list/url_downloader.cc |
| +++ b/ios/chrome/browser/reading_list/url_downloader.cc |
| @@ -14,6 +14,7 @@ |
| #include "components/reading_list/ios/offline_url_utils.h" |
| #include "ios/chrome/browser/chrome_paths.h" |
| #include "ios/chrome/browser/dom_distiller/distiller_viewer.h" |
| +#include "ios/chrome/browser/reading_list/reading_list_distiller_page.h" |
| #include "ios/chrome/browser/reading_list/reading_list_distiller_page_factory.h" |
| #include "ios/web/public/web_thread.h" |
| #include "net/base/escape.h" |
| @@ -94,8 +95,9 @@ void URLDownloader::DownloadCompletionHandler(const GURL& url, |
| auto post_delete = base::Bind( |
| [](URLDownloader* _this, const GURL& url, const std::string& title, |
| SuccessState success) { |
| - _this->download_completion_.Run( |
| - url, success, reading_list::OfflinePagePath(url), title); |
| + _this->download_completion_.Run(url, _this->distilled_url_, success, |
| + reading_list::OfflinePagePath(url), |
| + title); |
| _this->distiller_.reset(); |
| _this->working_ = false; |
| _this->HandleNextTask(); |
| @@ -157,10 +159,22 @@ void URLDownloader::DownloadURL(GURL url, bool offline_url_exists) { |
| return; |
| } |
| + distilled_url_ = url; |
| + std::unique_ptr<reading_list::ReadingListDistillerPage> |
| + reading_list_distiller_page = |
| + distiller_page_factory_->CreateReadingListDistillerPage(); |
| + reading_list_distiller_page->SetRedirectionCallback( |
| + base::Bind(&URLDownloader::RedirectionCallback, base::Unretained(this))); |
| + |
| distiller_.reset(new dom_distiller::DistillerViewer( |
| distiller_service_, pref_service_, url, |
| base::Bind(&URLDownloader::DistillerCallback, base::Unretained(this)), |
| - distiller_page_factory_)); |
| + std::move(reading_list_distiller_page))); |
| +} |
| + |
| +void URLDownloader::RedirectionCallback(const GURL& page_url, |
| + const GURL& redirected_url) { |
| + distilled_url_ = redirected_url; |
|
gambard
2017/01/20 14:15:14
You don't use the page_url? Maybe to check if this
Olivier
2017/01/20 15:31:16
Done.
|
| } |
| void URLDownloader::DistillerCallback( |