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 * remoting.ContextMenuAdapter implementation backed by chrome.contextMenus. | 7 * remoting.ContextMenuAdapter implementation backed by chrome.contextMenus. |
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 * @constructor | 16 * @constructor |
17 * @implements {remoting.ContextMenuAdapter} | 17 * @implements {remoting.ContextMenuAdapter} |
18 */ | 18 */ |
19 remoting.ContextMenuChrome = function() {}; | 19 remoting.ContextMenuChrome = function() {}; |
20 | 20 |
21 remoting.ContextMenuChrome.prototype.dispose = function() {}; | 21 remoting.ContextMenuChrome.prototype.dispose = function() { |
| 22 chrome.contextMenus.removeAll(); |
| 23 }; |
22 | 24 |
23 /** | 25 /** |
24 * @param {string} id An identifier for the menu entry. | 26 * @param {string} id An identifier for the menu entry. |
25 * @param {string} title The text to display in the menu. | 27 * @param {string} title The text to display in the menu. |
26 * @param {boolean} isCheckable True if the state of this menu entry should | 28 * @param {boolean} isCheckable True if the state of this menu entry should |
27 * have a check-box and manage its toggle state automatically. | 29 * have a check-box and manage its toggle state automatically. |
28 * @param {string=} opt_parentId The id of the parent menu item for submenus. | 30 * @param {string=} opt_parentId The id of the parent menu item for submenus. |
29 */ | 31 */ |
30 remoting.ContextMenuChrome.prototype.create = function( | 32 remoting.ContextMenuChrome.prototype.create = function( |
31 id, title, isCheckable, opt_parentId) { | 33 id, title, isCheckable, opt_parentId) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 }; | 86 }; |
85 | 87 |
86 /** | 88 /** |
87 * @param {*} message | 89 * @param {*} message |
88 * @param {Window} backgroundPage | 90 * @param {Window} backgroundPage |
89 */ | 91 */ |
90 remoting.ContextMenuChrome.prototype.postMessage_ = function( | 92 remoting.ContextMenuChrome.prototype.postMessage_ = function( |
91 message, backgroundPage) { | 93 message, backgroundPage) { |
92 backgroundPage.postMessage(message, '*'); | 94 backgroundPage.postMessage(message, '*'); |
93 }; | 95 }; |
OLD | NEW |