Commit 98e594cc authored by edchin's avatar edchin Committed by Commit Bot

[ios] Add experiment flag for WKWebView snapshotting

This CL simply adds the flag so that it can be used in
a future CL. This flag controls whether the WKWebView
snapshotting API is used to take snapshots for web pages
(not native pages) on iOS 11+.

The crbug to remove the flag is crbug.com/885003.

Bug: 739840
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: Id00c4da93f5046e4a2b2af179abe3794a99a248e
Reviewed-on: https://chromium-review.googlesource.com/1229703
Commit-Queue: edchin <edchin@chromium.org>
Reviewed-by: default avataredchin <edchin@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592108}
parent d867f894
......@@ -34,6 +34,10 @@ bool DisableUpdateService() {
bool ForceUIRefreshPhase1() {
return false;
}
// TODO(crbug.com/885003) : Remove this hook.
bool ForceWKWebViewSnapshots() {
return false;
}
void SetUpTestsIfPresent() {}
void RunTestsIfPresent() {}
......
......@@ -41,6 +41,11 @@ bool DisableUpdateService();
// overriding the flag value.
bool ForceUIRefreshPhase1();
// TODO(crbug.com/885003) : Remove this hook.
// Returns true if the WKWebView snapshotting API will be used, overriding the
// flag value.
bool ForceWKWebViewSnapshots();
// Global integration tests setup. This is not used by EarlGrey-based
// integration tests.
void SetUpTestsIfPresent();
......
......@@ -387,6 +387,9 @@ const flags_ui::FeatureEntry kFeatureEntries[] = {
{"sso-with-wkwebview", flag_descriptions::kSSOWithWKWebViewName,
flag_descriptions::kSSOWithWKWebViewDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(kSSOWithWKWebView)},
{"wk-web-view-snapshots", flag_descriptions::kWKWebViewSnapshotsName,
flag_descriptions::kWKWebViewSnapshotsDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(kWKWebViewSnapshots)},
};
// Add all switches from experimental flags to |command_line|.
......
......@@ -295,6 +295,10 @@ const char kWKHTTPSystemCookieStoreName[] = "Use WKHTTPSystemCookieStore.";
const char kWKHTTPSystemCookieStoreDescription[] =
"Use WKHTTPCookieStore backed store for main context URL requests.";
const char kWKWebViewSnapshotsName[] = "WKWebView Snapshots";
const char kWKWebViewSnapshotsDescription[] =
"When enabled, the WKWebView snapshotting API is used for iOS 11+.";
// Please insert your name/description above in alphabetical order.
} // namespace flag_descriptions
......@@ -246,6 +246,10 @@ extern const char kWebPaymentsNativeAppsDescription[];
extern const char kWKHTTPSystemCookieStoreName[];
extern const char kWKHTTPSystemCookieStoreDescription[];
// Title and description for the flag to use the WKWebView snapshotting API.
extern const char kWKWebViewSnapshotsName[];
extern const char kWKWebViewSnapshotsDescription[];
// Please insert your name/description above in alphabetical order.
} // namespace flag_descriptions
......
......@@ -42,6 +42,11 @@ bool ForceUIRefreshPhase1() {
return true;
}
// TODO(crbug.com/885003) : Remove this hook.
bool ForceWKWebViewSnapshots() {
return false;
}
void SetUpTestsIfPresent() {
// No-op for Earl Grey.
}
......
......@@ -42,6 +42,11 @@ bool ForceUIRefreshPhase1() {
return true;
}
// TODO(crbug.com/885003) : Remove this hook.
bool ForceWKWebViewSnapshots() {
return false;
}
void SetUpTestsIfPresent() {
// No-op for Earl Grey.
}
......
......@@ -8,3 +8,6 @@ const base::Feature kFirstResponderKeyWindow{"FirstResponderKeyWindow",
base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kCopyImage{"CopyImage", base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kWKWebViewSnapshots{"WKWebViewSnapshots",
base::FEATURE_DISABLED_BY_DEFAULT};
......@@ -15,4 +15,7 @@ extern const base::Feature kFirstResponderKeyWindow;
// Feature to copy image to system pasteboard via context menu.
extern const base::Feature kCopyImage;
// Used to enable using the WKWebView snapshotting API for iOS 11+.
extern const base::Feature kWKWebViewSnapshots;
#endif // IOS_CHROME_BROWSER_UI_UI_FEATURE_FLAGS_H_
......@@ -55,6 +55,9 @@ bool IsRefreshPopupPresentationEnabled();
// TODO (crbug.com/884725): Remove all use of this flag.
bool IsUIRefreshPhase1Enabled();
// Returns whether the WKWebView snapshotting API will be used for iOS 11+.
bool IsWKWebViewSnapshotsEnabled();
// Returns the height of the status bar, accounting for orientation.
CGFloat StatusBarHeight();
......
......@@ -74,6 +74,13 @@ bool IsUIRefreshPhase1Enabled() {
return true;
}
// TODO(crbug.com/885003) : Remove this flag.
bool IsWKWebViewSnapshotsEnabled() {
if (tests_hook::ForceWKWebViewSnapshots())
return true;
return base::FeatureList::IsEnabled(kWKWebViewSnapshots);
}
CGFloat StatusBarHeight() {
// This is a temporary solution until usage of StatusBarHeight has been
// replaced with topLayoutGuide.
......
......@@ -42,6 +42,11 @@ bool ForceUIRefreshPhase1() {
return false;
}
// TODO(crbug.com/885003) : Remove this hook.
bool ForceWKWebViewSnapshots() {
return false;
}
void SetUpTestsIfPresent() {
// No-op for Earl Grey.
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment