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

Unified Diff: components/dom_distiller/core/distiller_page.cc

Issue 411253008: dom distiller: extract markup properties from protobuf (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/core/distiller_page.cc
diff --git a/components/dom_distiller/core/distiller_page.cc b/components/dom_distiller/core/distiller_page.cc
index a44531cc90162284b3f809eacf9a8603545aed01..462a79ab54f787bc68da6270121191d49595e43f 100644
--- a/components/dom_distiller/core/distiller_page.cc
+++ b/components/dom_distiller/core/distiller_page.cc
@@ -52,6 +52,18 @@ DistilledPageInfo::DistilledPageInfo() {}
DistilledPageInfo::~DistilledPageInfo() {}
+DistilledPageInfo::MarkupArticle::MarkupArticle() {}
+
+DistilledPageInfo::MarkupArticle::~MarkupArticle() {}
+
+DistilledPageInfo::MarkupImage::MarkupImage() {}
+
+DistilledPageInfo::MarkupImage::~MarkupImage() {}
+
+DistilledPageInfo::MarkupInfo::MarkupInfo() {}
+
+DistilledPageInfo::MarkupInfo::~MarkupInfo() {}
+
DistillerPageFactory::~DistillerPageFactory() {}
DistillerPage::DistillerPage() : ready_(true) {}
@@ -91,6 +103,40 @@ void DistillerPage::OnDistillationDone(const GURL& page_url,
page_info->image_urls.push_back(image_url);
}
}
+ const dom_distiller::proto::MarkupInfo& src_markup_info =
+ distiller_result.markup_info();
+ DistilledPageInfo::MarkupInfo& dst_markup_info = page_info->markup_info;
+ dst_markup_info.title = src_markup_info.title();
+ dst_markup_info.type = src_markup_info.type();
+ dst_markup_info.url = src_markup_info.url();
+ dst_markup_info.description = src_markup_info.description();
+ dst_markup_info.publisher = src_markup_info.publisher();
+ dst_markup_info.copyright = src_markup_info.copyright();
+ dst_markup_info.author = src_markup_info.author();
+
+ const dom_distiller::proto::MarkupArticle& src_article =
+ src_markup_info.article();
+ DistilledPageInfo::MarkupArticle& dst_article = dst_markup_info.article;
+ dst_article.published_time = src_article.published_time();
+ dst_article.modified_time = src_article.modified_time();
+ dst_article.expiration_time = src_article.expiration_time();
+ dst_article.section = src_article.section();
+ for (int i = 0; i < src_article.authors_size(); ++i) {
+ dst_article.authors.push_back(src_article.authors(i));
+ }
+
+ for (int i = 0; i < src_markup_info.images_size(); ++i) {
+ const dom_distiller::proto::MarkupImage& src_image =
+ src_markup_info.images(i);
+ DistilledPageInfo::MarkupImage dst_image;
+ dst_image.url = src_image.url();
+ dst_image.secure_url = src_image.secure_url();
+ dst_image.type = src_image.type();
+ dst_image.caption = src_image.caption();
+ dst_image.width = src_image.width();
+ dst_image.height = src_image.height();
+ dst_markup_info.images.push_back(dst_image);
+ }
}
base::MessageLoop::current()->PostTask(
« no previous file with comments | « components/dom_distiller/core/distiller_page.h ('k') | components/test/data/dom_distiller/markup_article.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698