Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * Implements a basic UX control for a connected app remoting session. | 7 * Implements a basic UX control for a connected app remoting session. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** @suppress {duplicate} */ | 10 /** @suppress {duplicate} */ |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 | 22 |
| 23 /** | 23 /** |
| 24 * Interval to refresh the google drive access token. | 24 * Interval to refresh the google drive access token. |
| 25 * @const {number} | 25 * @const {number} |
| 26 */ | 26 */ |
| 27 var DRIVE_ACCESS_TOKEN_REFRESH_INTERVAL_MS = 15 * 60 * 1000; | 27 var DRIVE_ACCESS_TOKEN_REFRESH_INTERVAL_MS = 15 * 60 * 1000; |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * @param {HTMLElement} containerElement | 30 * @param {HTMLElement} containerElement |
| 31 * @param {remoting.ConnectionInfo} connectionInfo | 31 * @param {remoting.ConnectionInfo} connectionInfo |
| 32 * @param {remoting.ClientSession} clientSession | |
| 32 * | 33 * |
| 33 * @constructor | 34 * @constructor |
| 34 * @implements {base.Disposable} | 35 * @implements {base.Disposable} |
| 35 * @implements {remoting.ProtocolExtension} | 36 * @implements {remoting.ProtocolExtension} |
| 36 */ | 37 */ |
| 37 remoting.AppConnectedView = function(containerElement, connectionInfo) { | 38 remoting.AppConnectedView = function(containerElement, |
| 39 connectionInfo, | |
|
kelvinp
2015/05/13 22:36:53
clientSession can be accessed through connectionIn
Jamie
2015/05/13 23:41:24
Done.
| |
| 40 clientSession) { | |
| 38 /** @private */ | 41 /** @private */ |
| 39 this.plugin_ = connectionInfo.plugin(); | 42 this.plugin_ = connectionInfo.plugin(); |
| 40 | 43 |
| 41 /** @private */ | 44 /** @private */ |
| 42 this.host_ = connectionInfo.host(); | 45 this.host_ = connectionInfo.host(); |
| 43 | 46 |
| 44 /** @private {remoting.ContextMenuAdapter} */ | 47 /** @private {remoting.ContextMenuAdapter} */ |
| 45 var menuAdapter = new remoting.ContextMenuChrome(); | 48 var menuAdapter = new remoting.ContextMenuChrome(); |
| 46 | 49 |
| 47 // Initialize the context menus. | 50 // Initialize the context menus. |
| 48 if (!remoting.platformIsChromeOS()) { | 51 if (!remoting.platformIsChromeOS()) { |
| 49 menuAdapter = | 52 menuAdapter = |
| 50 new remoting.ContextMenuDom(document.getElementById('context-menu')); | 53 new remoting.ContextMenuDom(document.getElementById('context-menu')); |
| 51 } | 54 } |
| 52 | 55 |
| 53 this.contextMenu_ = | 56 this.contextMenu_ = new remoting.ApplicationContextMenu(menuAdapter, |
| 54 new remoting.ApplicationContextMenu(menuAdapter, this.plugin_); | 57 this.plugin_, |
| 58 clientSession); | |
| 55 this.contextMenu_.setHostId(connectionInfo.host().hostId); | 59 this.contextMenu_.setHostId(connectionInfo.host().hostId); |
| 56 | 60 |
| 57 /** @private */ | 61 /** @private */ |
| 58 this.keyboardLayoutsMenu_ = new remoting.KeyboardLayoutsMenu(menuAdapter); | 62 this.keyboardLayoutsMenu_ = new remoting.KeyboardLayoutsMenu(menuAdapter); |
| 59 | 63 |
| 60 /** @private */ | 64 /** @private */ |
| 61 this.windowActivationMenu_ = new remoting.WindowActivationMenu(menuAdapter); | 65 this.windowActivationMenu_ = new remoting.WindowActivationMenu(menuAdapter); |
| 62 | 66 |
| 63 var baseView = new remoting.ConnectedView( | 67 var baseView = new remoting.ConnectedView( |
| 64 this.plugin_, containerElement, | 68 this.plugin_, containerElement, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 ]; | 243 ]; |
| 240 remoting.identity.getNewToken(googleDriveScopes).then( | 244 remoting.identity.getNewToken(googleDriveScopes).then( |
| 241 function(/** string */ token){ | 245 function(/** string */ token){ |
| 242 sendExtensionMessage('accessToken', token); | 246 sendExtensionMessage('accessToken', token); |
| 243 }).catch(remoting.Error.handler(function(/** remoting.Error */ error) { | 247 }).catch(remoting.Error.handler(function(/** remoting.Error */ error) { |
| 244 console.log('Failed to refresh access token: ' + error.toString()); | 248 console.log('Failed to refresh access token: ' + error.toString()); |
| 245 })); | 249 })); |
| 246 }; | 250 }; |
| 247 | 251 |
| 248 })(); | 252 })(); |
| OLD | NEW |