1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/dom_distiller/core/experiments.h"
7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h"
9 #include "components/dom_distiller/core/dom_distiller_switches.h"
11 namespace dom_distiller
{
12 DistillerHeuristicsType
GetDistillerHeuristicsType() {
13 // Get the field trial name first to ensure the experiment is initialized.
14 const std::string group_name
=
15 base::FieldTrialList::FindFullName("ReaderModeUI");
16 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
17 switches::kEnableReaderModeOGArticleHeuristics
) ||
18 group_name
== "OGArticle" || group_name
== "ForcedOGArticle") {
19 return DistillerHeuristicsType::OG_ARTICLE
;
20 } else if (base::CommandLine::ForCurrentProcess()->HasSwitch(
21 switches::kEnableReaderModeAdaBoostHeuristics
) ||
22 group_name
== "AdaBoost" || group_name
== "ForcedAdaBoost") {
23 return DistillerHeuristicsType::ADABOOST_MODEL
;
25 return DistillerHeuristicsType::NONE
;