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

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

Issue 2536223002: Omnibox improvements and fixes. (Closed)
Patch Set: 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 let update = new api.UiElementUpdate(); 269 let update = new api.UiElementUpdate();
270 update.setVisible(false); 270 update.setVisible(false);
271 scene.updateElement(this.transientWarning.uiElementId, update); 271 scene.updateElement(this.transientWarning.uiElementId, update);
272 this.secureOriginTimer = null; 272 this.secureOriginTimer = null;
273 scene.flush(); 273 scene.flush();
274 } 274 }
275 }; 275 };
276 276
277 class Omnibox { 277 class Omnibox {
278 constructor(contentQuadId) { 278 constructor(contentQuadId) {
279 /** @const */ var VISIBILITY_TIMEOUT_MS = 3000;
280
281 this.domUiElement = new DomUiElement('#omni-container'); 279 this.domUiElement = new DomUiElement('#omni-container');
282 this.enabled = false; 280 this.enabled = false;
283 this.secure = false; 281 this.secure = false;
284 this.visibilityTimeout = VISIBILITY_TIMEOUT_MS; 282 this.visibilityTimeout = 0;
285 this.visibilityTimer = null; 283 this.visibilityTimer = null;
286 this.nativeState = {}; 284 this.nativeState = {};
287 285
288 // Initially invisible. 286 // Initially invisible.
289 let update = new api.UiElementUpdate(); 287 let update = new api.UiElementUpdate();
290 update.setVisible(false); 288 update.setVisible(false);
291 scene.updateElement(this.domUiElement.uiElementId, update); 289 scene.updateElement(this.domUiElement.uiElementId, update);
292 this.nativeState.visible = false; 290 this.nativeState.visible = false;
293 291
294 // Listen to the end of transitions, so that the box can be natively 292 // Listen to the end of transitions, so that the box can be natively
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 391
394 this.contentQuad = new ContentQuad(); 392 this.contentQuad = new ContentQuad();
395 let contentId = this.contentQuad.getElementId(); 393 let contentId = this.contentQuad.getElementId();
396 394
397 this.controls = new Controls(contentId); 395 this.controls = new Controls(contentId);
398 this.secureOriginWarnings = new SecureOriginWarnings(); 396 this.secureOriginWarnings = new SecureOriginWarnings();
399 this.omnibox = new Omnibox(contentId); 397 this.omnibox = new Omnibox(contentId);
400 } 398 }
401 399
402 setMode(mode) { 400 setMode(mode) {
401 /** @const */ var OMNIBOX_VISIBILITY_TIMEOUT_MS = 5000;
402
403 this.mode = mode; 403 this.mode = mode;
404 this.contentQuad.setEnabled( 404 this.contentQuad.setEnabled(
405 mode == api.Mode.STANDARD || mode == api.Mode.CINEMA); 405 mode == api.Mode.STANDARD || mode == api.Mode.CINEMA);
406 this.contentQuad.setCinemaMode(mode == api.Mode.CINEMA); 406 this.contentQuad.setCinemaMode(mode == api.Mode.CINEMA);
407 // TODO(crbug/643815): Set aspect ratio on content quad when available. 407 // TODO(crbug/643815): Set aspect ratio on content quad when available.
408 // TODO(amp): Don't show controls in CINEMA mode once MENU mode lands. 408 // TODO(amp): Don't show controls in CINEMA mode once MENU mode lands.
409 this.controls.setEnabled( 409 this.controls.setEnabled(
410 mode == api.Mode.STANDARD || mode == api.Mode.CINEMA); 410 mode == api.Mode.STANDARD || mode == api.Mode.CINEMA);
411 this.omnibox.setEnabled( 411 this.omnibox.setEnabled(
412 mode == api.Mode.STANDARD || mode == api.Mode.CINEMA); 412 mode == api.Mode.STANDARD || mode == api.Mode.CINEMA);
413 this.omnibox.setVisibilityTimeout(
414 (mode == api.Mode.STANDARD || mode == api.Mode.CINEMA) ?
415 0 : OMNIBOX_VISIBILITY_TIMEOUT_MS);
413 this.secureOriginWarnings.setEnabled(mode == api.Mode.WEB_VR); 416 this.secureOriginWarnings.setEnabled(mode == api.Mode.WEB_VR);
414 } 417 }
415 418
416 setSecureOrigin(secure) { 419 setSecureOrigin(secure) {
417 this.secureOriginWarnings.setSecureOrigin(secure); 420 this.secureOriginWarnings.setSecureOrigin(secure);
418 this.omnibox.setSecureOrigin(secure); 421 this.omnibox.setSecureOrigin(secure);
419 } 422 }
420 423
421 setReloadUiEnabled(enabled) { 424 setReloadUiEnabled(enabled) {
422 this.controls.setReloadUiEnabled(enabled); 425 this.controls.setReloadUiEnabled(enabled);
(...skipping 27 matching lines...) Expand all
450 scene.flush(); 453 scene.flush();
451 } 454 }
452 455
453 return { 456 return {
454 initialize: initialize, 457 initialize: initialize,
455 command: command, 458 command: command,
456 }; 459 };
457 })(); 460 })();
458 461
459 document.addEventListener('DOMContentLoaded', vrShellUi.initialize); 462 document.addEventListener('DOMContentLoaded', vrShellUi.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698