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

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

Issue 1978323002: DevTools: reveal object path in console tooltip (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove uiutils and rebase Created 4 years, 7 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
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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 343
344 WebInspector.ContextMenu.prototype = { 344 WebInspector.ContextMenu.prototype = {
345 /** 345 /**
346 * @return {number} 346 * @return {number}
347 */ 347 */
348 _nextId: function() 348 _nextId: function()
349 { 349 {
350 return this._id++; 350 return this._id++;
351 }, 351 },
352 352
353 show: function() 353 /**
354 * @param {function()=} populatedCallback
355 */
356 show: function(populatedCallback)
dgozman 2016/05/18 23:05:31 Let's instead have ContextMenu.beforeShow(callback
354 { 357 {
355 Promise.all(this._pendingPromises).then(populateAndShow.bind(this)); 358 Promise.all(this._pendingPromises)
359 .then(populateAndShow.bind(this))
360 .then(populatedCallback)
361 .then(this._innerShow.bind(this));
356 WebInspector.ContextMenu._pendingMenu = this; 362 WebInspector.ContextMenu._pendingMenu = this;
357 363
358 /** 364 /**
359 * @param {!Array.<!Array.<!WebInspector.ContextMenu.Provider>>} appendC allResults 365 * @param {!Array.<!Array.<!WebInspector.ContextMenu.Provider>>} appendC allResults
360 * @this {WebInspector.ContextMenu} 366 * @this {WebInspector.ContextMenu}
361 */ 367 */
362 function populateAndShow(appendCallResults) 368 function populateAndShow(appendCallResults)
363 { 369 {
364 if (WebInspector.ContextMenu._pendingMenu !== this) 370 if (WebInspector.ContextMenu._pendingMenu !== this)
365 return; 371 return;
366 delete WebInspector.ContextMenu._pendingMenu; 372 delete WebInspector.ContextMenu._pendingMenu;
367 373
368 for (var i = 0; i < appendCallResults.length; ++i) { 374 for (var i = 0; i < appendCallResults.length; ++i) {
369 var providers = appendCallResults[i]; 375 var providers = appendCallResults[i];
370 var target = this._pendingTargets[i]; 376 var target = this._pendingTargets[i];
371 377
372 for (var j = 0; j < providers.length; ++j) { 378 for (var j = 0; j < providers.length; ++j) {
373 var provider = /** @type {!WebInspector.ContextMenu.Provider } */ (providers[j]); 379 var provider = /** @type {!WebInspector.ContextMenu.Provider } */ (providers[j]);
374 this.appendSeparator(); 380 this.appendSeparator();
375 provider.appendApplicableItems(this._event, this, target); 381 provider.appendApplicableItems(this._event, this, target);
376 this.appendSeparator(); 382 this.appendSeparator();
377 } 383 }
378 } 384 }
379 385
380 this._pendingPromises = []; 386 this._pendingPromises = [];
381 this._pendingTargets = []; 387 this._pendingTargets = [];
382 this._innerShow();
383 } 388 }
384 389
385 this._event.consume(true); 390 this._event.consume(true);
386 }, 391 },
387 392
388 discard: function() 393 discard: function()
389 { 394 {
390 if (this._softMenu) 395 if (this._softMenu)
391 this._softMenu.discard(); 396 this._softMenu.discard();
392 }, 397 },
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 } 486 }
482 487
483 WebInspector.ContextMenu.Provider.prototype = { 488 WebInspector.ContextMenu.Provider.prototype = {
484 /** 489 /**
485 * @param {!Event} event 490 * @param {!Event} event
486 * @param {!WebInspector.ContextMenu} contextMenu 491 * @param {!WebInspector.ContextMenu} contextMenu
487 * @param {!Object} target 492 * @param {!Object} target
488 */ 493 */
489 appendApplicableItems: function(event, contextMenu, target) { } 494 appendApplicableItems: function(event, contextMenu, target) { }
490 } 495 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698