| 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 // This file can be empty. Its purpose is to contain the relatively short lived | 5 // This file can be empty. Its purpose is to contain the relatively short lived |
| 6 // definitions required for experimental flags. | 6 // definitions required for experimental flags. |
| 7 | 7 |
| 8 #include "ios/chrome/browser/experimental_flags.h" | 8 #include "ios/chrome/browser/experimental_flags.h" |
| 9 | 9 |
| 10 #include <dispatch/dispatch.h> | 10 #include <dispatch/dispatch.h> |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 return; | 135 return; |
| 136 } | 136 } |
| 137 | 137 |
| 138 ok_to_check_finch = true; | 138 ok_to_check_finch = true; |
| 139 }); | 139 }); |
| 140 | 140 |
| 141 return ok_to_check_finch; | 141 return ok_to_check_finch; |
| 142 } | 142 } |
| 143 | 143 |
| 144 bool IsWKWebViewEnabled() { | 144 bool IsWKWebViewEnabled() { |
| 145 if (!CanCheckWKWebViewExperiment()) { | 145 return true; |
| 146 return false; | |
| 147 } | |
| 148 | |
| 149 // Now that it's been established that user is a candidate, set up the trial | |
| 150 // by checking the group. | |
| 151 std::string group_name = | |
| 152 base::FieldTrialList::FindFullName(kWKWebViewTrialName); | |
| 153 | |
| 154 // Check if the experimental flag is turned on. | |
| 155 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 156 if (command_line->HasSwitch(switches::kEnableIOSWKWebView)) | |
| 157 return true; | |
| 158 else if (command_line->HasSwitch(switches::kDisableIOSWKWebView)) | |
| 159 return false; | |
| 160 | |
| 161 // Check if the finch experiment is turned on. | |
| 162 return !base::StartsWith(group_name, "Disabled", | |
| 163 base::CompareCase::INSENSITIVE_ASCII) && | |
| 164 !base::StartsWith(group_name, "Control", | |
| 165 base::CompareCase::INSENSITIVE_ASCII); | |
| 166 } | 146 } |
| 167 | 147 |
| 168 bool IsTargetedToWKWebViewExperimentControlGroup() { | 148 bool IsTargetedToWKWebViewExperimentControlGroup() { |
| 169 base::FieldTrial* trial = base::FieldTrialList::Find(kWKWebViewTrialName); | 149 base::FieldTrial* trial = base::FieldTrialList::Find(kWKWebViewTrialName); |
| 170 if (!trial) | 150 if (!trial) |
| 171 return false; | 151 return false; |
| 172 std::string group_name = trial->GetGroupNameWithoutActivation(); | 152 std::string group_name = trial->GetGroupNameWithoutActivation(); |
| 173 return base::StartsWith(group_name, "Control", | 153 return base::StartsWith(group_name, "Control", |
| 174 base::CompareCase::INSENSITIVE_ASCII); | 154 base::CompareCase::INSENSITIVE_ASCII); |
| 175 } | 155 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 return false; | 204 return false; |
| 225 } | 205 } |
| 226 | 206 |
| 227 // Check if the finch experiment is turned on. | 207 // Check if the finch experiment is turned on. |
| 228 std::string group_name = base::FieldTrialList::FindFullName("IOSTabSwitcher"); | 208 std::string group_name = base::FieldTrialList::FindFullName("IOSTabSwitcher"); |
| 229 return base::StartsWith(group_name, "Enabled", | 209 return base::StartsWith(group_name, "Enabled", |
| 230 base::CompareCase::INSENSITIVE_ASCII); | 210 base::CompareCase::INSENSITIVE_ASCII); |
| 231 } | 211 } |
| 232 | 212 |
| 233 } // namespace experimental_flags | 213 } // namespace experimental_flags |
| OLD | NEW |