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

Unified Diff: remoting/webapp/window_frame.js

Issue 339613003: Remove the blue tool-bar for apps v2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use classes for help and feedback elements. Created 6 years, 5 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
« remoting/webapp/menu_button.js ('K') | « remoting/webapp/window_frame.css ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/window_frame.js
diff --git a/remoting/webapp/window_frame.js b/remoting/webapp/window_frame.js
index 6bdf3fb752ca70f48151615d4e28b89db79f8323..ce62f6c056ddea4dd2a30276772727ae1a47d7ef 100644
--- a/remoting/webapp/window_frame.js
+++ b/remoting/webapp/window_frame.js
@@ -18,10 +18,10 @@ var remoting = remoting || {};
*/
remoting.WindowFrame = function(titleBar) {
/**
- * @type {boolean}
+ * @type {remoting.ClientSession}
* @private
*/
- this.isConnected_ = false;
+ this.clientSession_ = null;
/**
* @type {HTMLElement}
@@ -38,6 +38,25 @@ remoting.WindowFrame = function(titleBar) {
base.debug.assert(this.hoverTarget_ != null);
/**
+ * @type {remoting.OptionsMenu}
+ * @private
+ */
+ this.optionsMenu_ = new remoting.OptionsMenu(
+ titleBar.querySelector('.menu-send-ctrl-alt-del'),
+ titleBar.querySelector('.menu-send-print-screen'),
+ titleBar.querySelector('.menu-resize-to-client'),
+ titleBar.querySelector('.menu-shrink-to-fit'),
+ null);
+
+ /**
+ * @type {HTMLElement}
+ * @private
+ */
+ this.title_ = /** @type {HTMLElement} */
+ (titleBar.querySelector('.window-title'));
+ base.debug.assert(this.title_ != null);
+
+ /**
* @type {HTMLElement}
* @private
*/
@@ -46,6 +65,28 @@ remoting.WindowFrame = function(titleBar) {
base.debug.assert(this.maximizeRestoreControl_ != null);
/**
+ * @type {HTMLElement}
+ * @private
+ */
+ this.resizeToClientMenuEntry_ = /** @type {HTMLElement} */
+ (titleBar.querySelector('.menu-resize-to-client'));
+ base.debug.assert(this.resizeToClientMenuEntry_ != null);
+
+ /**
+ * @type {HTMLElement}
+ * @private
+ */
+ this.shrinkToFitMenuEntry_ = /** @type {HTMLElement} */
+ (titleBar.querySelector('.menu-shrink-to-fit'));
+ base.debug.assert(this.shrinkToFitMenuEntry_ != null);
+
+ var optionsButton = titleBar.querySelector('.window-options');
+ base.debug.assert(optionsButton != null);
+ this.optionMenuButton_ = new remoting.MenuButton(
+ optionsButton,
+ this.optionsMenu_.onShow.bind(this.optionsMenu_));
+
+ /**
* @type {Array.<{cls:string, fn: function()}>}
*/
var handlers = [
@@ -73,14 +114,23 @@ remoting.WindowFrame = function(titleBar) {
};
/**
- * @param {boolean} isConnected True if there is a connection active.
+ * @param {remoting.ClientSession} clientSession The client session, or null if
+ * there is no connection.
*/
-remoting.WindowFrame.prototype.setConnected = function(isConnected) {
- this.isConnected_ = isConnected;
- if (this.isConnected_) {
+remoting.WindowFrame.prototype.setClientSession = function(clientSession) {
+ this.optionsMenu_.setClientSession(clientSession);
+ this.clientSession_ = clientSession;
+ var windowTitle = document.head.querySelector('title');
+ if (this.clientSession_) {
document.body.classList.add('connected');
+ this.title_.innerText = clientSession.getHostDisplayName();
+ windowTitle.innerText = clientSession.getHostDisplayName() + ' - ' +
+ chrome.i18n.getMessage(/*i18n-content*/'PRODUCT_NAME');
} else {
document.body.classList.remove('connected');
+ this.title_.innerHTML = '&nbsp;';
+ windowTitle.innerText =
+ chrome.i18n.getMessage(/*i18n-content*/'PRODUCT_NAME');
}
this.updateMaximizeOrRestoreIconTitle_();
};
@@ -131,7 +181,7 @@ remoting.WindowFrame.prototype.maximizeOrRestoreWindow_ = function() {
// being maximized, then the second restore has no effect.
chrome.app.window.current().restore();
chrome.app.window.current().restore();
- } else if (this.isConnected_) {
+ } else if (this.clientSession_) {
chrome.app.window.current().fullscreen();
} else {
chrome.app.window.current().maximize();
@@ -165,7 +215,7 @@ remoting.WindowFrame.prototype.updateMaximizeOrRestoreIconTitle_ = function() {
tag = /*i18n-content*/'EXIT_FULL_SCREEN';
} else if (chrome.app.window.current().isMaximized()) {
tag = /*i18n-content*/'RESTORE_WINDOW';
- } else if (this.isConnected_) {
+ } else if (this.clientSession_) {
tag = /*i18n-content*/'FULL_SCREEN';
} else {
tag = /*i18n-content*/'MAXIMIZE_WINDOW';
@@ -174,4 +224,4 @@ remoting.WindowFrame.prototype.updateMaximizeOrRestoreIconTitle_ = function() {
};
/** @type {remoting.WindowFrame} */
-remoting.windowFrame = null;
+remoting.windowFrame = null;
« remoting/webapp/menu_button.js ('K') | « remoting/webapp/window_frame.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698