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

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

Issue 2592143002: First cut of JS closure compiler use for VR HTML UI. (Closed)
Patch Set: Remove test file. Created 4 years 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 scene = new ui.Scene(); 8 let scene = new ui.Scene();
9 let sceneManager; 9 let sceneManager;
10 10
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 this.configure(1, 1, 0.015); 115 this.configure(1, 1, 0.015);
116 } 116 }
117 117
118 onMouseLeave() { 118 onMouseLeave() {
119 this.configure(0.8, 0, 0); 119 this.configure(0.8, 0, 0);
120 } 120 }
121 }; 121 };
122 122
123 class Controls { 123 class Controls {
124 constructor(contentQuadId) { 124 constructor(contentQuadId) {
125 this.enabled = false;
126 this.reloadUiEnabled = false;
127
125 this.buttons = []; 128 this.buttons = [];
126 let descriptors = [ 129 let descriptors = [
127 ['#back', function() { 130 ['#back', function() {
128 api.doAction(api.Action.HISTORY_BACK); 131 api.doAction(api.Action.HISTORY_BACK);
129 }], 132 }],
130 ['#reload', function() { 133 ['#reload', function() {
131 api.doAction(api.Action.RELOAD); 134 api.doAction(api.Action.RELOAD);
132 }], 135 }],
133 ['#forward', function() { 136 ['#forward', function() {
134 api.doAction(api.Action.HISTORY_FORWARD); 137 api.doAction(api.Action.HISTORY_FORWARD);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 update.setVisible(this.enabled && this.reloadUiEnabled); 194 update.setVisible(this.enabled && this.reloadUiEnabled);
192 scene.updateElement(this.reloadUiButton.uiElementId, update); 195 scene.updateElement(this.reloadUiButton.uiElementId, update);
193 } 196 }
194 }; 197 };
195 198
196 class SecureOriginWarnings { 199 class SecureOriginWarnings {
197 constructor() { 200 constructor() {
198 /** @const */ var DISTANCE = 0.7; 201 /** @const */ var DISTANCE = 0.7;
199 /** @const */ var ANGLE_UP = 16.3 * Math.PI / 180.0; 202 /** @const */ var ANGLE_UP = 16.3 * Math.PI / 180.0;
200 203
204 this.enabled = false;
205 this.secure = false;
206 this.secureOriginTimer = null;
207
201 // Permanent WebVR security warning. This warning is shown near the top of 208 // Permanent WebVR security warning. This warning is shown near the top of
202 // the field of view. 209 // the field of view.
203 this.webVrSecureWarning = new DomUiElement('#webvr-not-secure-permanent'); 210 this.webVrSecureWarning = new DomUiElement('#webvr-not-secure-permanent');
204 let update = new api.UiElementUpdate(); 211 let update = new api.UiElementUpdate();
205 update.setScale(DISTANCE, DISTANCE, 1); 212 update.setScale(DISTANCE, DISTANCE, 1);
206 update.setTranslation(0, DISTANCE * Math.sin(ANGLE_UP), 213 update.setTranslation(0, DISTANCE * Math.sin(ANGLE_UP),
207 -DISTANCE * Math.cos(ANGLE_UP)); 214 -DISTANCE * Math.cos(ANGLE_UP));
208 update.setRotation(1.0, 0.0, 0.0, ANGLE_UP); 215 update.setRotation(1.0, 0.0, 0.0, ANGLE_UP);
209 update.setHitTestable(false); 216 update.setHitTestable(false);
210 update.setVisible(false); 217 update.setVisible(false);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 scene.updateElement(this.transientWarning.uiElementId, update); 271 scene.updateElement(this.transientWarning.uiElementId, update);
265 this.secureOriginTimer = null; 272 this.secureOriginTimer = null;
266 scene.flush(); 273 scene.flush();
267 } 274 }
268 }; 275 };
269 276
270 class Omnibox { 277 class Omnibox {
271 constructor(contentQuadId) { 278 constructor(contentQuadId) {
272 this.domUiElement = new DomUiElement('#omni-container'); 279 this.domUiElement = new DomUiElement('#omni-container');
273 this.enabled = false; 280 this.enabled = false;
281 this.loading = false;
274 this.level = 0; 282 this.level = 0;
275 this.visibilityTimeout = 0; 283 this.visibilityTimeout = 0;
276 this.visibilityTimer = null; 284 this.visibilityTimer = null;
285 this.visibleAfterTransition = false;
277 this.nativeState = {}; 286 this.nativeState = {};
278 287
279 // Initially invisible. 288 // Initially invisible.
280 let update = new api.UiElementUpdate(); 289 let update = new api.UiElementUpdate();
281 update.setVisible(false); 290 update.setVisible(false);
282 scene.updateElement(this.domUiElement.uiElementId, update); 291 scene.updateElement(this.domUiElement.uiElementId, update);
283 this.nativeState.visible = false; 292 this.nativeState.visible = false;
284 293
285 // Listen to the end of transitions, so that the box can be natively 294 // Listen to the end of transitions, so that the box can be natively
286 // hidden after it finishes hiding itself. 295 // hidden after it finishes hiding itself.
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 scene.flush(); 485 scene.flush();
477 } 486 }
478 487
479 return { 488 return {
480 initialize: initialize, 489 initialize: initialize,
481 command: command, 490 command: command,
482 }; 491 };
483 })(); 492 })();
484 493
485 document.addEventListener('DOMContentLoaded', vrShellUi.initialize); 494 document.addEventListener('DOMContentLoaded', vrShellUi.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698