Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(955)

Side by Side Diff: Source/devtools/front_end/ui/ContextMenu.js

Issue 301163005: DevTools: [JSDoc] Avoid partial arg list annotations in code except "profiler" module (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @param {!WebInspector.ContextSubMenuItem} topLevelMenu 33 * @param {!WebInspector.ContextMenu} topLevelMenu
34 * @param {string} type 34 * @param {string} type
35 * @param {string=} label 35 * @param {string=} label
36 * @param {boolean=} disabled 36 * @param {boolean=} disabled
37 * @param {boolean=} checked 37 * @param {boolean=} checked
38 */ 38 */
39 WebInspector.ContextMenuItem = function(topLevelMenu, type, label, disabled, che cked) 39 WebInspector.ContextMenuItem = function(topLevelMenu, type, label, disabled, che cked)
40 { 40 {
41 this._type = type; 41 this._type = type;
42 this._label = label; 42 this._label = label;
43 this._disabled = disabled; 43 this._disabled = disabled;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return { type: "separator" }; 89 return { type: "separator" };
90 case "checkbox": 90 case "checkbox":
91 return { type: "checkbox", id: this._id, label: this._label, checked : !!this._checked, enabled: !this._disabled }; 91 return { type: "checkbox", id: this._id, label: this._label, checked : !!this._checked, enabled: !this._disabled };
92 } 92 }
93 } 93 }
94 } 94 }
95 95
96 /** 96 /**
97 * @constructor 97 * @constructor
98 * @extends {WebInspector.ContextMenuItem} 98 * @extends {WebInspector.ContextMenuItem}
99 * @param topLevelMenu 99 * @param {!WebInspector.ContextMenu} topLevelMenu
100 * @param {string=} label 100 * @param {string=} label
101 * @param {boolean=} disabled 101 * @param {boolean=} disabled
102 */ 102 */
103 WebInspector.ContextSubMenuItem = function(topLevelMenu, label, disabled) 103 WebInspector.ContextSubMenuItem = function(topLevelMenu, label, disabled)
104 { 104 {
105 WebInspector.ContextMenuItem.call(this, topLevelMenu, "subMenu", label, disa bled); 105 WebInspector.ContextMenuItem.call(this, topLevelMenu, "subMenu", label, disa bled);
106 /** @type {!Array.<!WebInspector.ContextMenuItem>} */ 106 /** @type {!Array.<!WebInspector.ContextMenuItem>} */
107 this._items = []; 107 this._items = [];
108 } 108 }
109 109
110 WebInspector.ContextSubMenuItem.prototype = { 110 WebInspector.ContextSubMenuItem.prototype = {
111 /** 111 /**
112 * @param {string} label 112 * @param {string} label
113 * @param {function(?)} handler 113 * @param {function(?)} handler
114 * @param {boolean=} disabled 114 * @param {boolean=} disabled
115 * @return {!WebInspector.ContextMenuItem} 115 * @return {!WebInspector.ContextMenuItem}
116 */ 116 */
117 appendItem: function(label, handler, disabled) 117 appendItem: function(label, handler, disabled)
118 { 118 {
119 var item = new WebInspector.ContextMenuItem(this._contextMenu, "item", l abel, disabled); 119 var item = new WebInspector.ContextMenuItem(this._contextMenu, "item", l abel, disabled);
120 this._pushItem(item); 120 this._pushItem(item);
121 this._contextMenu._setHandler(item.id(), handler); 121 this._contextMenu._setHandler(item.id(), handler);
122 return item; 122 return item;
123 }, 123 },
124 124
125 /** 125 /**
126 * @param {string} label 126 * @param {string} label
127 * @param {boolean=} disabled 127 * @param {boolean=} disabled
128 * @return {!WebInspector.ContextMenuItem} 128 * @return {!WebInspector.ContextSubMenuItem}
129 */ 129 */
130 appendSubMenuItem: function(label, disabled) 130 appendSubMenuItem: function(label, disabled)
131 { 131 {
132 var item = new WebInspector.ContextSubMenuItem(this._contextMenu, label, disabled); 132 var item = new WebInspector.ContextSubMenuItem(this._contextMenu, label, disabled);
133 this._pushItem(item); 133 this._pushItem(item);
134 return item; 134 return item;
135 }, 135 },
136 136
137 /** 137 /**
138 * @param {string} label
139 * @param {function()} handler
140 * @param {boolean=} checked
138 * @param {boolean=} disabled 141 * @param {boolean=} disabled
139 * @return {!WebInspector.ContextMenuItem} 142 * @return {!WebInspector.ContextMenuItem}
140 */ 143 */
141 appendCheckboxItem: function(label, handler, checked, disabled) 144 appendCheckboxItem: function(label, handler, checked, disabled)
142 { 145 {
143 var item = new WebInspector.ContextMenuItem(this._contextMenu, "checkbox ", label, disabled, checked); 146 var item = new WebInspector.ContextMenuItem(this._contextMenu, "checkbox ", label, disabled, checked);
144 this._pushItem(item); 147 this._pushItem(item);
145 this._contextMenu._setHandler(item.id(), handler); 148 this._contextMenu._setHandler(item.id(), handler);
146 return item; 149 return item;
147 }, 150 },
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 result.subItems.push(this._items[i]._buildDescriptor()); 182 result.subItems.push(this._items[i]._buildDescriptor());
180 return result; 183 return result;
181 }, 184 },
182 185
183 __proto__: WebInspector.ContextMenuItem.prototype 186 __proto__: WebInspector.ContextMenuItem.prototype
184 } 187 }
185 188
186 /** 189 /**
187 * @constructor 190 * @constructor
188 * @extends {WebInspector.ContextSubMenuItem} 191 * @extends {WebInspector.ContextSubMenuItem}
192 * @param {?Event} event
189 */ 193 */
190 WebInspector.ContextMenu = function(event) { 194 WebInspector.ContextMenu = function(event)
195 {
191 WebInspector.ContextSubMenuItem.call(this, this, ""); 196 WebInspector.ContextSubMenuItem.call(this, this, "");
192 this._event = event; 197 this._event = /** @type {!Event} */ (event);
193 this._handlers = {}; 198 this._handlers = {};
194 this._id = 0; 199 this._id = 0;
195 } 200 }
196 201
197 /** 202 /**
198 * @param {boolean} useSoftMenu 203 * @param {boolean} useSoftMenu
199 */ 204 */
200 WebInspector.ContextMenu.setUseSoftMenu = function(useSoftMenu) 205 WebInspector.ContextMenu.setUseSoftMenu = function(useSoftMenu)
201 { 206 {
202 WebInspector.ContextMenu._useSoftMenu = useSoftMenu; 207 WebInspector.ContextMenu._useSoftMenu = useSoftMenu;
(...skipping 17 matching lines...) Expand all
220 if (WebInspector.ContextMenu._useSoftMenu) { 225 if (WebInspector.ContextMenu._useSoftMenu) {
221 var softMenu = new WebInspector.SoftContextMenu(menuObject); 226 var softMenu = new WebInspector.SoftContextMenu(menuObject);
222 softMenu.show(this._event); 227 softMenu.show(this._event);
223 } else { 228 } else {
224 InspectorFrontendHost.showContextMenu(this._event, menuObject); 229 InspectorFrontendHost.showContextMenu(this._event, menuObject);
225 } 230 }
226 this._event.consume(true); 231 this._event.consume(true);
227 } 232 }
228 }, 233 },
229 234
235 /**
236 * @param {number} id
237 * @param {function(?)} handler
238 */
230 _setHandler: function(id, handler) 239 _setHandler: function(id, handler)
231 { 240 {
232 if (handler) 241 if (handler)
233 this._handlers[id] = handler; 242 this._handlers[id] = handler;
234 }, 243 },
235 244
236 _buildDescriptor: function() 245 _buildDescriptor: function()
237 { 246 {
238 var result = []; 247 var result = [];
239 for (var i = 0; i < this._items.length; ++i) 248 for (var i = 0; i < this._items.length; ++i)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 280 }
272 281
273 /** 282 /**
274 * @interface 283 * @interface
275 */ 284 */
276 WebInspector.ContextMenu.Provider = function() { 285 WebInspector.ContextMenu.Provider = function() {
277 } 286 }
278 287
279 WebInspector.ContextMenu.Provider.prototype = { 288 WebInspector.ContextMenu.Provider.prototype = {
280 /** 289 /**
290 * @param {!Event} event
281 * @param {!WebInspector.ContextMenu} contextMenu 291 * @param {!WebInspector.ContextMenu} contextMenu
282 * @param {!Object} target 292 * @param {!Object} target
283 */ 293 */
284 appendApplicableItems: function(event, contextMenu, target) { } 294 appendApplicableItems: function(event, contextMenu, target) { }
285 } 295 }
286 296
287 WebInspector.contextMenuItemSelected = function(id) 297 WebInspector.contextMenuItemSelected = function(id)
288 { 298 {
289 if (WebInspector._contextMenu) 299 if (WebInspector._contextMenu)
290 WebInspector._contextMenu._itemSelected(id); 300 WebInspector._contextMenu._itemSelected(id);
291 } 301 }
292 302
293 WebInspector.contextMenuCleared = function() 303 WebInspector.contextMenuCleared = function()
294 { 304 {
295 // FIXME: Unfortunately, contextMenuCleared is invoked between show and item selected 305 // FIXME: Unfortunately, contextMenuCleared is invoked between show and item selected
296 // so we can't delete last menu object from WebInspector. Fix the contract. 306 // so we can't delete last menu object from WebInspector. Fix the contract.
297 } 307 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/ui/Checkbox.js ('k') | Source/devtools/front_end/ui/SoftContextMenu.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698