|
@@ -1,185 +0,0 @@
|
|
|
-From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
|
|
-Date: Mon, 22 Oct 2018 21:29:53 +0200
|
|
|
-Subject: Add flags to disable device motion/orientation APIs
|
|
|
-
|
|
|
-Both flags will be disabled by default and prevent usage of gyroscope and
|
|
|
-legacy acceleration events.
|
|
|
----
|
|
|
- chrome/browser/about_flags.cc | 6 ++++++
|
|
|
- chrome/browser/flag_descriptions.cc | 8 ++++++++
|
|
|
- chrome/browser/flag_descriptions.h | 6 ++++++
|
|
|
- content/child/runtime_features.cc | 3 +++
|
|
|
- content/public/common/content_features.cc | 10 ++++++++++
|
|
|
- content/public/common/content_features.h | 2 ++
|
|
|
- .../blink/public/platform/web_runtime_features.h | 2 ++
|
|
|
- .../blink/renderer/modules/modules_initializer.cc | 10 +++++++---
|
|
|
- .../renderer/platform/exported/web_runtime_features.cc | 8 ++++++++
|
|
|
- .../renderer/platform/runtime_enabled_features.json5 | 8 ++++++++
|
|
|
- 10 files changed, 60 insertions(+), 3 deletions(-)
|
|
|
-
|
|
|
-diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
|
|
---- a/chrome/browser/about_flags.cc
|
|
|
-+++ b/chrome/browser/about_flags.cc
|
|
|
-@@ -2848,6 +2848,12 @@ const FeatureEntry kFeatureEntries[] = {
|
|
|
- {"enable-gpu-rasterization", flag_descriptions::kGpuRasterizationName,
|
|
|
- flag_descriptions::kGpuRasterizationDescription, kOsAll,
|
|
|
- MULTI_VALUE_TYPE(kEnableGpuRasterizationChoices)},
|
|
|
-+ {"enable-device-motion", flag_descriptions::kEnableDeviceMotionName,
|
|
|
-+ flag_descriptions::kEnableDeviceMotionDescription, kOsAll,
|
|
|
-+ FEATURE_VALUE_TYPE(features::kDeviceMotion)},
|
|
|
-+ {"enable-device-orientation", flag_descriptions::kEnableDeviceOrientationName,
|
|
|
-+ flag_descriptions::kEnableDeviceOrientationDescription, kOsAll,
|
|
|
-+ FEATURE_VALUE_TYPE(features::kDeviceOrientation)},
|
|
|
- {"enable-oop-rasterization", flag_descriptions::kOopRasterizationName,
|
|
|
- flag_descriptions::kOopRasterizationDescription, kOsAll,
|
|
|
- MULTI_VALUE_TYPE(kEnableOopRasterizationChoices)},
|
|
|
-diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
|
|
|
---- a/chrome/browser/flag_descriptions.cc
|
|
|
-+++ b/chrome/browser/flag_descriptions.cc
|
|
|
-@@ -844,6 +844,14 @@ const char kWinrtGeolocationImplementationDescription[] =
|
|
|
- "Enables usage of the Windows.Devices.Geolocation WinRT APIs on Windows "
|
|
|
- "for geolocation";
|
|
|
-
|
|
|
-+const char kEnableDeviceMotionName[] = "Enable device motion";
|
|
|
-+const char kEnableDeviceMotionDescription[] =
|
|
|
-+ "Enable device motion API which is used to detect changes in acceleration";
|
|
|
-+
|
|
|
-+const char kEnableDeviceOrientationName[] = "Enable device orientation";
|
|
|
-+const char kEnableDeviceOrientationDescription[] =
|
|
|
-+ "Enable device orientation API which is used to detect changes in orientation";
|
|
|
-+
|
|
|
- const char kEnableGenericSensorExtraClassesName[] =
|
|
|
- "Generic Sensor Extra Classes";
|
|
|
- const char kEnableGenericSensorExtraClassesDescription[] =
|
|
|
-diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
|
|
|
---- a/chrome/browser/flag_descriptions.h
|
|
|
-+++ b/chrome/browser/flag_descriptions.h
|
|
|
-@@ -505,6 +505,12 @@ extern const char kNotificationsViaHelperAppDescription[];
|
|
|
- extern const char kWinrtGeolocationImplementationName[];
|
|
|
- extern const char kWinrtGeolocationImplementationDescription[];
|
|
|
-
|
|
|
-+extern const char kEnableDeviceMotionName[];
|
|
|
-+extern const char kEnableDeviceMotionDescription[];
|
|
|
-+
|
|
|
-+extern const char kEnableDeviceOrientationName[];
|
|
|
-+extern const char kEnableDeviceOrientationDescription[];
|
|
|
-+
|
|
|
- extern const char kEnableGenericSensorExtraClassesName[];
|
|
|
- extern const char kEnableGenericSensorExtraClassesDescription[];
|
|
|
-
|
|
|
-diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc
|
|
|
---- a/content/child/runtime_features.cc
|
|
|
-+++ b/content/child/runtime_features.cc
|
|
|
-@@ -89,6 +89,9 @@ void SetRuntimeFeatureDefaultsForPlatform(
|
|
|
- command_line.HasSwitch(
|
|
|
- blink::switches::kEnableGpuMemoryBufferCompositorResources) &&
|
|
|
- !command_line.HasSwitch(switches::kDisableWebGLImageChromium) &&
|
|
|
-+ WebRuntimeFeatures::EnableDeviceMotion(base::FeatureList::IsEnabled(features::kDeviceMotion));
|
|
|
-+ WebRuntimeFeatures::EnableDeviceOrientation(base::FeatureList::IsEnabled(features::kDeviceOrientation));
|
|
|
-+
|
|
|
- !command_line.HasSwitch(switches::kDisableGpu) &&
|
|
|
- base::FeatureList::IsEnabled(features::kWebGLImageChromium);
|
|
|
- #else
|
|
|
-diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc
|
|
|
---- a/content/public/common/content_features.cc
|
|
|
-+++ b/content/public/common/content_features.cc
|
|
|
-@@ -890,6 +890,16 @@ const base::Feature kWebOtpBackendAuto{"WebOtpBackendAuto",
|
|
|
- // The JavaScript API for payments on the web.
|
|
|
- const base::Feature kWebPayments{"WebPayments",
|
|
|
- base::FEATURE_ENABLED_BY_DEFAULT};
|
|
|
-+// Enables the device motion API used to track device acceleration;
|
|
|
-+// no user authorization or notifications happens when in use.
|
|
|
-+const base::Feature kDeviceMotion{"DeviceMotion",
|
|
|
-+ base::FEATURE_DISABLED_BY_DEFAULT};
|
|
|
-+
|
|
|
-+// Enables the device orientation API used to track device orientation;
|
|
|
-+// no user authorization or notifications happens when in use.
|
|
|
-+const base::Feature kDeviceOrientation{"DeviceOrientation",
|
|
|
-+ base::FEATURE_DISABLED_BY_DEFAULT};
|
|
|
-+
|
|
|
-
|
|
|
- // Minimal user interface experience for payments on the web.
|
|
|
- const base::Feature kWebPaymentsMinimalUI{"WebPaymentsMinimalUI",
|
|
|
-diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h
|
|
|
---- a/content/public/common/content_features.h
|
|
|
-+++ b/content/public/common/content_features.h
|
|
|
-@@ -212,6 +212,8 @@ CONTENT_EXPORT extern const base::Feature kWebXrHandInput;
|
|
|
- CONTENT_EXPORT extern const base::Feature kWebXrHitTest;
|
|
|
- CONTENT_EXPORT extern const base::Feature kWebXrIncubations;
|
|
|
-
|
|
|
-+CONTENT_EXPORT extern const base::Feature kDeviceMotion, kDeviceOrientation;
|
|
|
-+
|
|
|
- #if defined(OS_ANDROID)
|
|
|
- CONTENT_EXPORT extern const base::Feature kAndroidAutofillAccessibility;
|
|
|
- CONTENT_EXPORT extern const base::Feature
|
|
|
-diff --git a/third_party/blink/public/platform/web_runtime_features.h b/third_party/blink/public/platform/web_runtime_features.h
|
|
|
---- a/third_party/blink/public/platform/web_runtime_features.h
|
|
|
-+++ b/third_party/blink/public/platform/web_runtime_features.h
|
|
|
-@@ -97,6 +97,8 @@ class WebRuntimeFeatures {
|
|
|
- BLINK_PLATFORM_EXPORT static void EnableCookiesWithoutSameSiteMustBeSecure(
|
|
|
- bool);
|
|
|
- BLINK_PLATFORM_EXPORT static void EnableCanvas2dImageChromium(bool);
|
|
|
-+ BLINK_PLATFORM_EXPORT static void EnableDeviceMotion(bool);
|
|
|
-+ BLINK_PLATFORM_EXPORT static void EnableDeviceOrientation(bool);
|
|
|
- BLINK_PLATFORM_EXPORT static void EnableCooperativeScheduling(bool);
|
|
|
- BLINK_PLATFORM_EXPORT static void EnableCSSHexAlphaColor(bool);
|
|
|
- BLINK_PLATFORM_EXPORT static void EnableSameSiteByDefaultCookies(bool);
|
|
|
-diff --git a/third_party/blink/renderer/modules/modules_initializer.cc b/third_party/blink/renderer/modules/modules_initializer.cc
|
|
|
---- a/third_party/blink/renderer/modules/modules_initializer.cc
|
|
|
-+++ b/third_party/blink/renderer/modules/modules_initializer.cc
|
|
|
-@@ -231,9 +231,13 @@ void ModulesInitializer::OnClearWindowObjectInMainWorld(
|
|
|
- Document& document,
|
|
|
- const Settings& settings) const {
|
|
|
- LocalDOMWindow& window = *document.domWindow();
|
|
|
-- DeviceMotionController::From(window);
|
|
|
-- DeviceOrientationController::From(window);
|
|
|
-- DeviceOrientationAbsoluteController::From(window);
|
|
|
-+ if (RuntimeEnabledFeatures::DeviceMotionEnabled())
|
|
|
-+ DeviceMotionController::From(window);
|
|
|
-+ if (RuntimeEnabledFeatures::DeviceOrientationEnabled()) {
|
|
|
-+ DeviceOrientationController::From(window);
|
|
|
-+ DeviceOrientationAbsoluteController::From(window);
|
|
|
-+ }
|
|
|
-+
|
|
|
- NavigatorGamepad::From(*window.navigator());
|
|
|
-
|
|
|
- // TODO(nhiroki): Figure out why ServiceWorkerContainer needs to be eagerly
|
|
|
-diff --git a/third_party/blink/renderer/platform/exported/web_runtime_features.cc b/third_party/blink/renderer/platform/exported/web_runtime_features.cc
|
|
|
---- a/third_party/blink/renderer/platform/exported/web_runtime_features.cc
|
|
|
-+++ b/third_party/blink/renderer/platform/exported/web_runtime_features.cc
|
|
|
-@@ -187,6 +187,14 @@ void WebRuntimeFeatures::EnableKeyboardAccessibleTooltip(bool enable) {
|
|
|
- RuntimeEnabledFeatures::SetKeyboardAccessibleTooltipEnabled(enable);
|
|
|
- }
|
|
|
-
|
|
|
-+void WebRuntimeFeatures::EnableDeviceMotion(bool enable) {
|
|
|
-+ RuntimeEnabledFeatures::SetDeviceMotionEnabled(enable);
|
|
|
-+}
|
|
|
-+
|
|
|
-+void WebRuntimeFeatures::EnableDeviceOrientation(bool enable) {
|
|
|
-+ RuntimeEnabledFeatures::SetDeviceOrientationEnabled(enable);
|
|
|
-+}
|
|
|
-+
|
|
|
- void WebRuntimeFeatures::EnableKeyboardFocusableScrollers(bool enable) {
|
|
|
- RuntimeEnabledFeatures::SetKeyboardFocusableScrollersEnabled(enable);
|
|
|
- }
|
|
|
-diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
|
|
---- a/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
|
|
-+++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
|
|
-@@ -1423,6 +1423,14 @@
|
|
|
- name: "OffscreenCanvasCommit",
|
|
|
- status: "experimental",
|
|
|
- },
|
|
|
-+ {
|
|
|
-+ name: "DeviceMotion",
|
|
|
-+ status: "stable",
|
|
|
-+ },
|
|
|
-+ {
|
|
|
-+ name: "DeviceOrientation",
|
|
|
-+ status: "stable",
|
|
|
-+ },
|
|
|
- {
|
|
|
- name: "OnDeviceChange",
|
|
|
- // Android does not yet support SystemMonitor.
|
|
|
---
|
|
|
-2.17.1
|
|
|
-
|