Commit 6a494979 authored by Alexander Cooper's avatar Alexander Cooper Committed by Commit Bot

Move VR Runtime features to device/base/features.h

As part of the refactor to move the VRService into content, the isolated
device service will need to move from chrome/services to
components/services and from chrome/utility/services to
content/utility/services. At that time, XRRuntimeProvider will no longer
be able to use anything from either chrome_features or content_features.
While it is a pattern for components to define their own features, these
features indicate the support of an implemented runtime, and thus make
more sense being implemented at this layer.

Bug: 1031622
Change-Id: I7649bf5c20a2973ca4eaa818fa05a76a7f8432d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2108964
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#751864}
parent 4e141241
......@@ -189,6 +189,7 @@ component("vr_ui") {
"//components/omnibox/browser:vector_icons",
"//components/url_formatter",
"//components/vector_icons",
"//device/base",
"//device/vr/buildflags:buildflags",
"//media",
"//net",
......
......@@ -130,10 +130,10 @@ void WebXrVrBrowserTestBase::SetupFakeConsentManager(
WebXrVrRuntimelessBrowserTest::WebXrVrRuntimelessBrowserTest() {
#if BUILDFLAG(ENABLE_WINDOWS_MR)
disable_features_.push_back(features::kWindowsMixedReality);
disable_features_.push_back(device::features::kWindowsMixedReality);
#endif
#if BUILDFLAG(ENABLE_OPENXR)
disable_features_.push_back(features::kOpenXR);
disable_features_.push_back(device::features::kOpenXR);
#endif
}
......@@ -149,12 +149,12 @@ WebXrVrRuntimelessBrowserTestSensorless::
#if defined(OS_WIN)
WebXrVrOpenVrBrowserTestBase::WebXrVrOpenVrBrowserTestBase() {
enable_features_.push_back(features::kOpenVR);
enable_features_.push_back(device::features::kOpenVR);
#if BUILDFLAG(ENABLE_WINDOWS_MR)
disable_features_.push_back(features::kWindowsMixedReality);
disable_features_.push_back(device::features::kWindowsMixedReality);
#endif
#if BUILDFLAG(ENABLE_OPENXR)
disable_features_.push_back(features::kOpenXR);
disable_features_.push_back(device::features::kOpenXR);
#endif
}
......@@ -172,7 +172,7 @@ gfx::Vector3dF WebXrVrOpenVrBrowserTestBase::GetControllerOffset() const {
WebXrVrWmrBrowserTestBase::WebXrVrWmrBrowserTestBase() {
#if BUILDFLAG(ENABLE_OPENXR)
disable_features_.push_back(features::kOpenXR);
disable_features_.push_back(device::features::kOpenXR);
#endif
}
......@@ -191,9 +191,9 @@ XrBrowserTestBase::RuntimeType WebXrVrWmrBrowserTestBase::GetRuntimeType()
#if BUILDFLAG(ENABLE_OPENXR)
WebXrVrOpenXrBrowserTestBase::WebXrVrOpenXrBrowserTestBase() {
enable_features_.push_back(features::kOpenXR);
enable_features_.push_back(device::features::kOpenXR);
#if BUILDFLAG(ENABLE_WINDOWS_MR)
disable_features_.push_back(features::kWindowsMixedReality);
disable_features_.push_back(device::features::kWindowsMixedReality);
#endif
}
......
......@@ -10,7 +10,6 @@
#include "chrome/browser/vr/test/mock_xr_device_hook_base.h"
#include "chrome/browser/vr/test/webxr_browser_test.h"
#include "chrome/browser/vr/test/xr_browser_test.h"
#include "chrome/common/chrome_features.h"
#include "components/permissions/permission_request_manager.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
......
......@@ -15,11 +15,11 @@
#include "build/build_config.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/vr/test/conditional_skipping.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "device/base/features.h"
#include "device/vr/test/test_hook.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "url/gurl.h"
......
......@@ -18,11 +18,11 @@
#include "chrome/browser/vr/service/xr_runtime_manager.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "chrome/browser/vr/win/vr_browser_renderer_thread_win.h"
#include "chrome/common/chrome_features.h"
#include "components/permissions/permission_manager.h"
#include "components/permissions/permission_result.h"
#include "content/public/browser/device_service.h"
#include "content/public/browser/navigation_entry.h"
#include "device/base/features.h"
#include "device/vr/buildflags/buildflags.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -34,7 +34,7 @@ static constexpr base::TimeDelta kPermissionPromptTimeout =
base::TimeDelta GetPermissionPromptTimeout(bool first_time) {
#if BUILDFLAG(ENABLE_WINDOWS_MR)
if (base::FeatureList::IsEnabled(features::kWindowsMixedReality) &&
if (base::FeatureList::IsEnabled(device::features::kWindowsMixedReality) &&
first_time)
return base::TimeDelta::FromSeconds(10);
#endif
......
......@@ -72,12 +72,12 @@
#include "chrome/browser/vr/ui_scene.h"
#include "chrome/browser/vr/ui_scene_constants.h"
#include "chrome/browser/vr/vector_icons/vector_icons.h"
#include "chrome/common/chrome_features.h"
#include "chrome/grit/generated_resources.h"
#include "components/omnibox/browser/vector_icons.h"
#include "components/strings/grit/components_strings.h"
#include "components/url_formatter/elide_url.h"
#include "components/vector_icons/vector_icons.h"
#include "device/base/features.h"
#include "device/vr/buildflags/buildflags.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/paint_vector_icon.h"
......@@ -1097,7 +1097,7 @@ void BindIndicatorTranscience(
int GetIndicatorsTimeout() {
#if BUILDFLAG(ENABLE_WINDOWS_MR)
if (base::FeatureList::IsEnabled(features::kWindowsMixedReality))
if (base::FeatureList::IsEnabled(device::features::kWindowsMixedReality))
return kWmrInitialIndicatorsTimeoutSeconds;
#endif
return kToastTimeoutSeconds;
......
......@@ -344,31 +344,6 @@ const base::Feature kExternalExtensionDefaultButtonControl{
// Enables Focus Mode which brings up a PWA-like window look.
const base::Feature kFocusMode{"FocusMode", base::FEATURE_DISABLED_BY_DEFAULT};
#if BUILDFLAG(ENABLE_VR)
#if BUILDFLAG(ENABLE_OCULUS_VR)
// Controls Oculus support.
const base::Feature kOculusVR{"OculusVR", base::FEATURE_DISABLED_BY_DEFAULT};
#endif // ENABLE_OCULUS_VR
#if BUILDFLAG(ENABLE_OPENVR)
// Controls OpenVR support.
const base::Feature kOpenVR{"OpenVR", base::FEATURE_DISABLED_BY_DEFAULT};
#endif // ENABLE_OPENVR
#if BUILDFLAG(ENABLE_WINDOWS_MR)
// Controls Windows Mixed Reality support.
const base::Feature kWindowsMixedReality{"WindowsMixedReality",
base::FEATURE_ENABLED_BY_DEFAULT};
#endif // ENABLE_WINDOWS_MR
#if BUILDFLAG(ENABLE_OPENXR)
// Controls OpenXR support.
const base::Feature kOpenXR{"OpenXR", base::FEATURE_ENABLED_BY_DEFAULT};
#endif // ENABLE_OPENXR
#endif // BUILDFLAG(ENABLE_VR)
#if defined(OS_WIN)
// Enables using GDI to print text as simply text.
const base::Feature kGdiTextPrinting{"GdiTextPrinting",
......
......@@ -213,24 +213,6 @@ COMPONENT_EXPORT(CHROME_FEATURES)
extern const base::Feature kVrBrowsingExperimentalFeatures;
COMPONENT_EXPORT(CHROME_FEATURES)
extern const base::Feature kVrBrowsingExperimentalRendering;
#if BUILDFLAG(ENABLE_OCULUS_VR)
COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kOculusVR;
#endif // ENABLE_OCULUS_VR
#if BUILDFLAG(ENABLE_OPENVR)
COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kOpenVR;
#endif // ENABLE_OPENVR
#if BUILDFLAG(ENABLE_WINDOWS_MR)
COMPONENT_EXPORT(CHROME_FEATURES)
extern const base::Feature kWindowsMixedReality;
#endif // ENABLE_WINDOWS_MR
#if BUILDFLAG(ENABLE_OPENXR)
COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kOpenXR;
#endif // ENABLE_OPENXR
#endif // ENABLE_VR
#if defined(OS_WIN)
......
......@@ -22,7 +22,7 @@ source_set("lib") {
deps = [
"//base",
"//chrome/common",
"//device/base",
"//device/vr:vr",
"//device/vr/public/mojom",
"//device/vr/public/mojom:test_mojom",
......
include_rules = [
"+device/base",
"+device/vr",
"+mojo/public",
]
......@@ -8,8 +8,8 @@
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/trace_event/trace_event.h"
#include "chrome/common/chrome_features.h"
#include "content/public/common/content_switches.h"
#include "device/base/features.h"
#include "device/vr/buildflags/buildflags.h"
#include "device/vr/vr_device_base.h"
......@@ -156,7 +156,7 @@ void IsolatedXRRuntimeProvider::SetupPollingForDeviceChanges() {
ALLOW_UNUSED_LOCAL(command_line);
#if BUILDFLAG(ENABLE_OCULUS_VR)
if (IsEnabled(command_line, features::kOculusVR,
if (IsEnabled(command_line, device::features::kOculusVR,
switches::kWebXrRuntimeOculus)) {
should_check_oculus_ = device::OculusDevice::IsApiAvailable();
any_runtimes_available |= should_check_oculus_;
......@@ -164,7 +164,7 @@ void IsolatedXRRuntimeProvider::SetupPollingForDeviceChanges() {
#endif
#if BUILDFLAG(ENABLE_OPENVR)
if (IsEnabled(command_line, features::kOpenVR,
if (IsEnabled(command_line, device::features::kOpenVR,
switches::kWebXrRuntimeOpenVr)) {
should_check_openvr_ = device::OpenVRDevice::IsApiAvailable();
any_runtimes_available |= should_check_openvr_;
......@@ -172,7 +172,7 @@ void IsolatedXRRuntimeProvider::SetupPollingForDeviceChanges() {
#endif
#if BUILDFLAG(ENABLE_WINDOWS_MR)
if (IsEnabled(command_line, features::kWindowsMixedReality,
if (IsEnabled(command_line, device::features::kWindowsMixedReality,
switches::kWebXrRuntimeWMR)) {
wmr_statics_ = device::MixedRealityDeviceStatics::CreateInstance();
should_check_wmr_ = wmr_statics_->IsApiAvailable();
......@@ -181,7 +181,7 @@ void IsolatedXRRuntimeProvider::SetupPollingForDeviceChanges() {
#endif
#if BUILDFLAG(ENABLE_OPENXR)
if (IsEnabled(command_line, features::kOpenXR,
if (IsEnabled(command_line, device::features::kOpenXR,
switches::kWebXrRuntimeOpenXr)) {
openxr_statics_ = std::make_unique<device::OpenXrStatics>();
should_check_openxr_ = openxr_statics_->IsApiAvailable();
......
......@@ -28,5 +28,26 @@ const base::Feature kWebXrOrientationSensorDevice {
#endif
};
#endif // BUILDFLAG(ENABLE_VR)
namespace features {
#if BUILDFLAG(ENABLE_OCULUS_VR)
// Controls WebXR support for the Oculus Runtime.
const base::Feature kOculusVR{"OculusVR", base::FEATURE_DISABLED_BY_DEFAULT};
#endif // ENABLE_OCULUS_VR
#if BUILDFLAG(ENABLE_OPENVR)
// Controls WebXR support for the OpenVR Runtime.
const base::Feature kOpenVR{"OpenVR", base::FEATURE_DISABLED_BY_DEFAULT};
#endif // ENABLE_OPENVR
#if BUILDFLAG(ENABLE_OPENXR)
// Controls WebXR support for the OpenXR Runtime.
const base::Feature kOpenXR{"OpenXR", base::FEATURE_ENABLED_BY_DEFAULT};
#endif // ENABLE_OPENXR
#if BUILDFLAG(ENABLE_WINDOWS_MR)
// Controls WebXR support for the Windows Mixed Reality Runtime.
const base::Feature kWindowsMixedReality{"WindowsMixedReality",
base::FEATURE_ENABLED_BY_DEFAULT};
#endif // ENABLE_WINDOWS_MR
} // namespace features
} // namespace device
......@@ -21,6 +21,22 @@ DEVICE_BASE_EXPORT extern const base::Feature kNewBLEWinImplementation;
DEVICE_BASE_EXPORT extern const base::Feature kWebXrOrientationSensorDevice;
#endif // BUILDFLAG(ENABLE_VR)
// New features should be added to the device::features namespace.
namespace features {
#if BUILDFLAG(ENABLE_OCULUS_VR)
DEVICE_BASE_EXPORT extern const base::Feature kOculusVR;
#endif // ENABLE_OCULUS_VR
#if BUILDFLAG(ENABLE_OPENVR)
DEVICE_BASE_EXPORT extern const base::Feature kOpenVR;
#endif // ENABLE_OPENVR
#if BUILDFLAG(ENABLE_OPENXR)
DEVICE_BASE_EXPORT extern const base::Feature kOpenXR;
#endif // ENABLE_OPENXR
#if BUILDFLAG(ENABLE_WINDOWS_MR)
DEVICE_BASE_EXPORT extern const base::Feature kWindowsMixedReality;
#endif // ENABLE_WINDOWS_MR
} // namespace features
} // namespace device
#endif // DEVICE_BASE_FEATURES_H_
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