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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 124 document.removeEventListener('keydown', remoting.ConnectionStats.onKeydown, |
125 false); | 125 false); |
126 if ('hidden' in document) { | |
127 document.addEventListener('visibilitychange', | |
128 remoting.onVisibilityChanged, false); | |
129 } else { | |
130 document.addEventListener('webkitvisibilitychange', | |
131 remoting.onVisibilityChanged, false); | |
132 } | |
133 } else { | 126 } else { |
134 document.addEventListener('keydown', remoting.ConnectionStats.onKeydown, | 127 document.addEventListener('keydown', remoting.ConnectionStats.onKeydown, |
135 false); | 128 false); |
136 document.removeEventListener('visibilitychange', | |
137 remoting.onVisibilityChanged, false); | |
138 document.removeEventListener('webkitvisibilitychange', | |
139 remoting.onVisibilityChanged, false); | |
140 // TODO(jamiewalch): crbug.com/252796: Remove this once crbug.com/240772 | 129 // TODO(jamiewalch): crbug.com/252796: Remove this once crbug.com/240772 |
141 // is fixed. | 130 // is fixed. |
142 var scroller = document.getElementById('scroller'); | 131 var scroller = document.getElementById('scroller'); |
143 if (scroller) { | 132 if (scroller) { |
144 scroller.classList.remove('no-horizontal-scroll'); | 133 scroller.classList.remove('no-horizontal-scroll'); |
145 scroller.classList.remove('no-vertical-scroll'); | 134 scroller.classList.remove('no-vertical-scroll'); |
146 } | 135 } |
147 } | 136 } |
148 | 137 |
149 remoting.testEvents.raiseEvent(remoting.testEvents.Names.uiModeChanged, mode); | 138 remoting.testEvents.raiseEvent(remoting.testEvents.Names.uiModeChanged, mode); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 284 } |
296 | 285 |
297 /** | 286 /** |
298 * @param {string} tag | 287 * @param {string} tag |
299 */ | 288 */ |
300 remoting.showSetupProcessingMessage = function(tag) { | 289 remoting.showSetupProcessingMessage = function(tag) { |
301 var messageDiv = document.getElementById('host-setup-processing-message'); | 290 var messageDiv = document.getElementById('host-setup-processing-message'); |
302 l10n.localizeElementFromTag(messageDiv, tag); | 291 l10n.localizeElementFromTag(messageDiv, tag); |
303 remoting.setMode(remoting.AppMode.HOST_SETUP_PROCESSING); | 292 remoting.setMode(remoting.AppMode.HOST_SETUP_PROCESSING); |
304 } | 293 } |
OLD | NEW |