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

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

Issue 493853006: Remove DistilledPageInfo and related structs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « components/dom_distiller/core/distiller_page.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 462a79ab54f787bc68da6270121191d49595e43f..77c7db59d2c4533c2f4b9319efeb4fd497d7adf3 100644
--- a/components/dom_distiller/core/distiller_page.cc
+++ b/components/dom_distiller/core/distiller_page.cc
@@ -48,22 +48,6 @@ std::string GetDistillerScriptWithOptions(
}
-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) {}
@@ -87,62 +71,20 @@ void DistillerPage::OnDistillationDone(const GURL& page_url,
DCHECK(!ready_);
ready_ = true;
- scoped_ptr<DistilledPageInfo> page_info(new DistilledPageInfo());
+ scoped_ptr<dom_distiller::proto::DomDistillerResult> distiller_result(
+ new dom_distiller::proto::DomDistillerResult());
bool found_content = !value->IsType(base::Value::TYPE_NULL);
- if (found_content) {
- dom_distiller::proto::DomDistillerResult distiller_result =
- dom_distiller::proto::json::DomDistillerResult::ReadFromValue(value);
-
- page_info->title = distiller_result.title();
- page_info->html = distiller_result.distilled_content().html();
- page_info->next_page_url = distiller_result.pagination_info().next_page();
- page_info->prev_page_url = distiller_result.pagination_info().prev_page();
- for (int i = 0; i < distiller_result.image_urls_size(); ++i) {
- const std::string image_url = distiller_result.image_urls(i);
- if (GURL(image_url).is_valid()) {
- 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);
- }
+ if (found_content &&
+ !dom_distiller::proto::json::DomDistillerResult::ReadFromValue(
+ value, distiller_result.get())) {
+ DVLOG(1) << "Unable to parse DomDistillerResult.";
}
base::MessageLoop::current()->PostTask(
FROM_HERE,
- base::Bind(
- distiller_page_callback_, base::Passed(&page_info), found_content));
+ base::Bind(distiller_page_callback_,
+ base::Passed(&distiller_result),
+ found_content));
cjhopman 2014/08/27 19:11:37 found_content should probably be false if we faile
nyquist 2014/08/28 19:01:32 Done.
}
} // namespace dom_distiller
« no previous file with comments | « components/dom_distiller/core/distiller_page.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698