| 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 * This class implements the functionality that is specific to desktop | 7 * This class implements the functionality that is specific to desktop |
| 8 * remoting ("Chromoting" or CRD). | 8 * remoting ("Chromoting" or CRD). |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 /** | 151 /** |
| 152 * @return {string} Application product name to be used in UI. | 152 * @return {string} Application product name to be used in UI. |
| 153 */ | 153 */ |
| 154 remoting.DesktopRemoting.prototype.getApplicationName = function() { | 154 remoting.DesktopRemoting.prototype.getApplicationName = function() { |
| 155 return chrome.i18n.getMessage(/*i18n-content*/'PRODUCT_NAME'); | 155 return chrome.i18n.getMessage(/*i18n-content*/'PRODUCT_NAME'); |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 /** | 158 /** |
| 159 * @return {string} The default remap keys for the current platform. | |
| 160 */ | |
| 161 remoting.DesktopRemoting.prototype.getDefaultRemapKeys = function() { | |
| 162 var remapKeys = ''; | |
| 163 // By default, under ChromeOS, remap the right Control key to the right | |
| 164 // Win / Cmd key. | |
| 165 if (remoting.platformIsChromeOS()) { | |
| 166 remapKeys = '0x0700e4>0x0700e7'; | |
| 167 } | |
| 168 return remapKeys; | |
| 169 }; | |
| 170 | |
| 171 /** | |
| 172 * Called when a new session has been connected. | 159 * Called when a new session has been connected. |
| 173 * | 160 * |
| 174 * @param {remoting.ConnectionInfo} connectionInfo | 161 * @param {remoting.ConnectionInfo} connectionInfo |
| 175 * @return {void} Nothing. | 162 * @return {void} Nothing. |
| 176 */ | 163 */ |
| 177 remoting.DesktopRemoting.prototype.handleConnected = function(connectionInfo) { | 164 remoting.DesktopRemoting.prototype.handleConnected = function(connectionInfo) { |
| 178 // Set the text on the buttons shown under the error message so that they are | 165 // Set the text on the buttons shown under the error message so that they are |
| 179 // easy to understand in the case where a successful connection failed, as | 166 // easy to understand in the case where a successful connection failed, as |
| 180 // opposed to the case where a connection never succeeded. | 167 // opposed to the case where a connection never succeeded. |
| 181 // TODO(garykac): Investigate to see if these need to be reverted to their | 168 // TODO(garykac): Investigate to see if these need to be reverted to their |
| 182 // original values in the onDisconnected method. | 169 // original values in the onDisconnected method. |
| 183 var button1 = document.getElementById('client-reconnect-button'); | 170 var button1 = document.getElementById('client-reconnect-button'); |
| 184 l10n.localizeElementFromTag(button1, /*i18n-content*/'RECONNECT'); | 171 l10n.localizeElementFromTag(button1, /*i18n-content*/'RECONNECT'); |
| 185 button1.removeAttribute('autofocus'); | 172 button1.removeAttribute('autofocus'); |
| 186 var button2 = document.getElementById('client-finished-me2me-button'); | 173 var button2 = document.getElementById('client-finished-me2me-button'); |
| 187 l10n.localizeElementFromTag(button2, /*i18n-content*/'OK'); | 174 l10n.localizeElementFromTag(button2, /*i18n-content*/'OK'); |
| 188 button2.setAttribute('autofocus', 'autofocus'); | 175 button2.setAttribute('autofocus', 'autofocus'); |
| 189 | 176 |
| 190 // Reset the refresh flag so that the next connection will retry if needed. | 177 // Reset the refresh flag so that the next connection will retry if needed. |
| 191 this.refreshHostJidIfOffline_ = true; | 178 this.refreshHostJidIfOffline_ = true; |
| 192 | 179 |
| 193 document.getElementById('access-code-entry').value = ''; | 180 document.getElementById('access-code-entry').value = ''; |
| 194 remoting.setMode(remoting.AppMode.IN_SESSION); | 181 remoting.setMode(remoting.AppMode.IN_SESSION); |
| 195 if (!base.isAppsV2()) { | 182 if (!base.isAppsV2()) { |
| 196 remoting.toolbar.center(); | 183 remoting.toolbar.center(); |
| 197 remoting.toolbar.preview(); | 184 remoting.toolbar.preview(); |
| 198 } | 185 } |
| 199 | 186 |
| 200 this.connectedView_ = new remoting.DesktopConnectedView( | 187 this.connectedView_ = new remoting.DesktopConnectedView( |
| 201 document.getElementById('client-container'), connectionInfo, | 188 document.getElementById('client-container'), connectionInfo); |
| 202 this.getDefaultRemapKeys()); | 189 |
| 190 // By default, under ChromeOS, remap the right Control key to the right |
| 191 // Win / Cmd key. |
| 192 if (remoting.platformIsChromeOS()) { |
| 193 connectionInfo.plugin().setRemapKeys('0x0700e4>0x0700e7'); |
| 194 } |
| 203 | 195 |
| 204 if (connectionInfo.mode() === remoting.DesktopConnectedView.Mode.ME2ME) { | 196 if (connectionInfo.mode() === remoting.DesktopConnectedView.Mode.ME2ME) { |
| 205 var sessionConnector = remoting.app.getSessionConnector(); | 197 var sessionConnector = remoting.app.getSessionConnector(); |
| 206 if (remoting.app.hasCapability(remoting.ClientSession.Capability.CAST)) { | 198 if (remoting.app.hasCapability(remoting.ClientSession.Capability.CAST)) { |
| 207 sessionConnector.registerProtocolExtension( | 199 sessionConnector.registerProtocolExtension( |
| 208 new remoting.CastExtensionHandler()); | 200 new remoting.CastExtensionHandler()); |
| 209 } | 201 } |
| 210 sessionConnector.registerProtocolExtension( | 202 sessionConnector.registerProtocolExtension( |
| 211 new remoting.GnubbyAuthHandler()); | 203 new remoting.GnubbyAuthHandler()); |
| 212 } | 204 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 /** @returns {remoting.DesktopConnectedView} */ | 336 /** @returns {remoting.DesktopConnectedView} */ |
| 345 remoting.DesktopRemoting.prototype.getConnectedViewForTesting = function() { | 337 remoting.DesktopRemoting.prototype.getConnectedViewForTesting = function() { |
| 346 return this.connectedView_; | 338 return this.connectedView_; |
| 347 }; | 339 }; |
| 348 | 340 |
| 349 /** | 341 /** |
| 350 * Global instance of remoting.DesktopRemoting used for testing. | 342 * Global instance of remoting.DesktopRemoting used for testing. |
| 351 * @type {remoting.DesktopRemoting} | 343 * @type {remoting.DesktopRemoting} |
| 352 */ | 344 */ |
| 353 remoting.desktopDelegateForTesting = null; | 345 remoting.desktopDelegateForTesting = null; |
| OLD | NEW |