Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Side by Side Diff: ios/chrome/browser/experimental_flags.mm

Issue 1625633003: Make IsWKWebViewEnabled not query field trial, command line flags. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/experimental_flags.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ios/chrome/browser/experimental_flags.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698