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

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

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 years, 1 month 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
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 27 matching lines...) Expand all
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;
44 this._checked = checked; 44 this._checked = checked;
45 this._contextMenu = topLevelMenu; 45 this._contextMenu = topLevelMenu;
46 if (type === "item" || type === "checkbox") 46 if (type === "item" || type === "checkbox")
47 this._id = topLevelMenu._nextId(); 47 this._id = topLevelMenu._nextId();
48 } 48 };
49 49
50 WebInspector.ContextMenuItem.prototype = { 50 WebInspector.ContextMenuItem.prototype = {
51 /** 51 /**
52 * @return {number} 52 * @return {number}
53 */ 53 */
54 id: function() 54 id: function()
55 { 55 {
56 return this._id; 56 return this._id;
57 }, 57 },
58 58
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 throw new Error("Invalid item type:" + this._type); 101 throw new Error("Invalid item type:" + this._type);
102 }, 102 },
103 103
104 /** 104 /**
105 * @param {string} shortcut 105 * @param {string} shortcut
106 */ 106 */
107 setShortcut: function(shortcut) 107 setShortcut: function(shortcut)
108 { 108 {
109 this._shortcut = shortcut; 109 this._shortcut = shortcut;
110 } 110 }
111 } 111 };
112 112
113 /** 113 /**
114 * @constructor 114 * @constructor
115 * @extends {WebInspector.ContextMenuItem} 115 * @extends {WebInspector.ContextMenuItem}
116 * @param {!WebInspector.ContextMenu} topLevelMenu 116 * @param {!WebInspector.ContextMenu} topLevelMenu
117 * @param {string=} label 117 * @param {string=} label
118 * @param {boolean=} disabled 118 * @param {boolean=} disabled
119 */ 119 */
120 WebInspector.ContextSubMenuItem = function(topLevelMenu, label, disabled) 120 WebInspector.ContextSubMenuItem = function(topLevelMenu, label, disabled)
121 { 121 {
122 WebInspector.ContextMenuItem.call(this, topLevelMenu, "subMenu", label, disa bled); 122 WebInspector.ContextMenuItem.call(this, topLevelMenu, "subMenu", label, disa bled);
123 /** @type {!Array.<!WebInspector.ContextMenuItem>} */ 123 /** @type {!Array.<!WebInspector.ContextMenuItem>} */
124 this._items = []; 124 this._items = [];
125 } 125 };
126 126
127 WebInspector.ContextSubMenuItem.prototype = { 127 WebInspector.ContextSubMenuItem.prototype = {
128 /** 128 /**
129 * @param {string} label 129 * @param {string} label
130 * @param {function(?)} handler 130 * @param {function(?)} handler
131 * @param {boolean=} disabled 131 * @param {boolean=} disabled
132 * @return {!WebInspector.ContextMenuItem} 132 * @return {!WebInspector.ContextMenuItem}
133 */ 133 */
134 appendItem: function(label, handler, disabled) 134 appendItem: function(label, handler, disabled)
135 { 135 {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 for (var groupName of groupWeights) { 282 for (var groupName of groupWeights) {
283 var group = groups.get(groupName); 283 var group = groups.get(groupName);
284 if (!group) 284 if (!group)
285 continue; 285 continue;
286 group.forEach(appendExtension.bind(null, this)); 286 group.forEach(appendExtension.bind(null, this));
287 this.appendSeparator(); 287 this.appendSeparator();
288 } 288 }
289 }, 289 },
290 290
291 __proto__: WebInspector.ContextMenuItem.prototype 291 __proto__: WebInspector.ContextMenuItem.prototype
292 } 292 };
293 293
294 /** 294 /**
295 * @constructor 295 * @constructor
296 * @extends {WebInspector.ContextSubMenuItem} 296 * @extends {WebInspector.ContextSubMenuItem}
297 * @param {!Event} event 297 * @param {!Event} event
298 * @param {boolean=} useSoftMenu 298 * @param {boolean=} useSoftMenu
299 * @param {number=} x 299 * @param {number=} x
300 * @param {number=} y 300 * @param {number=} y
301 */ 301 */
302 WebInspector.ContextMenu = function(event, useSoftMenu, x, y) 302 WebInspector.ContextMenu = function(event, useSoftMenu, x, y)
303 { 303 {
304 WebInspector.ContextSubMenuItem.call(this, this, ""); 304 WebInspector.ContextSubMenuItem.call(this, this, "");
305 /** @type {!Array.<!Promise.<!Array.<!WebInspector.ContextMenu.Provider>>>} */ 305 /** @type {!Array.<!Promise.<!Array.<!WebInspector.ContextMenu.Provider>>>} */
306 this._pendingPromises = []; 306 this._pendingPromises = [];
307 /** @type {!Array<!Object>} */ 307 /** @type {!Array<!Object>} */
308 this._pendingTargets = []; 308 this._pendingTargets = [];
309 this._event = event; 309 this._event = event;
310 this._useSoftMenu = !!useSoftMenu; 310 this._useSoftMenu = !!useSoftMenu;
311 this._x = x === undefined ? event.x : x; 311 this._x = x === undefined ? event.x : x;
312 this._y = y === undefined ? event.y : y; 312 this._y = y === undefined ? event.y : y;
313 this._handlers = {}; 313 this._handlers = {};
314 this._id = 0; 314 this._id = 0;
315 /** @type {!Map<string, !WebInspector.ContextSubMenuItem>} */ 315 /** @type {!Map<string, !WebInspector.ContextSubMenuItem>} */
316 this._namedSubMenus = new Map(); 316 this._namedSubMenus = new Map();
317 } 317 };
318 318
319 WebInspector.ContextMenu.initialize = function() 319 WebInspector.ContextMenu.initialize = function()
320 { 320 {
321 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.SetUseSoftMenu, setUseSoftMenu); 321 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.SetUseSoftMenu, setUseSoftMenu);
322 /** 322 /**
323 * @param {!WebInspector.Event} event 323 * @param {!WebInspector.Event} event
324 */ 324 */
325 function setUseSoftMenu(event) 325 function setUseSoftMenu(event)
326 { 326 {
327 WebInspector.ContextMenu._useSoftMenu = /** @type {boolean} */ (event.da ta); 327 WebInspector.ContextMenu._useSoftMenu = /** @type {boolean} */ (event.da ta);
328 } 328 }
329 } 329 };
330 330
331 /** 331 /**
332 * @param {!Document} doc 332 * @param {!Document} doc
333 */ 333 */
334 WebInspector.ContextMenu.installHandler = function(doc) 334 WebInspector.ContextMenu.installHandler = function(doc)
335 { 335 {
336 doc.body.addEventListener("contextmenu", handler, false); 336 doc.body.addEventListener("contextmenu", handler, false);
337 337
338 /** 338 /**
339 * @param {!Event} event 339 * @param {!Event} event
340 */ 340 */
341 function handler(event) 341 function handler(event)
342 { 342 {
343 var contextMenu = new WebInspector.ContextMenu(event); 343 var contextMenu = new WebInspector.ContextMenu(event);
344 contextMenu.appendApplicableItems(/** @type {!Object} */ (event.deepElem entFromPoint())); 344 contextMenu.appendApplicableItems(/** @type {!Object} */ (event.deepElem entFromPoint()));
345 contextMenu.show(); 345 contextMenu.show();
346 } 346 }
347 } 347 };
348 348
349 WebInspector.ContextMenu.prototype = { 349 WebInspector.ContextMenu.prototype = {
350 /** 350 /**
351 * @return {number} 351 * @return {number}
352 */ 352 */
353 _nextId: function() 353 _nextId: function()
354 { 354 {
355 return this._id++; 355 return this._id++;
356 }, 356 },
357 357
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 /** 491 /**
492 * @param {string} name 492 * @param {string} name
493 * @return {?WebInspector.ContextSubMenuItem} 493 * @return {?WebInspector.ContextSubMenuItem}
494 */ 494 */
495 namedSubMenu: function(name) 495 namedSubMenu: function(name)
496 { 496 {
497 return this._namedSubMenus.get(name) || null; 497 return this._namedSubMenus.get(name) || null;
498 }, 498 },
499 499
500 __proto__: WebInspector.ContextSubMenuItem.prototype 500 __proto__: WebInspector.ContextSubMenuItem.prototype
501 } 501 };
502 502
503 /** 503 /**
504 * @interface 504 * @interface
505 */ 505 */
506 WebInspector.ContextMenu.Provider = function() { 506 WebInspector.ContextMenu.Provider = function() {
507 } 507 };
508 508
509 WebInspector.ContextMenu.Provider.prototype = { 509 WebInspector.ContextMenu.Provider.prototype = {
510 /** 510 /**
511 * @param {!Event} event 511 * @param {!Event} event
512 * @param {!WebInspector.ContextMenu} contextMenu 512 * @param {!WebInspector.ContextMenu} contextMenu
513 * @param {!Object} target 513 * @param {!Object} target
514 */ 514 */
515 appendApplicableItems: function(event, contextMenu, target) { } 515 appendApplicableItems: function(event, contextMenu, target) { }
516 } 516 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698