Commit 095fd6db authored by Joe Downing's avatar Joe Downing Committed by Commit Bot

Adding a Feature flag for the KeyboardLock API

This flag will be used for development / testing of the KeyboardLock
feature.  My plan is to have something available for testing (but
behind the flag) in M66.  We also plan to use this flag for rolling
out the change when it is ready for launch.

BUG=680809

Change-Id: I2e4f7ea16c458cab053a998ae1de4d9d7ab7fbec
Reviewed-on: https://chromium-review.googlesource.com/896022
Commit-Queue: Joe Downing <joedow@chromium.org>
Reviewed-by: default avatarGary Kacmarcik <garykac@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533750}
parent f1de72dd
......@@ -2261,6 +2261,9 @@ const FeatureEntry kFeatureEntries[] = {
flag_descriptions::kSimplifiedFullscreenUiDescription,
kOsWin | kOsLinux | kOsCrOS,
FEATURE_VALUE_TYPE(features::kSimplifiedFullscreenUI)},
{"keyboard-lock-api", flag_descriptions::kKeyboardLockApiName,
flag_descriptions::kKeyboardLockApiDescription, kOsWin,
FEATURE_VALUE_TYPE(features::kKeyboardLockAPI)},
{"experimental-keyboard-lock-ui",
flag_descriptions::kExperimentalKeyboardLockUiName,
flag_descriptions::kExperimentalKeyboardLockUiDescription, kOsDesktop,
......
......@@ -828,6 +828,12 @@ const char kKeepAliveRendererForKeepaliveRequestsDescription[] =
"Keep a render process alive when the process has a pending fetch request "
"with `keepalive' specified.";
const char kKeyboardLockApiName[] = "Experimental keyboard lock API.";
const char kKeyboardLockApiDescription[] =
"Enables websites to use the new keyboard{Lock|Unlock} API to intercept "
"specific key events and have them routed directly to the webpage when in "
"fullscreen mode. Implies #experimental-keyboard-lock-ui.";
const char kLcdTextName[] = "LCD text antialiasing";
const char kLcdTextDescription[] =
"If disabled, text is rendered with grayscale antialiasing instead of LCD "
......
......@@ -518,6 +518,9 @@ extern const char kJavascriptHarmonyShippingDescription[];
extern const char kKeepAliveRendererForKeepaliveRequestsName[];
extern const char kKeepAliveRendererForKeepaliveRequestsDescription[];
extern const char kKeyboardLockApiName[];
extern const char kKeyboardLockApiDescription[];
extern const char kLcdTextName[];
extern const char kLcdTextDescription[];
......
......@@ -15,6 +15,7 @@
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/common/content_features.h"
#include "ui/events/keycodes/keyboard_codes.h"
using content::WebContents;
......@@ -98,7 +99,8 @@ GURL ExclusiveAccessManager::GetExclusiveAccessBubbleURL() const {
// static
bool ExclusiveAccessManager::IsExperimentalKeyboardLockUIEnabled() {
return base::FeatureList::IsEnabled(features::kExperimentalKeyboardLockUI);
return base::FeatureList::IsEnabled(features::kKeyboardLockAPI) ||
base::FeatureList::IsEnabled(features::kExperimentalKeyboardLockUI);
}
// static
......
......@@ -396,6 +396,9 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs(
"FeaturePolicyForPermissions",
base::FeatureList::IsEnabled(features::kUseFeaturePolicyForPermissions));
if (base::FeatureList::IsEnabled(features::kKeyboardLockAPI))
WebRuntimeFeatures::EnableFeatureFromString("KeyboardLock", true);
// Enable explicitly enabled features, and then disable explicitly disabled
// ones.
for (const std::string& feature :
......
......@@ -137,6 +137,11 @@ const base::Feature kGuestViewCrossProcessFrames{
const base::Feature kHeapCompaction{"HeapCompaction",
base::FEATURE_DISABLED_BY_DEFAULT};
// Enables an API which allows websites to capture reserved keys in fullscreen.
// Defined by w3c here: https://w3c.github.io/keyboard-lock/
const base::Feature kKeyboardLockAPI{"KeyboardLockAPI",
base::FEATURE_DISABLED_BY_DEFAULT};
// Enable lazy initialization of the media controls.
const base::Feature kLazyInitializeMediaControls{
"LazyInitializeMediaControls", base::FEATURE_ENABLED_BY_DEFAULT};
......
......@@ -47,6 +47,7 @@ CONTENT_EXPORT extern const base::Feature kIsolateOrigins;
CONTENT_EXPORT extern const char kIsolateOriginsFieldTrialParamName[];
CONTENT_EXPORT extern const base::Feature
kKeepAliveRendererForKeepaliveRequests;
CONTENT_EXPORT extern const base::Feature kKeyboardLockAPI;
CONTENT_EXPORT extern const base::Feature kLazyInitializeMediaControls;
CONTENT_EXPORT extern const base::Feature kLazyParseCSS;
CONTENT_EXPORT extern const base::Feature kLowPriorityIframes;
......
......@@ -25592,6 +25592,7 @@ from previous Chrome versions.
<int value="-1340055960" label="enable-streamlined-hosted-apps"/>
<int value="-1338306372" label="BrowserTouchBar:enabled"/>
<int value="-1337185440" label="enable-webvr"/>
<int value="-1335017208" label="KeyboardLockAPI:enabled"/>
<int value="-1334327410" label="ash-enable-touch-view-testing"/>
<int value="-1327676774" label="disable-accelerated-mjpeg-decode"/>
<int value="-1325887476" label="NewPrintPreview:enabled"/>
......@@ -26059,6 +26060,7 @@ from previous Chrome versions.
<int value="-112459802" label="WebXrRenderPath:enabled"/>
<int value="-110756896"
label="NTPArticleSuggestionsExpandableHeader:enabled"/>
<int value="-110726049" label="KeyboardLockAPI:disabled"/>
<int value="-110465424" label="PictureInPicture:enabled"/>
<int value="-108881882" label="NTPCondensedTileLayout:enabled"/>
<int value="-102537270" label="extension-content-verification"/>
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