Pull in vr_shell code for webvr
BUG=389343
Review-Url: https://codereview.chromium.org/2399533002
Cr-Commit-Position: refs/heads/master@{#424616}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index c6366d9b..11e171b 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -3355,9 +3355,12 @@
}
}
- if (enable_vr_shell && android_java_ui) {
- defines += [ "ENABLE_VR_SHELL" ]
- deps += [ "android/vr_shell:vr_shell" ]
+ if (enable_vr_shell || enable_webvr) {
+ if (enable_vr_shell) {
+ defines += [ "ENABLE_VR_SHELL" ]
+ }
+
+ deps += [ "android/vr_shell:vr_common" ]
configs += [ "//third_party/gvr-android-sdk:libgvr_config" ]
}
diff --git a/chrome/browser/android/chrome_jni_registrar.cc b/chrome/browser/android/chrome_jni_registrar.cc
index 535fce3..abf0db4 100644
--- a/chrome/browser/android/chrome_jni_registrar.cc
+++ b/chrome/browser/android/chrome_jni_registrar.cc
@@ -176,7 +176,7 @@
#include "printing/printing_context_android.h"
#endif
-#if defined(ENABLE_VR_SHELL)
+#if defined(ENABLE_VR_SHELL) || defined(ENABLE_WEBVR)
#include "chrome/browser/android/vr_shell/vr_shell.h"
#include "chrome/browser/android/vr_shell/vr_shell_delegate.h"
#endif
@@ -380,7 +380,7 @@
{"UsbChooserDialogAndroid", UsbChooserDialogAndroid::Register},
{"Variations", variations::android::RegisterVariations},
{"VariationsSession", chrome::android::RegisterVariationsSession},
-#if defined(ENABLE_VR_SHELL)
+#if defined(ENABLE_VR_SHELL) || defined(ENABLE_WEBVR)
{"VrShell", vr_shell::RegisterVrShell},
{"VrShellDelegate", vr_shell::RegisterVrShellDelegate},
#endif
diff --git a/chrome/browser/android/vr_shell/BUILD.gn b/chrome/browser/android/vr_shell/BUILD.gn
index f2e1f80..74a34ae 100644
--- a/chrome/browser/android/vr_shell/BUILD.gn
+++ b/chrome/browser/android/vr_shell/BUILD.gn
@@ -6,9 +6,9 @@
import("//chrome/common/features.gni")
import("//testing/test.gni")
-assert(enable_vr_shell && android_java_ui)
+assert(enable_vr_shell || enable_webvr)
-static_library("vr_shell") {
+static_library("vr_common") {
sources = [
"animation.cc",
"animation.h",
@@ -62,17 +62,19 @@
jni_package = "vr_shell"
}
-test("vr_shell_unittests") {
- sources = [
- "ui_elements_unittest.cc",
- "ui_scene_unittest.cc",
- ]
+if (enable_vr_shell) {
+ test("vr_shell_unittests") {
+ sources = [
+ "ui_elements_unittest.cc",
+ "ui_scene_unittest.cc",
+ ]
- deps = [
- ":vr_shell",
- "//base/test:run_all_unittests",
- "//base/test:test_support",
- "//testing/gtest",
- "//ui/gfx/geometry",
- ]
+ deps = [
+ ":vr_common",
+ "//base/test:run_all_unittests",
+ "//base/test:test_support",
+ "//testing/gtest",
+ "//ui/gfx/geometry",
+ ]
+ }
}
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index 8a75db78..e736d66 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -198,8 +198,7 @@
<include name="IDR_SNIPPETS_INTERNALS_HTML" file="resources\snippets_internals.html" allowexternalscript="true" compress="gzip" type="BINDATA" />
<include name="IDR_SNIPPETS_INTERNALS_CSS" file="resources\snippets_internals.css" compress="gzip" type="BINDATA" />
<include name="IDR_SNIPPETS_INTERNALS_JS" file="resources\snippets_internals.js" compress="gzip" type="BINDATA" />
- <!-- TODO: Enable only for VrShell, independent of Android. -->
- <if expr="enable_vr_shell">
+ <if expr="enable_vr_shell or enable_webvr">
<include name="IDR_VR_SHELL_UI_HTML" file="resources\vr_shell\vr_shell_ui.html" allowexternalscript="true" flattenhtml="true" type="BINDATA" />
<include name="IDR_VR_SHELL_UI_CSS" file="resources\vr_shell\vr_shell_ui.css" type="BINDATA" />
<include name="IDR_VR_SHELL_UI_JS" file="resources\vr_shell\vr_shell_ui.js" type="BINDATA" />
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index 828fedd3..58908ae 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -2205,8 +2205,10 @@
"webui/snippets_internals_ui.cc",
"webui/snippets_internals_ui.h",
]
- if (enable_vr_shell) {
- defines += [ "ENABLE_VR_SHELL" ]
+ if (enable_vr_shell || enable_webvr) {
+ if (enable_vr_shell) {
+ defines += [ "ENABLE_VR_SHELL" ]
+ }
sources += [
"webui/vr_shell/vr_shell_ui_message_handler.cc",
"webui/vr_shell/vr_shell_ui_message_handler.h",
@@ -2214,7 +2216,7 @@
"webui/vr_shell/vr_shell_ui_ui.h",
]
configs += [ "//third_party/gvr-android-sdk:libgvr_config" ]
- deps += [ "//chrome/browser/android/vr_shell:vr_shell" ]
+ deps += [ "//chrome/browser/android/vr_shell:vr_common" ]
}
if (enable_vr_shell_ui_dev) {
assert(enable_vr_shell)
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index 3f69514..6b8cfb5 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -110,7 +110,7 @@
#include "chrome/browser/ui/webui/offline/offline_internals_ui.h"
#include "chrome/browser/ui/webui/popular_sites_internals_ui.h"
#include "chrome/browser/ui/webui/snippets_internals_ui.h"
-#if defined(ENABLE_VR_SHELL)
+#if defined(ENABLE_VR_SHELL) || defined(ENABLE_WEBVR)
#include "chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.h"
#endif
#else
@@ -532,10 +532,10 @@
if (url.host() == chrome::kChromeUISnippetsInternalsHost &&
!profile->IsOffTheRecord())
return &NewWebUI<SnippetsInternalsUI>;
-#if defined(ENABLE_VR_SHELL)
+#if defined(ENABLE_VR_SHELL) || defined(ENABLE_WEBVR)
if (url.host() == chrome::kChromeUIVrShellUIHost)
return &NewWebUI<VrShellUIUI>;
-#endif // defined(ENABLE_VR_SHELL)
+#endif
#else
if (url.SchemeIs(content::kChromeDevToolsScheme))
return &NewWebUI<DevToolsUI>;