OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 * Functions related to controlling the modal UI state of the app. UI states | 7 * Functions related to controlling the modal UI state of the app. UI states |
8 * are expressed as HTML attributes with a dotted hierarchy. For example, the | 8 * are expressed as HTML attributes with a dotted hierarchy. For example, the |
9 * string 'host.shared' will match any elements with an associated attribute | 9 * string 'host.shared' will match any elements with an associated attribute |
10 * of 'host' or 'host.shared', showing those elements and hiding all others. | 10 * of 'host' or 'host.shared', showing those elements and hiding all others. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 /** | 113 /** |
114 * Change the app's modal state to |mode|, determined by the data-ui-mode | 114 * Change the app's modal state to |mode|, determined by the data-ui-mode |
115 * attribute. | 115 * attribute. |
116 * | 116 * |
117 * @param {remoting.AppMode} mode The new modal state. | 117 * @param {remoting.AppMode} mode The new modal state. |
118 */ | 118 */ |
119 remoting.setMode = function(mode) { | 119 remoting.setMode = function(mode) { |
120 remoting.updateModalUi(mode, 'data-ui-mode'); | 120 remoting.updateModalUi(mode, 'data-ui-mode'); |
121 console.log('App mode: ' + mode); | 121 console.log('App mode: ' + mode); |
122 remoting.currentMode = mode; | 122 remoting.currentMode = mode; |
123 if (mode == remoting.AppMode.IN_SESSION) { | 123 if (mode !== remoting.AppMode.IN_SESSION) { |
124 document.removeEventListener('keydown', remoting.ConnectionStats.onKeydown, | |
125 false); | |
126 } else { | |
127 document.addEventListener('keydown', remoting.ConnectionStats.onKeydown, | |
128 false); | |
129 // TODO(jamiewalch): crbug.com/252796: Remove this once crbug.com/240772 | 124 // TODO(jamiewalch): crbug.com/252796: Remove this once crbug.com/240772 |
130 // is fixed. | 125 // is fixed. |
131 var scroller = document.getElementById('scroller'); | 126 var scroller = document.getElementById('scroller'); |
132 if (scroller) { | 127 if (scroller) { |
133 scroller.classList.remove('no-horizontal-scroll'); | 128 scroller.classList.remove('no-horizontal-scroll'); |
134 scroller.classList.remove('no-vertical-scroll'); | 129 scroller.classList.remove('no-vertical-scroll'); |
135 } | 130 } |
136 } | 131 } |
137 | 132 |
138 remoting.testEvents.raiseEvent(remoting.testEvents.Names.uiModeChanged, mode); | 133 remoting.testEvents.raiseEvent(remoting.testEvents.Names.uiModeChanged, mode); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 } | 279 } |
285 | 280 |
286 /** | 281 /** |
287 * @param {string} tag | 282 * @param {string} tag |
288 */ | 283 */ |
289 remoting.showSetupProcessingMessage = function(tag) { | 284 remoting.showSetupProcessingMessage = function(tag) { |
290 var messageDiv = document.getElementById('host-setup-processing-message'); | 285 var messageDiv = document.getElementById('host-setup-processing-message'); |
291 l10n.localizeElementFromTag(messageDiv, tag); | 286 l10n.localizeElementFromTag(messageDiv, tag); |
292 remoting.setMode(remoting.AppMode.HOST_SETUP_PROCESSING); | 287 remoting.setMode(remoting.AppMode.HOST_SETUP_PROCESSING); |
293 } | 288 } |
OLD | NEW |