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

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

Issue 1703313003: Only show Reader Mode infobar on long articles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 10 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/distillable_page_detector.cc
diff --git a/components/dom_distiller/core/distillable_page_detector.cc b/components/dom_distiller/core/distillable_page_detector.cc
index c3a333eaa8c9e4fef4bd14112008f501a4783ca9..5c2a7ee0125178ee53b7d6f8c547a1e38fb94c26 100644
--- a/components/dom_distiller/core/distillable_page_detector.cc
+++ b/components/dom_distiller/core/distillable_page_detector.cc
@@ -41,6 +41,20 @@ const DistillablePageDetector* DistillablePageDetector::GetNewModel() {
return detector;
}
+const DistillablePageDetector* DistillablePageDetector::GetLongPageModel() {
+ static DistillablePageDetector* detector = nullptr;
+ if (!detector) {
+ std::string serialized_proto =
+ ResourceBundle::GetSharedInstance()
+ .GetRawDataResource(IDR_LONG_PAGE_SERIALIZED_MODEL)
+ .as_string();
+ scoped_ptr<AdaBoostProto> proto(new AdaBoostProto);
+ CHECK(proto->ParseFromString(serialized_proto));
+ detector = new DistillablePageDetector(std::move(proto));
+ }
+ return detector;
+}
+
DistillablePageDetector::DistillablePageDetector(
scoped_ptr<AdaBoostProto> proto)
: proto_(std::move(proto)), threshold_(0.0) {
« no previous file with comments | « components/dom_distiller/core/distillable_page_detector.h ('k') | components/resources/dom_distiller_resources.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698