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

Unified Diff: chrome/browser/resources/vr_shell/vr_shell_ui.js

Issue 2536223002: Omnibox improvements and fixes. (Closed)
Patch Set: Rebase. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/vr_shell/vr_shell_ui.js
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui.js b/chrome/browser/resources/vr_shell/vr_shell_ui.js
index 3964a82b6432da48320cf7b5f9b9966fe8382f8d..c3595e2937d770d03ec65e46954810de33754679 100644
--- a/chrome/browser/resources/vr_shell/vr_shell_ui.js
+++ b/chrome/browser/resources/vr_shell/vr_shell_ui.js
@@ -25,7 +25,7 @@ var vrShellUi = (function() {
/** @const */ this.SCREEN_HEIGHT = 1.6;
/** @const */ this.SCREEN_RATIO = 16 / 9;
/** @const */ this.BROWSING_SCREEN_DISTANCE = 2.0;
- /** @const */ this.CINEMA_SCREEN_DISTANCE = 3.0;
+ /** @const */ this.FULLSCREEN_DISTANCE = 3.0;
let element = new api.UiElement(0, 0, 0, 0);
element.setIsContentQuad();
@@ -42,10 +42,10 @@ var vrShellUi = (function() {
scene.updateElement(this.elementId, update);
}
- setCinemaMode(enabled) {
+ setFullscreen(enabled) {
let anim = new api.Animation(this.elementId, ANIM_DURATION);
if (enabled) {
- anim.setTranslation(0, 0, -this.CINEMA_SCREEN_DISTANCE);
+ anim.setTranslation(0, 0, -this.FULLSCREEN_DISTANCE);
} else {
anim.setTranslation(0, 0, -this.BROWSING_SCREEN_DISTANCE);
}
@@ -125,16 +125,7 @@ var vrShellUi = (function() {
this.buttons = [];
let descriptors = [
['#back', function() {
- // If we are in cinema mode, revert to standard mode on back press.
- if (sceneManager.cinemaMode) {
- // TODO(crbug/644511): Send a message back to native to handle
- // switching back to standard mode and out of full screen instead
- // of only changing the mode here.
- sceneManager.setMode(sceneManager.mode, sceneManager.menuMode,
- false /* Cinema Mode */);
- } else {
- api.doAction(api.Action.HISTORY_BACK);
- }
+ api.doAction(api.Action.HISTORY_BACK);
}],
['#reload', function() {
api.doAction(api.Action.RELOAD);
@@ -238,15 +229,15 @@ var vrShellUi = (function() {
this.updateState();
}
- setSecureOrigin(secure) {
- this.isSecureOrigin = secure;
+ setSecure(secure) {
+ this.secure = secure;
this.updateState();
}
updateState() {
/** @const */ var TRANSIENT_TIMEOUT_MS = 30000;
- let visible = (this.enabled && !this.isSecureOrigin);
+ let visible = (this.enabled && !this.secure);
if (this.secureOriginTimer) {
clearInterval(this.secureOriginTimer);
this.secureOriginTimer = null;
@@ -278,12 +269,10 @@ var vrShellUi = (function() {
class Omnibox {
constructor(contentQuadId) {
- /** @const */ var VISIBILITY_TIMEOUT_MS = 3000;
-
this.domUiElement = new DomUiElement('#omni-container');
this.enabled = false;
- this.secure = false;
- this.visibilityTimeout = VISIBILITY_TIMEOUT_MS;
+ this.level = 0;
+ this.visibilityTimeout = 0;
this.visibilityTimer = null;
this.nativeState = {};
@@ -319,8 +308,8 @@ var vrShellUi = (function() {
this.updateState();
}
- setSecureOrigin(secure) {
- this.secure = secure;
+ setSecurityLevel(level) {
+ this.level = level;
this.resetVisibilityTimer();
this.updateState();
}
@@ -358,11 +347,11 @@ var vrShellUi = (function() {
this.setNativeVisibility(false);
return;
}
-
+ let secure = this.level == 2 || this.level == 3;
document.querySelector('#omni-secure-icon').style.display =
- (this.secure ? 'block' : 'none');
+ (secure ? 'block' : 'none');
document.querySelector('#omni-insecure-icon').style.display =
- (this.secure ? 'none' : 'block');
+ (secure ? 'none' : 'block');
let state = 'idle';
this.visibleAfterTransition = true;
@@ -393,7 +382,7 @@ var vrShellUi = (function() {
constructor() {
this.mode = api.Mode.UNKNOWN;
this.menuMode = false;
- this.cinemaMode = false;
+ this.fullscreen = false;
this.contentQuad = new ContentQuad();
let contentId = this.contentQuad.getElementId();
@@ -403,26 +392,35 @@ var vrShellUi = (function() {
this.omnibox = new Omnibox(contentId);
}
- setMode(mode, menuMode, cinemaMode) {
+ setMode(mode, menuMode, fullscreen) {
+ /** @const */ var OMNIBOX_VISIBILITY_TIMEOUT_MS = 5000;
+
this.mode = mode;
this.menuMode = menuMode;
- this.cinemaMode = cinemaMode;
+ this.fullscreen = fullscreen;
this.contentQuad.setEnabled(mode == api.Mode.STANDARD && !menuMode);
- this.contentQuad.setCinemaMode(cinemaMode);
+ this.contentQuad.setFullscreen(fullscreen);
// TODO(crbug/643815): Set aspect ratio on content quad when available.
- // TODO(amp): Don't show controls in CINEMA mode once MENU mode lands.
+ // TODO(amp): Don't show controls in fullscreen once MENU mode lands.
this.controls.setEnabled(mode == api.Mode.STANDARD && !menuMode);
this.omnibox.setEnabled(mode == api.Mode.STANDARD && !menuMode);
+ // TODO(amp): Don't show controls in CINEMA mode once MENU mode lands.
+ this.omnibox.setVisibilityTimeout(
+ mode == api.Mode.STANDARD && !menuMode ?
+ 0 : OMNIBOX_VISIBILITY_TIMEOUT_MS);
this.secureOriginWarnings.setEnabled(mode == api.Mode.WEB_VR);
api.setUiCssSize(uiRootElement.clientWidth, uiRootElement.clientHeight,
UI_DPR);
}
- setSecureOrigin(secure) {
- this.secureOriginWarnings.setSecureOrigin(secure);
- this.omnibox.setSecureOrigin(secure);
+ setSecurityLevel(level) {
+ this.omnibox.setSecurityLevel(level);
+ }
+
+ setWebVRSecureOrigin(secure) {
+ this.secureOriginWarnings.setSecure(secure);
}
setReloadUiEnabled(enabled) {
@@ -439,10 +437,13 @@ var vrShellUi = (function() {
function command(dict) {
if ('mode' in dict) {
- sceneManager.setMode(dict['mode'], dict['menuMode'], dict['cinemaMode']);
+ sceneManager.setMode(dict['mode'], dict['menuMode'], dict['fullscreen']);
+ }
+ if ('securityLevel' in dict) {
+ sceneManager.setSecurityLevel(dict['securityLevel']);
}
- if ('secureOrigin' in dict) {
- sceneManager.setSecureOrigin(dict['secureOrigin']);
+ if ('webVRSecureOrigin' in dict) {
+ sceneManager.setWebVRSecureOrigin(dict['webVRSecureOrigin']);
}
if ('enableReloadUi' in dict) {
sceneManager.setReloadUiEnabled(dict['enableReloadUi']);

Powered by Google App Engine
This is Rietveld 408576698