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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 /** @private {remoting.ContextMenuAdapter} */ | 44 /** @private {remoting.ContextMenuAdapter} */ |
45 var menuAdapter = new remoting.ContextMenuChrome(); | 45 var menuAdapter = new remoting.ContextMenuChrome(); |
46 | 46 |
47 // Initialize the context menus. | 47 // Initialize the context menus. |
48 if (!remoting.platformIsChromeOS()) { | 48 if (!remoting.platformIsChromeOS()) { |
49 menuAdapter = | 49 menuAdapter = |
50 new remoting.ContextMenuDom(document.getElementById('context-menu')); | 50 new remoting.ContextMenuDom(document.getElementById('context-menu')); |
51 } | 51 } |
52 | 52 |
53 this.contextMenu_ = new remoting.ApplicationContextMenu(menuAdapter); | 53 this.contextMenu_ = |
| 54 new remoting.ApplicationContextMenu(menuAdapter, this.plugin_); |
54 this.contextMenu_.setHostId(connectionInfo.host().hostId); | 55 this.contextMenu_.setHostId(connectionInfo.host().hostId); |
55 | 56 |
56 /** @private */ | 57 /** @private */ |
57 this.keyboardLayoutsMenu_ = new remoting.KeyboardLayoutsMenu(menuAdapter); | 58 this.keyboardLayoutsMenu_ = new remoting.KeyboardLayoutsMenu(menuAdapter); |
58 | 59 |
59 /** @private */ | 60 /** @private */ |
60 this.windowActivationMenu_ = new remoting.WindowActivationMenu(menuAdapter); | 61 this.windowActivationMenu_ = new remoting.WindowActivationMenu(menuAdapter); |
61 | 62 |
62 var baseView = new remoting.ConnectedView( | 63 var baseView = new remoting.ConnectedView( |
63 this.plugin_, containerElement, | 64 this.plugin_, containerElement, |
64 containerElement.querySelector('.mouse-cursor-overlay')); | 65 containerElement.querySelector('.mouse-cursor-overlay')); |
65 | 66 |
66 var windowShapeHook = new base.EventHook( | 67 var windowShapeHook = new base.EventHook( |
67 this.plugin_.hostDesktop(), | 68 this.plugin_.hostDesktop(), |
68 remoting.HostDesktop.Events.shapeChanged, | 69 remoting.HostDesktop.Events.shapeChanged, |
69 remoting.windowShape.setDesktopRects.bind(remoting.windowShape)); | 70 remoting.windowShape.setDesktopRects.bind(remoting.windowShape)); |
70 | 71 |
71 var desktopSizeHook = new base.EventHook( | 72 var desktopSizeHook = new base.EventHook( |
72 this.plugin_.hostDesktop(), | 73 this.plugin_.hostDesktop(), |
73 remoting.HostDesktop.Events.sizeChanged, | 74 remoting.HostDesktop.Events.sizeChanged, |
74 this.onDesktopSizeChanged_.bind(this)); | 75 this.onDesktopSizeChanged_.bind(this)); |
75 | 76 |
76 /** @private */ | 77 /** @private */ |
77 this.disposables_ = new base.Disposables( | 78 this.disposables_ = new base.Disposables( |
78 baseView, windowShapeHook, desktopSizeHook); | 79 baseView, windowShapeHook, desktopSizeHook, this.contextMenu_); |
79 | 80 |
80 /** @private */ | 81 /** @private */ |
81 this.supportsGoogleDrive_ = connectionInfo.session().hasCapability( | 82 this.supportsGoogleDrive_ = connectionInfo.session().hasCapability( |
82 remoting.ClientSession.Capability.GOOGLE_DRIVE); | 83 remoting.ClientSession.Capability.GOOGLE_DRIVE); |
83 | 84 |
84 this.resizeHostToClientArea_(); | 85 this.resizeHostToClientArea_(); |
85 this.plugin_.extensions().register(this); | 86 this.plugin_.extensions().register(this); |
86 }; | 87 }; |
87 | 88 |
88 /** | 89 /** |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 ]; | 239 ]; |
239 remoting.identity.getNewToken(googleDriveScopes).then( | 240 remoting.identity.getNewToken(googleDriveScopes).then( |
240 function(/** string */ token){ | 241 function(/** string */ token){ |
241 sendExtensionMessage('accessToken', token); | 242 sendExtensionMessage('accessToken', token); |
242 }).catch(remoting.Error.handler(function(/** remoting.Error */ error) { | 243 }).catch(remoting.Error.handler(function(/** remoting.Error */ error) { |
243 console.log('Failed to refresh access token: ' + error.toString()); | 244 console.log('Failed to refresh access token: ' + error.toString()); |
244 })); | 245 })); |
245 }; | 246 }; |
246 | 247 |
247 })(); | 248 })(); |
OLD | NEW |