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

Unified Diff: ios/chrome/browser/experimental_flags.mm

Issue 1144803002: [iOS] Upstream switches and flags controlling which WebView is used (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/experimental_flags.h ('k') | ios/chrome/browser/web/web_view_type_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/experimental_flags.mm
diff --git a/ios/chrome/browser/experimental_flags.mm b/ios/chrome/browser/experimental_flags.mm
index 6adfb739566cd02c8f21b3061d8d0347c97eb8c2..5fd5926b221ac0801702b117c4cf16aaaa14cbbc 100644
--- a/ios/chrome/browser/experimental_flags.mm
+++ b/ios/chrome/browser/experimental_flags.mm
@@ -12,8 +12,10 @@
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_util.h"
#include "components/variations/variations_associated_data.h"
#include "ios/chrome/browser/chrome_switches.h"
+#include "ios/web/public/web_view_util.h"
namespace {
NSString* const kEnableAlertOnBackgroundUpload =
@@ -32,6 +34,28 @@ bool IsOpenFromClipboardEnabled() {
return command_line->HasSwitch(switches::kEnableIOSOpenFromClipboard);
}
+bool IsWKWebViewEnabled() {
+ // If WKWebView isn't supported, don't activate the experiment at all. This
+ // avoids someone being slotted into the WKWebView bucket (and thus reporting
+ // as WKWebView), but actually running UIWebView.
+ if (!web::IsWKWebViewSupported())
+ return false;
+
+ std::string group_name =
+ base::FieldTrialList::FindFullName("IOSUseWKWebView");
+
+ // First check if the experimental flag is turned on.
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kEnableIOSWKWebView)) {
+ return true;
+ } else if (command_line->HasSwitch(switches::kDisableIOSWKWebView)) {
+ return false;
+ }
+
+ // Check if the finch experiment is turned on.
+ return StartsWithASCII(group_name, "Enabled", false);
+}
+
size_t MemoryWedgeSizeInMB() {
std::string wedge_size_string;
« no previous file with comments | « ios/chrome/browser/experimental_flags.h ('k') | ios/chrome/browser/web/web_view_type_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698