| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/previews/core/previews_experiments.h" | 5 #include "components/previews/core/previews_experiments.h" |
| 6 | 6 |
| 7 #include <string> | |
| 8 | |
| 9 #include "base/logging.h" | 7 #include "base/logging.h" |
| 10 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 11 #include "base/metrics/field_trial_params.h" | 9 #include "base/metrics/field_trial_params.h" |
| 12 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 14 | 12 |
| 15 namespace previews { | 13 namespace previews { |
| 16 | 14 |
| 17 namespace { | 15 namespace { |
| 18 | 16 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 164 |
| 167 bool IsIncludedInClientSidePreviewsExperimentsFieldTrial() { | 165 bool IsIncludedInClientSidePreviewsExperimentsFieldTrial() { |
| 168 // By convention, an experiment in the client-side previews study enables use | 166 // By convention, an experiment in the client-side previews study enables use |
| 169 // of at least one client-side previews optimization if its name begins with | 167 // of at least one client-side previews optimization if its name begins with |
| 170 // "Enabled." | 168 // "Enabled." |
| 171 return base::StartsWith( | 169 return base::StartsWith( |
| 172 base::FieldTrialList::FindFullName(kClientSidePreviewsFieldTrial), | 170 base::FieldTrialList::FindFullName(kClientSidePreviewsFieldTrial), |
| 173 kEnabled, base::CompareCase::SENSITIVE); | 171 kEnabled, base::CompareCase::SENSITIVE); |
| 174 } | 172 } |
| 175 | 173 |
| 174 std::string GetStringNameForType(PreviewsType type) { |
| 175 switch (type) { |
| 176 case PreviewsType::OFFLINE: |
| 177 return "Offline"; |
| 178 case PreviewsType::CLIENT_LOFI: |
| 179 return "ClientLoFi"; |
| 180 case PreviewsType::SERVER_LOFI: |
| 181 return "LoFi"; |
| 182 case PreviewsType::LITE_PAGE: |
| 183 return "LitePage"; |
| 184 case PreviewsType::NONE: |
| 185 case PreviewsType::LAST: |
| 186 break; |
| 187 } |
| 188 NOTREACHED(); |
| 189 return std::string(); |
| 190 } |
| 191 |
| 176 } // namespace previews | 192 } // namespace previews |
| OLD | NEW |