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

Side by Side Diff: remoting/webapp/options_menu.js

Issue 336293003: Refactor tool-bar event handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « remoting/webapp/event_handlers.js ('k') | remoting/webapp/session_connector.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview
7 * Class handling the in-session options menu (or menus in the case of apps v1).
8 */
9
10 'use strict';
11
12 /** @suppress {duplicate} */
13 var remoting = remoting || {};
14
15 /**
16 * @param {HTMLElement} sendCtrlAltDel
17 * @param {HTMLElement} sendPrtScrn
18 * @param {HTMLElement} resizeToClient
19 * @param {HTMLElement} shrinkToFit
20 * @param {HTMLElement?} fullscreen
21 * @constructor
22 */
23 remoting.OptionsMenu = function(sendCtrlAltDel, sendPrtScrn,
24 resizeToClient, shrinkToFit, fullscreen) {
25 this.sendCtrlAltDel_ = sendCtrlAltDel;
26 this.sendPrtScrn_ = sendPrtScrn;
27 this.resizeToClient_ = resizeToClient;
28 this.shrinkToFit_ = shrinkToFit;
29 this.fullscreen_ = fullscreen;
30 /**
31 * @type {remoting.ClientSession}
32 * @private
33 */
34 this.clientSession_ = null;
35
36 this.sendCtrlAltDel_.addEventListener(
37 'click', this.onSendCtrlAltDel_.bind(this), false);
38 this.sendPrtScrn_.addEventListener(
39 'click', this.onSendPrtScrn_.bind(this), false);
40 this.resizeToClient_.addEventListener(
41 'click', this.onResizeToClient_.bind(this), false);
42 this.shrinkToFit_.addEventListener(
43 'click', this.onShrinkToFit_.bind(this), false);
44 if (this.fullscreen_) {
45 this.fullscreen_.addEventListener(
46 'click', this.onFullscreen_.bind(this), false);
47 }
48 };
49
50 /**
51 * @param {remoting.ClientSession} clientSession The active session, or null if
52 * there is no connection.
53 */
54 remoting.OptionsMenu.prototype.setClientSession = function(clientSession) {
55 this.clientSession_ = clientSession;
56 };
57
58 remoting.OptionsMenu.prototype.onShow = function() {
59 if (this.clientSession_) {
60 remoting.MenuButton.select(
61 this.resizeToClient_, this.clientSession_.getResizeToClient());
62 remoting.MenuButton.select(
63 this.shrinkToFit_, this.clientSession_.getShrinkToFit());
64 if (this.fullscreen_) {
65 remoting.MenuButton.select(
66 this.fullscreen_, remoting.fullscreen.isActive());
67 }
68 }
69 };
70
71 remoting.OptionsMenu.prototype.onSendCtrlAltDel_ = function() {
72 if (this.clientSession_) {
73 this.clientSession_.sendCtrlAltDel();
74 }
75 };
76
77 remoting.OptionsMenu.prototype.onSendPrtScrn_ = function() {
78 if (this.clientSession_) {
79 this.clientSession_.sendPrintScreen();
80 }
81 };
82
83 remoting.OptionsMenu.prototype.onResizeToClient_ = function() {
84 if (this.clientSession_) {
85 this.clientSession_.setScreenMode(this.clientSession_.getShrinkToFit(),
86 !this.clientSession_.getResizeToClient());
87 }
88 };
89
90 remoting.OptionsMenu.prototype.onShrinkToFit_ = function() {
91 if (this.clientSession_) {
92 this.clientSession_.setScreenMode(!this.clientSession_.getShrinkToFit(),
93 this.clientSession_.getResizeToClient());
94 }
95 };
96
97 remoting.OptionsMenu.prototype.onFullscreen_ = function() {
98 remoting.fullscreen.toggle();
99 };
OLDNEW
« no previous file with comments | « remoting/webapp/event_handlers.js ('k') | remoting/webapp/session_connector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698