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 29 matching lines...) Expand all Loading... |
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", | 43 if (base::StartsWith(group_name, "Disabled", |
44 base::CompareCase::INSENSITIVE_ASCII)) { | 44 base::CompareCase::INSENSITIVE_ASCII)) { |
45 return DistillerHeuristicsType::NONE; | 45 return DistillerHeuristicsType::NONE; |
46 } | 46 } |
47 } | 47 } |
48 return DistillerHeuristicsType::ADABOOST_MODEL; | 48 return DistillerHeuristicsType::ADABOOST_MODEL; |
49 } | 49 } |
50 | |
51 bool ShouldShowFeedbackForm() { | |
52 const std::string group_name = | |
53 base::FieldTrialList::FindFullName("ReaderModeUIFeedback"); | |
54 const std::string switch_value = | |
55 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
56 switches::kReaderModeFeedback); | |
57 if (switch_value != "") { | |
58 if (switch_value == switches::reader_mode_feedback::kOn) { | |
59 return true; | |
60 } | |
61 if (switch_value == switches::reader_mode_feedback::kOff) { | |
62 return false; | |
63 } | |
64 NOTREACHED() << "Invalid value for " << switches::kReaderModeFeedback; | |
65 } else { | |
66 if (group_name == "DoNotShow") { | |
67 return false; | |
68 } | |
69 if (group_name == "Show") { | |
70 return true; | |
71 } | |
72 } | |
73 return false; | |
74 } | 50 } |
75 } | |
OLD | NEW |