| 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 to update the application's context menu to include host-side windows | 7 * Class to update the application's context menu to include host-side windows |
| 8 * and to notify the host when one of these menu items is selected. | 8 * and to notify the host when one of these menu items is selected. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 * @return {string} | 59 * @return {string} |
| 60 * @private | 60 * @private |
| 61 */ | 61 */ |
| 62 remoting.WindowActivationMenu.prototype.makeMenuId_ = function(windowId) { | 62 remoting.WindowActivationMenu.prototype.makeMenuId_ = function(windowId) { |
| 63 return 'window-' + windowId; | 63 return 'window-' + windowId; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 /** | 66 /** |
| 67 * Handle a click on the application's context menu. | 67 * Handle a click on the application's context menu. |
| 68 * | 68 * |
| 69 * @param {OnClickData} info | 69 * @param {OnClickData=} info |
| 70 * @private | 70 * @private |
| 71 */ | 71 */ |
| 72 remoting.WindowActivationMenu.prototype.onContextMenu_ = function(info) { | 72 remoting.WindowActivationMenu.prototype.onContextMenu_ = function(info) { |
| 73 /** @type {Array.<string>} */ | 73 /** @type {Array.<string>} */ |
| 74 var components = info.menuItemId.split('-'); | 74 var components = info.menuItemId.split('-'); |
| 75 if (components.length == 2 && | 75 if (components.length == 2 && |
| 76 this.makeMenuId_(parseInt(components[1], 10)) == info.menuItemId) { | 76 this.makeMenuId_(parseInt(components[1], 10)) == info.menuItemId) { |
| 77 remoting.clientSession.sendClientMessage( | 77 remoting.clientSession.sendClientMessage( |
| 78 'activateWindow', | 78 'activateWindow', |
| 79 JSON.stringify({ id: parseInt(components[1], 0) })); | 79 JSON.stringify({ id: parseInt(components[1], 0) })); |
| 80 if (chrome.app.window.current().isMinimized()) { | 80 if (chrome.app.window.current().isMinimized()) { |
| 81 chrome.app.window.current().restore(); | 81 chrome.app.window.current().restore(); |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 }; | 84 }; |
| OLD | NEW |