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

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

Issue 2664973002: Let HTML UI manage menu mode. (Closed)
Patch Set: Rebase again to resolve ToT conflict. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.cc ('k') | chrome/browser/resources/vr_shell/vr_shell_ui_api.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cde460d6b9878d67bdd72fd03a6e882dbd3046d5..3cb3d389b47e3975591d6762a006bf1bf33200af 100644
--- a/chrome/browser/resources/vr_shell/vr_shell_ui.js
+++ b/chrome/browser/resources/vr_shell/vr_shell_ui.js
@@ -573,27 +573,37 @@ var vrShellUi = (function() {
this.reloadUiButton = new ReloadUiButton();
}
- setMode(mode, menuMode, fullscreen) {
- /** @const */ var URL_INDICATOR_VISIBILITY_TIMEOUT_MS = 5000;
-
+ setMode(mode, fullscreen) {
this.mode = mode;
- this.menuMode = menuMode;
this.fullscreen = fullscreen;
+ this.updateState();
+ }
+
+ handleAppButtonClicked() {
+ this.menuMode = !this.menuMode;
+ this.updateState();
+ }
+
+ updateState() {
+ /** @const */ var URL_INDICATOR_VISIBILITY_TIMEOUT_MS = 5000;
+
+ let mode = this.mode;
+ let menuMode = this.menuMode;
+
+ api.doAction(api.Action.SET_CONTENT_PAUSED, {'paused': menuMode});
- this.reloadUiButton.setEnabled(mode == api.Mode.STANDARD);
this.contentQuad.setEnabled(mode == api.Mode.STANDARD && !menuMode);
- this.contentQuad.setFullscreen(fullscreen);
+ this.contentQuad.setFullscreen(this.fullscreen);
// TODO(crbug/643815): Set aspect ratio on content quad when available.
- // TODO(amp): Don't show controls in fullscreen once MENU mode lands.
- this.controls.setEnabled(mode == api.Mode.STANDARD && !menuMode);
+ this.controls.setEnabled(menuMode);
+ this.omnibox.setEnabled(menuMode);
this.urlIndicator.setEnabled(mode == api.Mode.STANDARD && !menuMode);
- // TODO(amp): Don't show controls in CINEMA mode once MENU mode lands.
this.urlIndicator.setVisibilityTimeout(
- mode == api.Mode.STANDARD && !menuMode ?
- 0 :
- URL_INDICATOR_VISIBILITY_TIMEOUT_MS);
- this.omnibox.setEnabled(false);
- this.secureOriginWarnings.setEnabled(mode == api.Mode.WEB_VR);
+ URL_INDICATOR_VISIBILITY_TIMEOUT_MS);
+ this.secureOriginWarnings.setEnabled(
+ mode == api.Mode.WEB_VR && !menuMode);
+
+ this.reloadUiButton.setEnabled(mode == api.Mode.STANDARD);
api.setUiCssSize(
uiRootElement.clientWidth, uiRootElement.clientHeight, UI_DPR);
@@ -617,7 +627,10 @@ var vrShellUi = (function() {
function command(dict) {
if ('mode' in dict) {
- uiManager.setMode(dict['mode'], dict['menuMode'], dict['fullscreen']);
+ uiManager.setMode(dict['mode'], dict['fullscreen']);
+ }
+ if ('appButtonClicked' in dict) {
+ uiManager.handleAppButtonClicked();
}
if ('securityLevel' in dict) {
uiManager.setSecurityLevel(dict['securityLevel']);
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.cc ('k') | chrome/browser/resources/vr_shell/vr_shell_ui_api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698