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 * Class representing the application's context menu. | 7 * Class representing the application's context menu. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
11 | 11 |
12 /** @suppress {duplicate} */ | 12 /** @suppress {duplicate} */ |
13 var remoting = remoting || {}; | 13 var remoting = remoting || {}; |
14 | 14 |
15 /** | 15 /** |
16 * @param {remoting.ContextMenuAdapter} adapter | 16 * @param {remoting.ContextMenuAdapter} adapter |
17 * @param {remoting.ClientPlugin} plugin | 17 * @param {remoting.ClientPlugin} plugin |
18 * @param {remoting.ClientSession} clientSession | |
19 * | |
18 * @constructor | 20 * @constructor |
19 * @implements {base.Disposable} | 21 * @implements {base.Disposable} |
20 */ | 22 */ |
21 remoting.ApplicationContextMenu = function(adapter, plugin) { | 23 remoting.ApplicationContextMenu = function(adapter, plugin, clientSession) { |
kelvinp
2015/05/13 22:36:53
what about just passing the sessionId?
Jamie
2015/05/13 23:41:24
That would work in the majority of cases, but sinc
kelvinp
2015/05/14 01:18:04
Acknowledged.
| |
22 /** @private {remoting.ContextMenuAdapter} */ | 24 /** @private */ |
23 this.adapter_ = adapter; | 25 this.adapter_ = adapter; |
24 | 26 |
27 /** @private */ | |
28 this.clientSession_ = clientSession; | |
29 | |
25 this.adapter_.create( | 30 this.adapter_.create( |
26 remoting.ApplicationContextMenu.kSendFeedbackId, | 31 remoting.ApplicationContextMenu.kSendFeedbackId, |
27 l10n.getTranslationOrError(/*i18n-content*/'SEND_FEEDBACK'), | 32 l10n.getTranslationOrError(/*i18n-content*/'SEND_FEEDBACK'), |
28 false); | 33 false); |
29 this.adapter_.create( | 34 this.adapter_.create( |
30 remoting.ApplicationContextMenu.kShowStatsId, | 35 remoting.ApplicationContextMenu.kShowStatsId, |
31 l10n.getTranslationOrError(/*i18n-content*/'SHOW_STATS'), | 36 l10n.getTranslationOrError(/*i18n-content*/'SHOW_STATS'), |
32 true); | 37 true); |
33 | 38 |
34 // TODO(kelvinp):Unhook this event on shutdown. | 39 // TODO(kelvinp):Unhook this event on shutdown. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 | 92 |
88 /** @type {remoting.ApplicationContextMenu} */ | 93 /** @type {remoting.ApplicationContextMenu} */ |
89 var that = this; | 94 var that = this; |
90 | 95 |
91 /** @param {AppWindow} consentWindow */ | 96 /** @param {AppWindow} consentWindow */ |
92 var onCreate = function(consentWindow) { | 97 var onCreate = function(consentWindow) { |
93 var onLoad = function() { | 98 var onLoad = function() { |
94 var message = { | 99 var message = { |
95 method: 'init', | 100 method: 'init', |
96 hostId: that.hostId_, | 101 hostId: that.hostId_, |
97 connectionStats: JSON.stringify(that.stats_.mostRecent()) | 102 connectionStats: JSON.stringify(that.stats_.mostRecent()), |
103 sessionId: that.clientSession_.getSessionId() | |
98 }; | 104 }; |
99 consentWindow.contentWindow.postMessage(message, '*'); | 105 consentWindow.contentWindow.postMessage(message, '*'); |
100 }; | 106 }; |
101 consentWindow.contentWindow.addEventListener('load', onLoad, false); | 107 consentWindow.contentWindow.addEventListener('load', onLoad, false); |
102 }; | 108 }; |
103 chrome.app.window.create( | 109 chrome.app.window.create( |
104 'feedback_consent.html', windowAttributes, onCreate); | 110 'feedback_consent.html', windowAttributes, onCreate); |
105 break; | 111 break; |
106 | 112 |
107 case remoting.ApplicationContextMenu.kShowStatsId: | 113 case remoting.ApplicationContextMenu.kShowStatsId: |
108 this.stats_.show(info.checked); | 114 this.stats_.show(info.checked); |
109 break; | 115 break; |
110 } | 116 } |
111 }; | 117 }; |
112 | 118 |
113 | 119 |
114 /** @type {string} */ | 120 /** @type {string} */ |
115 remoting.ApplicationContextMenu.kSendFeedbackId = 'send-feedback'; | 121 remoting.ApplicationContextMenu.kSendFeedbackId = 'send-feedback'; |
116 | 122 |
117 /** @type {string} */ | 123 /** @type {string} */ |
118 remoting.ApplicationContextMenu.kShowStatsId = 'show-stats'; | 124 remoting.ApplicationContextMenu.kShowStatsId = 'show-stats'; |
OLD | NEW |