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..0f10989018deb560348aac30ddf15604fd4d1234 100644 |
| --- a/ios/chrome/browser/dom_distiller/distiller_viewer.cc |
| +++ b/ios/chrome/browser/dom_distiller/distiller_viewer.cc |
| @@ -39,13 +39,16 @@ DistillerViewer::~DistillerViewer() {} |
| void DistillerViewer::OnArticleReady( |
| const dom_distiller::DistilledArticleProto* article_proto) { |
| DomDistillerRequestViewBase::OnArticleReady(article_proto); |
| - if (article_proto->pages_size() > 0) { |
| + bool is_empty = true; |
| + for (int i = 0; i < article_proto->pages_size(); i++) { |
| + is_empty = is_empty && article_proto->pages(i).html() == ""; |
|
jif
2016/12/21 13:36:33
Code that breaks out of the loop is easier to unde
Olivier
2016/12/21 13:46:27
Done.
|
| + } |
| + 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()); |