| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/dom_distiller/core/experiments.h" | 5 #include "components/dom_distiller/core/experiments.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "components/dom_distiller/core/dom_distiller_switches.h" | 10 #include "components/dom_distiller/core/dom_distiller_switches.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 NOTREACHED() << "Invalid value for " << switches::kReaderModeHeuristics; | 33 NOTREACHED() << "Invalid value for " << switches::kReaderModeHeuristics; |
| 34 } else { | 34 } else { |
| 35 if (base::StartsWith(group_name, "AdaBoost", | 35 if (base::StartsWith(group_name, "AdaBoost", |
| 36 base::CompareCase::INSENSITIVE_ASCII)) { | 36 base::CompareCase::INSENSITIVE_ASCII)) { |
| 37 return DistillerHeuristicsType::ADABOOST_MODEL; | 37 return DistillerHeuristicsType::ADABOOST_MODEL; |
| 38 } | 38 } |
| 39 if (base::StartsWith(group_name, "OGArticle", | 39 if (base::StartsWith(group_name, "OGArticle", |
| 40 base::CompareCase::INSENSITIVE_ASCII)) { | 40 base::CompareCase::INSENSITIVE_ASCII)) { |
| 41 return DistillerHeuristicsType::OG_ARTICLE; | 41 return DistillerHeuristicsType::OG_ARTICLE; |
| 42 } | 42 } |
| 43 if (base::StartsWith(group_name, "Disabled", |
| 44 base::CompareCase::INSENSITIVE_ASCII)) { |
| 45 return DistillerHeuristicsType::NONE; |
| 46 } |
| 43 } | 47 } |
| 44 return DistillerHeuristicsType::NONE; | 48 return DistillerHeuristicsType::ADABOOST_MODEL; |
| 45 } | 49 } |
| 46 | 50 |
| 47 bool ShouldShowFeedbackForm() { | 51 bool ShouldShowFeedbackForm() { |
| 48 const std::string group_name = | 52 const std::string group_name = |
| 49 base::FieldTrialList::FindFullName("ReaderModeUIFeedback"); | 53 base::FieldTrialList::FindFullName("ReaderModeUIFeedback"); |
| 50 const std::string switch_value = | 54 const std::string switch_value = |
| 51 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 55 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 52 switches::kReaderModeFeedback); | 56 switches::kReaderModeFeedback); |
| 53 if (switch_value != "") { | 57 if (switch_value != "") { |
| 54 if (switch_value == switches::reader_mode_feedback::kOn) { | 58 if (switch_value == switches::reader_mode_feedback::kOn) { |
| 55 return true; | 59 return true; |
| 56 } | 60 } |
| 57 if (switch_value == switches::reader_mode_feedback::kOff) { | 61 if (switch_value == switches::reader_mode_feedback::kOff) { |
| 58 return false; | 62 return false; |
| 59 } | 63 } |
| 60 NOTREACHED() << "Invalid value for " << switches::kReaderModeFeedback; | 64 NOTREACHED() << "Invalid value for " << switches::kReaderModeFeedback; |
| 61 } else { | 65 } else { |
| 62 if (group_name == "DoNotShow") { | 66 if (group_name == "DoNotShow") { |
| 63 return false; | 67 return false; |
| 64 } | 68 } |
| 65 if (group_name == "Show") { | 69 if (group_name == "Show") { |
| 66 return true; | 70 return true; |
| 67 } | 71 } |
| 68 } | 72 } |
| 69 return false; | 73 return false; |
| 70 } | 74 } |
| 71 } | 75 } |
| OLD | NEW |