Chromium Code Reviews| Index: ios/chrome/browser/dom_distiller/distiller_viewer.cc |
| diff --git a/ios/chrome/browser/dom_distiller/distiller_viewer.cc b/ios/chrome/browser/dom_distiller/distiller_viewer.cc |
| index a0bd94ab33f1f85bdf72d8163c7e06f943d71308..be17a3e82aaacc79b4ae7994c233460031a8b157 100644 |
| --- a/ios/chrome/browser/dom_distiller/distiller_viewer.cc |
| +++ b/ios/chrome/browser/dom_distiller/distiller_viewer.cc |
| @@ -39,13 +39,19 @@ DistillerViewer::~DistillerViewer() {} |
| void DistillerViewer::OnArticleReady( |
| const dom_distiller::DistilledArticleProto* article_proto) { |
| DomDistillerRequestViewBase::OnArticleReady(article_proto); |
|
wychen
2016/12/22 07:58:19
In DomDistillerRequestViewBase::OnArticleReady(),
Olivier
2016/12/22 10:54:59
But IIUC, not the protobuf, correct?
Should I do m
wychen
2016/12/22 11:05:12
The protobuf should be intact, so no need to chang
|
| - if (article_proto->pages_size() > 0) { |
| + bool is_empty = true; |
| + for (int i = 0; i < article_proto->pages_size(); i++) { |
|
wychen
2016/12/22 10:19:33
When the first distilled page is empty, even if th
Olivier
2016/12/22 10:54:59
Done. This makes code simpler
|
| + if (article_proto->pages(i).html() != "") { |
|
wychen
2016/12/22 10:19:33
Using .empty() might be slightly better.
Olivier
2016/12/22 10:54:59
Done.
|
| + is_empty = false; |
| + break; |
| + } |
| + } |
| + if (article_proto->pages_size() > 0 && !is_empty) { |
| std::vector<ImageInfo> images; |
| for (int i = 0; i < article_proto->pages(0).image_size(); i++) { |
| auto image = article_proto->pages(0).image(i); |
| images.push_back(ImageInfo{GURL(image.url()), image.data()}); |
| } |
| - |
| const std::string html = viewer::GetUnsafeArticleTemplateHtml( |
| url_.spec(), distilled_page_prefs_->GetTheme(), |
| distilled_page_prefs_->GetFontFamily()); |