| OLD | NEW |
| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 this.visibilityTimeout = milliseconds; | 302 this.visibilityTimeout = milliseconds; |
| 303 this.resetVisibilityTimer(); | 303 this.resetVisibilityTimer(); |
| 304 this.updateState(); | 304 this.updateState(); |
| 305 } | 305 } |
| 306 | 306 |
| 307 resetVisibilityTimer() { | 307 resetVisibilityTimer() { |
| 308 if (this.visibilityTimer) { | 308 if (this.visibilityTimer) { |
| 309 clearInterval(this.visibilityTimer); | 309 clearInterval(this.visibilityTimer); |
| 310 this.visibilityTimer = null; | 310 this.visibilityTimer = null; |
| 311 } | 311 } |
| 312 if (this.enabled && this.visibilityTimeout > 0) { | 312 if (this.enabled && this.visibilityTimeout > 0 && !this.loading) { |
| 313 this.visibilityTimer = setTimeout( | 313 this.visibilityTimer = setTimeout( |
| 314 this.onVisibilityTimer.bind(this), this.visibilityTimeout); | 314 this.onVisibilityTimer.bind(this), this.visibilityTimeout); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| 318 onVisibilityTimer() { | 318 onVisibilityTimer() { |
| 319 this.visibilityTimer = null; | 319 this.visibilityTimer = null; |
| 320 this.updateState(); | 320 this.updateState(); |
| 321 } | 321 } |
| 322 | 322 |
| 323 onAnimationDone(e) { | 323 onAnimationDone(e) { |
| 324 if (e.propertyName == 'opacity' && !this.visibleAfterTransition) { | 324 if (e.propertyName == 'opacity' && !this.visibleAfterTransition) { |
| 325 this.setNativeVisibility(false); | 325 this.setNativeVisibility(false); |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 | 328 |
| 329 updateState() { | 329 updateState() { |
| 330 if (!this.enabled) { | 330 if (!this.enabled) { |
| 331 this.setNativeVisibility(false); | 331 this.setNativeVisibility(false); |
| 332 return; | 332 return; |
| 333 } | 333 } |
| 334 | 334 |
| 335 document.querySelector('#omni-secure-icon').style.display = | 335 document.querySelector('#omni-secure-icon').style.display = |
| 336 (this.secure ? 'block' : 'none'); | 336 (this.secure ? 'block' : 'none'); |
| 337 document.querySelector('#omni-insecure-icon').style.display = | 337 document.querySelector('#omni-insecure-icon').style.display = |
| 338 (this.secure ? 'none' : 'block'); | 338 (this.secure ? 'none' : 'block'); |
| 339 | 339 |
| 340 let state = 'idle'; | 340 let state = 'idle'; |
| 341 this.visibleAfterTransition = true; | 341 this.visibleAfterTransition = true; |
| 342 if (this.visibilityTimeout > 0 && !this.visibilityTimer) { | 342 if (this.loading) { |
| 343 state = 'loading'; |
| 344 } else if (this.visibilityTimeout > 0 && !this.visibilityTimer) { |
| 343 state = 'hide'; | 345 state = 'hide'; |
| 344 this.visibleAfterTransition = false; | 346 this.visibleAfterTransition = false; |
| 345 } else if (this.loading) { | |
| 346 state = 'loading'; | |
| 347 } | 347 } |
| 348 document.querySelector('#omni').className = state; | 348 document.querySelector('#omni').className = state; |
| 349 | 349 |
| 350 this.setNativeVisibility(true); | 350 this.setNativeVisibility(true); |
| 351 } | 351 } |
| 352 | 352 |
| 353 setNativeVisibility(visible) { | 353 setNativeVisibility(visible) { |
| 354 if (visible == this.nativeState.visible) { | 354 if (visible == this.nativeState.visible) { |
| 355 return; | 355 return; |
| 356 } | 356 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 scene.flush(); | 419 scene.flush(); |
| 420 } | 420 } |
| 421 | 421 |
| 422 return { | 422 return { |
| 423 initialize: initialize, | 423 initialize: initialize, |
| 424 command: command, | 424 command: command, |
| 425 }; | 425 }; |
| 426 })(); | 426 })(); |
| 427 | 427 |
| 428 document.addEventListener('DOMContentLoaded', vrShellUi.initialize); | 428 document.addEventListener('DOMContentLoaded', vrShellUi.initialize); |
| OLD | NEW |