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

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

Issue 211493008: Make DistillerPageWebContentsTest a real test that uses the distiller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 6 years, 9 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/page_distiller.cc
diff --git a/components/dom_distiller/core/page_distiller.cc b/components/dom_distiller/core/page_distiller.cc
index db941ab011fc04c6dd4dcf2c8e938c0f244f3231..cf94ec117c9d6a2aa858185b6edff4fe9c71656d 100644
--- a/components/dom_distiller/core/page_distiller.cc
+++ b/components/dom_distiller/core/page_distiller.cc
@@ -63,6 +63,7 @@ void PageDistiller::OnExecuteJavaScriptDone(const GURL& page_url,
scoped_ptr<DistilledPageInfo> page_info(new DistilledPageInfo());
std::string result;
const base::ListValue* result_list = NULL;
+ bool found_content = false;
if (!value->GetAsList(&result_list)) {
base::MessageLoop::current()->PostTask(
FROM_HERE,
@@ -83,6 +84,7 @@ void PageDistiller::OnExecuteJavaScriptDone(const GURL& page_url,
break;
case 1:
page_info->html = item;
+ found_content = true;
break;
case 2:
page_info->next_page_url = item;
@@ -91,12 +93,17 @@ void PageDistiller::OnExecuteJavaScriptDone(const GURL& page_url,
page_info->prev_page_url = item;
break;
default:
- page_info->image_urls.push_back(item);
+ GURL unvalidated_gurl(item);
+ if (!unvalidated_gurl.is_empty() && unvalidated_gurl.is_valid()) {
+ page_info->image_urls.push_back(item);
+ }
}
}
base::MessageLoop::current()->PostTask(
FROM_HERE,
- base::Bind(page_distiller_callback_, base::Passed(&page_info), true));
+ base::Bind(page_distiller_callback_,
+ base::Passed(&page_info),
+ found_content));
}
}

Powered by Google App Engine
This is Rietveld 408576698