Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7691)

Unified Diff: chrome/browser/resources/vr_shell/vr_shell_ui_api.js

Issue 2749703007: Add menu mode plumbing for WebVR mode. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/vr_shell/vr_shell_ui_api.js
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui_api.js b/chrome/browser/resources/vr_shell/vr_shell_ui_api.js
index f93a98ba208b8ab3cd9aff3d57c163d57072b0dc..f200640ecb50043523e2da5db04f65496be3ef2c 100644
--- a/chrome/browser/resources/vr_shell/vr_shell_ui_api.js
+++ b/chrome/browser/resources/vr_shell/vr_shell_ui_api.js
@@ -15,7 +15,7 @@ api.Command = {
'REMOVE_ELEMENT': 2,
'ADD_ANIMATION': 3,
'REMOVE_ANIMATION': 4,
- 'UPDATE_BACKGROUND': 5
+ 'CONFIGURE_SCENE': 5
};
/**
@@ -540,6 +540,56 @@ api.Animation = class {
};
/**
+ * Scene configuration class. Use this object to generate the payload of a
+ * CONFIGURE_SCENE command.
+ * @struct
+ */
+api.SceneConfiguration = class {
+ constructor() {
+ /** @private {!Object} */
+ this.properties = {};
+ }
+
+ getCommandPayload() {
+ return this.properties;
+ }
+
+ /**
+ * Set the background color of the scene.
+ * @param {{r: number, b: number, g: number, a: number}} color
+ */
+ setBackgroundColor(color) {
+ this.properties.backgroundColor = color;
+ }
+
+ /**
+ * Set the radius of the background-bounding sphere.
+ * @param {number} distance
+ */
+ setBackgroundDistance(distance) {
+ this.properties.backgroundDistance = distance;
+ }
+
+ /**
+ * Enable or disable rendering of the laser and reticle.
+ * @param {boolean} enabled
+ */
+ setCursorEnabled(enabled) {
+ this.properties.drawCursor = enabled;
+ }
+
+ /**
+ * Enable or disable rendering of WebVR content in the foreground. Rendering
+ * defaults to enable when on a WebVR page. This property allows rendering to
+ * be disabled, for purposes of showing an alternate UI (such as a menu).
+ * @param {boolean} enabled
+ */
+ setWebVrRenderingEnabled(enabled) {
tiborg 2017/03/16 19:40:23 Maybe call it setShowWebVrPresentation or so? Sinc
cjgrant 2017/03/20 15:34:57 Now that this controls rendering of WebVR vs UI an
tiborg 2017/03/20 15:56:08 setWebVrRenderingModeEnabled() sounds good to me.
cjgrant 2017/03/20 17:57:22 Done.
+ this.properties.drawWebVr = enabled;
+ }
+};
+
+/**
* Abstract class handling webui command calls from native. The UI must
* subclass this and override the handlers.
* @abstract

Powered by Google App Engine
This is Rietveld 408576698