| 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 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.Object} | 7 * @extends {WebInspector.Object} |
| 8 * @param {!Element} element | 8 * @param {!Element} element |
| 9 */ | 9 */ |
| 10 WebInspector.DropDownMenu = function(element) | 10 WebInspector.DropDownMenu = function(element) |
| 11 { | 11 { |
| 12 /** @type {!Array.<!WebInspector.DropDownMenu.Item>} */ | 12 /** @type {!Array.<!WebInspector.DropDownMenu.Item>} */ |
| 13 this._items = []; | 13 this._items = []; |
| 14 | 14 |
| 15 element.addEventListener("mousedown", this._onMouseDown.bind(this)); | 15 element.addEventListener("mousedown", this._onMouseDown.bind(this)); |
| 16 } | 16 }; |
| 17 | 17 |
| 18 /** @typedef {{id: string, title: string}} */ | 18 /** @typedef {{id: string, title: string}} */ |
| 19 WebInspector.DropDownMenu.Item; | 19 WebInspector.DropDownMenu.Item; |
| 20 | 20 |
| 21 /** @enum {symbol} */ | 21 /** @enum {symbol} */ |
| 22 WebInspector.DropDownMenu.Events = { | 22 WebInspector.DropDownMenu.Events = { |
| 23 ItemSelected: Symbol("ItemSelected") | 23 ItemSelected: Symbol("ItemSelected") |
| 24 } | 24 }; |
| 25 | 25 |
| 26 WebInspector.DropDownMenu.prototype = { | 26 WebInspector.DropDownMenu.prototype = { |
| 27 /** | 27 /** |
| 28 * @param {!Event} event | 28 * @param {!Event} event |
| 29 */ | 29 */ |
| 30 _onMouseDown: function(event) | 30 _onMouseDown: function(event) |
| 31 { | 31 { |
| 32 if (event.which !== 1) | 32 if (event.which !== 1) |
| 33 return; | 33 return; |
| 34 var menu = new WebInspector.ContextMenu(event); | 34 var menu = new WebInspector.ContextMenu(event); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 62 this._selectedItemId = id; | 62 this._selectedItemId = id; |
| 63 }, | 63 }, |
| 64 | 64 |
| 65 clear: function() | 65 clear: function() |
| 66 { | 66 { |
| 67 this._items = []; | 67 this._items = []; |
| 68 delete this._selectedItemId; | 68 delete this._selectedItemId; |
| 69 }, | 69 }, |
| 70 | 70 |
| 71 __proto__: WebInspector.Object.prototype | 71 __proto__: WebInspector.Object.prototype |
| 72 } | 72 }; |
| OLD | NEW |