| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * Class handling the in-session options menu (or menus in the case of apps v1). | 7 * Class handling the in-session options menu (or menus in the case of apps v1). |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| 11 | 11 |
| 12 /** @suppress {duplicate} */ | 12 /** @suppress {duplicate} */ |
| 13 var remoting = remoting || {}; | 13 var remoting = remoting || {}; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * @param {HTMLElement} sendCtrlAltDel | 16 * @param {Element} sendCtrlAltDel |
| 17 * @param {HTMLElement} sendPrtScrn | 17 * @param {Element} sendPrtScrn |
| 18 * @param {HTMLElement} resizeToClient | 18 * @param {Element} resizeToClient |
| 19 * @param {HTMLElement} shrinkToFit | 19 * @param {Element} shrinkToFit |
| 20 * @param {HTMLElement?} fullscreen | 20 * @param {Element} newConnection |
| 21 * @param {Element?} fullscreen |
| 21 * @constructor | 22 * @constructor |
| 22 */ | 23 */ |
| 23 remoting.OptionsMenu = function(sendCtrlAltDel, sendPrtScrn, | 24 remoting.OptionsMenu = function(sendCtrlAltDel, sendPrtScrn, |
| 24 resizeToClient, shrinkToFit, fullscreen) { | 25 resizeToClient, shrinkToFit, |
| 26 newConnection, fullscreen) { |
| 25 this.sendCtrlAltDel_ = sendCtrlAltDel; | 27 this.sendCtrlAltDel_ = sendCtrlAltDel; |
| 26 this.sendPrtScrn_ = sendPrtScrn; | 28 this.sendPrtScrn_ = sendPrtScrn; |
| 27 this.resizeToClient_ = resizeToClient; | 29 this.resizeToClient_ = resizeToClient; |
| 28 this.shrinkToFit_ = shrinkToFit; | 30 this.shrinkToFit_ = shrinkToFit; |
| 31 this.newConnection_ = newConnection; |
| 29 this.fullscreen_ = fullscreen; | 32 this.fullscreen_ = fullscreen; |
| 30 /** | 33 /** |
| 31 * @type {remoting.ClientSession} | 34 * @type {remoting.ClientSession} |
| 32 * @private | 35 * @private |
| 33 */ | 36 */ |
| 34 this.clientSession_ = null; | 37 this.clientSession_ = null; |
| 35 | 38 |
| 36 this.sendCtrlAltDel_.addEventListener( | 39 this.sendCtrlAltDel_.addEventListener( |
| 37 'click', this.onSendCtrlAltDel_.bind(this), false); | 40 'click', this.onSendCtrlAltDel_.bind(this), false); |
| 38 this.sendPrtScrn_.addEventListener( | 41 this.sendPrtScrn_.addEventListener( |
| 39 'click', this.onSendPrtScrn_.bind(this), false); | 42 'click', this.onSendPrtScrn_.bind(this), false); |
| 40 this.resizeToClient_.addEventListener( | 43 this.resizeToClient_.addEventListener( |
| 41 'click', this.onResizeToClient_.bind(this), false); | 44 'click', this.onResizeToClient_.bind(this), false); |
| 42 this.shrinkToFit_.addEventListener( | 45 this.shrinkToFit_.addEventListener( |
| 43 'click', this.onShrinkToFit_.bind(this), false); | 46 'click', this.onShrinkToFit_.bind(this), false); |
| 47 this.newConnection_.addEventListener( |
| 48 'click', this.onNewConnection_.bind(this), false); |
| 44 if (this.fullscreen_) { | 49 if (this.fullscreen_) { |
| 45 this.fullscreen_.addEventListener( | 50 this.fullscreen_.addEventListener( |
| 46 'click', this.onFullscreen_.bind(this), false); | 51 'click', this.onFullscreen_.bind(this), false); |
| 47 } | 52 } |
| 48 }; | 53 }; |
| 49 | 54 |
| 50 /** | 55 /** |
| 51 * @param {remoting.ClientSession} clientSession The active session, or null if | 56 * @param {remoting.ClientSession} clientSession The active session, or null if |
| 52 * there is no connection. | 57 * there is no connection. |
| 53 */ | 58 */ |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 92 } |
| 88 }; | 93 }; |
| 89 | 94 |
| 90 remoting.OptionsMenu.prototype.onShrinkToFit_ = function() { | 95 remoting.OptionsMenu.prototype.onShrinkToFit_ = function() { |
| 91 if (this.clientSession_) { | 96 if (this.clientSession_) { |
| 92 this.clientSession_.setScreenMode(!this.clientSession_.getShrinkToFit(), | 97 this.clientSession_.setScreenMode(!this.clientSession_.getShrinkToFit(), |
| 93 this.clientSession_.getResizeToClient()); | 98 this.clientSession_.getResizeToClient()); |
| 94 } | 99 } |
| 95 }; | 100 }; |
| 96 | 101 |
| 102 remoting.OptionsMenu.prototype.onNewConnection_ = function() { |
| 103 chrome.app.window.create('main.html', { |
| 104 'width': 800, |
| 105 'height': 600, |
| 106 'frame': 'none' |
| 107 }); |
| 108 }; |
| 109 |
| 97 remoting.OptionsMenu.prototype.onFullscreen_ = function() { | 110 remoting.OptionsMenu.prototype.onFullscreen_ = function() { |
| 98 remoting.fullscreen.toggle(); | 111 remoting.fullscreen.toggle(); |
| 99 }; | 112 }; |
| OLD | NEW |