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 143324661d438f14fe70dc3d39aa8f22ab82d971..a0bd94ab33f1f85bdf72d8163c7e06f943d71308 100644 |
| --- a/ios/chrome/browser/dom_distiller/distiller_viewer.cc |
| +++ b/ios/chrome/browser/dom_distiller/distiller_viewer.cc |
| @@ -39,21 +39,24 @@ DistillerViewer::~DistillerViewer() {} |
| void DistillerViewer::OnArticleReady( |
| const dom_distiller::DistilledArticleProto* article_proto) { |
| DomDistillerRequestViewBase::OnArticleReady(article_proto); |
| + if (article_proto->pages_size() > 0) { |
| + 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()}); |
|
noyau (Ping after 24h)
2016/09/09 12:45:22
imageInfo{ ? Should this be ImageInfo( instead? I
|
| + } |
| - 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({GURL(image.url()), image.data()}); |
| - } |
| - |
| - const std::string html = viewer::GetUnsafeArticleTemplateHtml( |
| - url_.spec(), distilled_page_prefs_->GetTheme(), |
| - distilled_page_prefs_->GetFontFamily()); |
| + const std::string html = viewer::GetUnsafeArticleTemplateHtml( |
| + url_.spec(), distilled_page_prefs_->GetTheme(), |
| + distilled_page_prefs_->GetFontFamily()); |
| - std::string html_and_script(html); |
| - html_and_script += |
| - "<script> distiller_on_ios = true; " + js_buffer_ + "</script>"; |
| - callback_.Run(url_, html_and_script, images); |
| + std::string html_and_script(html); |
| + html_and_script += |
| + "<script> distiller_on_ios = true; " + js_buffer_ + "</script>"; |
| + callback_.Run(url_, html_and_script, images, article_proto->title()); |
| + } else { |
| + callback_.Run(url_, std::string(), {}, std::string()); |
| + } |
| } |
| void DistillerViewer::SendJavaScript(const std::string& buffer) { |