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

Side by Side Diff: chrome/browser/resources/vr_shell/vr_shell_ui.js

Issue 2749703007: Add menu mode plumbing for WebVR mode. (Closed)
Patch Set: Address comments. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var vrShellUi = (function() { 5 var vrShellUi = (function() {
6 'use strict'; 6 'use strict';
7 7
8 let ui = new scene.Scene(); 8 let ui = new scene.Scene();
9 let uiManager; 9 let uiManager;
10 let nativeCommandHandler; 10 let nativeCommandHandler;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } else { 94 } else {
95 // TODO(mthiesse): Restore the webVR resolution (which matches native 95 // TODO(mthiesse): Restore the webVR resolution (which matches native
96 // display resolution). 96 // display resolution).
97 } 97 }
98 } 98 }
99 99
100 setMenuMode(enabled) { 100 setMenuMode(enabled) {
101 if (this.menuMode == enabled) 101 if (this.menuMode == enabled)
102 return; 102 return;
103 this.menuMode = enabled; 103 this.menuMode = enabled;
104 this.updateState() 104 this.updateState();
105 } 105 }
106 106
107 setFullscreen(enabled) { 107 setFullscreen(enabled) {
108 if (this.fullscreen == enabled) 108 if (this.fullscreen == enabled)
109 return; 109 return;
110 this.fullscreen = enabled; 110 this.fullscreen = enabled;
111 this.updateState() 111 this.updateState();
112 } 112 }
113 113
114 updateState() { 114 updateState() {
115 // Defaults content quad parameters. 115 // Defaults content quad parameters.
116 let y = 0; 116 let y = 0;
117 let distance = this.BROWSING_SCREEN_DISTANCE; 117 let distance = this.BROWSING_SCREEN_DISTANCE;
118 let height = this.SCREEN_HEIGHT; 118 let height = this.SCREEN_HEIGHT;
119 119
120 // Mode-specific overrides. 120 // Mode-specific overrides.
121 if (this.menuMode) { 121 if (this.menuMode) {
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 } 1138 }
1139 1139
1140 updateState() { 1140 updateState() {
1141 /** @const */ var URL_INDICATOR_VISIBILITY_TIMEOUT_MS = 5000; 1141 /** @const */ var URL_INDICATOR_VISIBILITY_TIMEOUT_MS = 5000;
1142 1142
1143 let mode = this.mode; 1143 let mode = this.mode;
1144 let menuMode = this.menuMode; 1144 let menuMode = this.menuMode;
1145 let fullscreen = this.fullscreen; 1145 let fullscreen = this.fullscreen;
1146 1146
1147 api.doAction(api.Action.SET_CONTENT_PAUSED, {'paused': menuMode}); 1147 api.doAction(api.Action.SET_CONTENT_PAUSED, {'paused': menuMode});
1148 ui.setWebVrRenderingEnabled(mode == api.Mode.WEB_VR && !menuMode);
1148 1149
1149 this.contentQuad.setEnabled(mode == api.Mode.STANDARD); 1150 this.contentQuad.setEnabled(mode == api.Mode.STANDARD || menuMode);
1150 this.contentQuad.setFullscreen(fullscreen); 1151 this.contentQuad.setFullscreen(fullscreen);
1151 this.contentQuad.setMenuMode(menuMode); 1152 this.contentQuad.setMenuMode(menuMode);
1152 // TODO(crbug/643815): Set aspect ratio on content quad when available. 1153 // TODO(crbug/643815): Set aspect ratio on content quad when available.
1153 this.controls.setEnabled(menuMode); 1154 this.controls.setEnabled(menuMode);
1154 this.controls.setBackButtonEnabled(this.canGoBack || this.fullscreen); 1155 this.controls.setBackButtonEnabled(this.canGoBack || this.fullscreen);
1155 let enabledIndicators = {} 1156 let enabledIndicators = {}
1156 enabledIndicators[api.Direction.LEFT] = this.canGoBack || this.fullscreen; 1157 enabledIndicators[api.Direction.LEFT] = this.canGoBack || this.fullscreen;
1157 this.gestureHandlers.setEnabled(enabledIndicators); 1158 this.gestureHandlers.setEnabled(enabledIndicators);
1158 this.omnibox.setEnabled(menuMode); 1159 this.omnibox.setEnabled(menuMode);
1159 this.urlIndicator.setEnabled(mode == api.Mode.STANDARD && !menuMode); 1160 this.urlIndicator.setEnabled(mode == api.Mode.STANDARD && !menuMode);
1160 this.urlIndicator.setVisibilityTimeout( 1161 this.urlIndicator.setVisibilityTimeout(
1161 URL_INDICATOR_VISIBILITY_TIMEOUT_MS); 1162 URL_INDICATOR_VISIBILITY_TIMEOUT_MS);
1162 this.secureOriginWarnings.setEnabled( 1163 this.secureOriginWarnings.setEnabled(
1163 mode == api.Mode.WEB_VR && !menuMode); 1164 mode == api.Mode.WEB_VR && !menuMode);
1164 this.background.setState(mode, menuMode, fullscreen); 1165 this.background.setState(mode, menuMode, fullscreen);
1165 this.tabContainer.setEnabled(mode == api.Mode.STANDARD && menuMode); 1166 this.tabContainer.setEnabled(menuMode);
1166 1167
1167 this.reloadUiButton.setEnabled(mode == api.Mode.STANDARD); 1168 this.reloadUiButton.setEnabled(mode == api.Mode.STANDARD);
1168 this.keyboard.setEnabled(mode == api.Mode.STANDARD && menuMode); 1169 this.keyboard.setEnabled(mode == api.Mode.STANDARD && menuMode);
1169 1170
1171
1170 api.setUiCssSize( 1172 api.setUiCssSize(
1171 uiRootElement.clientWidth, uiRootElement.clientHeight, UI_DPR); 1173 uiRootElement.clientWidth, uiRootElement.clientHeight, UI_DPR);
1172 } 1174 }
1173 1175
1174 setSecurityLevel(level) { 1176 setSecurityLevel(level) {
1175 this.urlIndicator.setSecurityLevel(level); 1177 this.urlIndicator.setSecurityLevel(level);
1176 } 1178 }
1177 1179
1178 setWebVRSecureOrigin(secure) { 1180 setWebVRSecureOrigin(secure) {
1179 this.secureOriginWarnings.setSecure(secure); 1181 this.secureOriginWarnings.setSecure(secure);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 nativeCommandHandler.handleCommand(dict); 1286 nativeCommandHandler.handleCommand(dict);
1285 } 1287 }
1286 1288
1287 return { 1289 return {
1288 initialize: initialize, 1290 initialize: initialize,
1289 command: command, 1291 command: command,
1290 }; 1292 };
1291 })(); 1293 })();
1292 1294
1293 window.addEventListener('load', vrShellUi.initialize); 1295 window.addEventListener('load', vrShellUi.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698