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

Unified Diff: components/dom_distiller/content/distillable_page_utils.cc

Issue 1051673002: Add flags and experiment config for selecting triggering heuristics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dd-heuristics-apply
Patch Set: rebase Created 5 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
« no previous file with comments | « components/dom_distiller/content/distillable_page_utils.h ('k') | components/dom_distiller/core/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/content/distillable_page_utils.cc
diff --git a/components/dom_distiller/content/distillable_page_utils.cc b/components/dom_distiller/content/distillable_page_utils.cc
index 7f1b3ccc53b470a6c2521ccf0e34eefac486231a..520299223ce033a73461fcf4617e3245cad8be6f 100644
--- a/components/dom_distiller/content/distillable_page_utils.cc
+++ b/components/dom_distiller/content/distillable_page_utils.cc
@@ -9,6 +9,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "components/dom_distiller/core/distillable_page_detector.h"
+#include "components/dom_distiller/core/experiments.h"
#include "components/dom_distiller/core/page_features.h"
#include "content/public/browser/render_frame_host.h"
#include "grit/components_resources.h"
@@ -49,8 +50,19 @@ void IsOpenGraphArticle(content::WebContents* web_contents,
void IsDistillablePage(content::WebContents* web_contents,
base::Callback<void(bool)> callback) {
- IsDistillablePageForDetector(web_contents,
- DistillablePageDetector::GetDefault(), callback);
+ switch (GetDistillerHeuristicsType()) {
+ case DistillerHeuristicsType::NONE:
+ base::MessageLoop::current()->PostTask(FROM_HERE,
+ base::Bind(callback, false));
+ return;
+ case DistillerHeuristicsType::OG_ARTICLE:
+ IsOpenGraphArticle(web_contents, callback);
+ return;
+ case DistillerHeuristicsType::ADABOOST_MODEL:
+ IsDistillablePageForDetector(
+ web_contents, DistillablePageDetector::GetDefault(), callback);
+ return;
+ }
}
void IsDistillablePageForDetector(content::WebContents* web_contents,
« no previous file with comments | « components/dom_distiller/content/distillable_page_utils.h ('k') | components/dom_distiller/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698