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

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: 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 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 } 1031 }
1032 1032
1033 updateState() { 1033 updateState() {
1034 /** @const */ var URL_INDICATOR_VISIBILITY_TIMEOUT_MS = 5000; 1034 /** @const */ var URL_INDICATOR_VISIBILITY_TIMEOUT_MS = 5000;
1035 1035
1036 let mode = this.mode; 1036 let mode = this.mode;
1037 let menuMode = this.menuMode; 1037 let menuMode = this.menuMode;
1038 let fullscreen = this.fullscreen; 1038 let fullscreen = this.fullscreen;
1039 1039
1040 api.doAction(api.Action.SET_CONTENT_PAUSED, {'paused': menuMode}); 1040 api.doAction(api.Action.SET_CONTENT_PAUSED, {'paused': menuMode});
1041 ui.setCursorEnabled(mode == api.Mode.STANDARD || menuMode);
1042 ui.setWebVrRenderingEnabled(mode == api.Mode.WEB_VR && !menuMode);
1041 1043
1042 this.contentQuad.setEnabled(mode == api.Mode.STANDARD); 1044 this.contentQuad.setEnabled(mode == api.Mode.STANDARD || menuMode);
1043 this.contentQuad.setFullscreen(fullscreen); 1045 this.contentQuad.setFullscreen(fullscreen);
1044 this.contentQuad.setMenuMode(menuMode); 1046 this.contentQuad.setMenuMode(menuMode);
1045 // TODO(crbug/643815): Set aspect ratio on content quad when available. 1047 // TODO(crbug/643815): Set aspect ratio on content quad when available.
1046 this.controls.setEnabled(menuMode); 1048 this.controls.setEnabled(menuMode);
1047 this.controls.setBackButtonEnabled(this.canGoBack || this.fullscreen); 1049 this.controls.setBackButtonEnabled(this.canGoBack || this.fullscreen);
1048 this.controls.setForwardButtonEnabled(this.canGoForward); 1050 this.controls.setForwardButtonEnabled(this.canGoForward);
1049 this.omnibox.setEnabled(menuMode); 1051 this.omnibox.setEnabled(menuMode);
1050 this.urlIndicator.setEnabled(mode == api.Mode.STANDARD && !menuMode); 1052 this.urlIndicator.setEnabled(mode == api.Mode.STANDARD && !menuMode);
1051 this.urlIndicator.setVisibilityTimeout( 1053 this.urlIndicator.setVisibilityTimeout(
1052 URL_INDICATOR_VISIBILITY_TIMEOUT_MS); 1054 URL_INDICATOR_VISIBILITY_TIMEOUT_MS);
1053 this.secureOriginWarnings.setEnabled( 1055 this.secureOriginWarnings.setEnabled(
1054 mode == api.Mode.WEB_VR && !menuMode); 1056 mode == api.Mode.WEB_VR && !menuMode);
1055 this.background.setState(mode, menuMode, fullscreen); 1057 this.background.setState(mode, menuMode, fullscreen);
1056 this.tabContainer.setEnabled(mode == api.Mode.STANDARD && menuMode); 1058 this.tabContainer.setEnabled(menuMode);
1057 1059
1058 this.reloadUiButton.setEnabled(mode == api.Mode.STANDARD); 1060 this.reloadUiButton.setEnabled(mode == api.Mode.STANDARD);
1059 this.keyboard.setEnabled(mode == api.Mode.STANDARD && menuMode); 1061 this.keyboard.setEnabled(mode == api.Mode.STANDARD && menuMode);
1060 1062
1063
1061 api.setUiCssSize( 1064 api.setUiCssSize(
1062 uiRootElement.clientWidth, uiRootElement.clientHeight, UI_DPR); 1065 uiRootElement.clientWidth, uiRootElement.clientHeight, UI_DPR);
1063 } 1066 }
1064 1067
1065 setSecurityLevel(level) { 1068 setSecurityLevel(level) {
1066 this.urlIndicator.setSecurityLevel(level); 1069 this.urlIndicator.setSecurityLevel(level);
1067 } 1070 }
1068 1071
1069 setWebVRSecureOrigin(secure) { 1072 setWebVRSecureOrigin(secure) {
1070 this.secureOriginWarnings.setSecure(secure); 1073 this.secureOriginWarnings.setSecure(secure);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 nativeCommandHandler.handleCommand(dict); 1173 nativeCommandHandler.handleCommand(dict);
1171 } 1174 }
1172 1175
1173 return { 1176 return {
1174 initialize: initialize, 1177 initialize: initialize,
1175 command: command, 1178 command: command,
1176 }; 1179 };
1177 })(); 1180 })();
1178 1181
1179 window.addEventListener('load', vrShellUi.initialize); 1182 window.addEventListener('load', vrShellUi.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698