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

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: Address comments in patch 9 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /**
354 * @param {function()} callback
355 */
356 beforeShow: function(callback)
357 {
358 this._beforeShow = callback;
359 },
360
353 show: function() 361 show: function()
354 { 362 {
355 Promise.all(this._pendingPromises).then(populateAndShow.bind(this)); 363 Promise.all(this._pendingPromises).then(populate.bind(this)).then(this._ innerShow.bind(this));
356 WebInspector.ContextMenu._pendingMenu = this; 364 WebInspector.ContextMenu._pendingMenu = this;
357 365
358 /** 366 /**
359 * @param {!Array.<!Array.<!WebInspector.ContextMenu.Provider>>} appendC allResults 367 * @param {!Array.<!Array.<!WebInspector.ContextMenu.Provider>>} appendC allResults
360 * @this {WebInspector.ContextMenu} 368 * @this {WebInspector.ContextMenu}
361 */ 369 */
362 function populateAndShow(appendCallResults) 370 function populate(appendCallResults)
363 { 371 {
364 if (WebInspector.ContextMenu._pendingMenu !== this) 372 if (WebInspector.ContextMenu._pendingMenu !== this)
365 return; 373 return;
366 delete WebInspector.ContextMenu._pendingMenu; 374 delete WebInspector.ContextMenu._pendingMenu;
367 375
368 for (var i = 0; i < appendCallResults.length; ++i) { 376 for (var i = 0; i < appendCallResults.length; ++i) {
369 var providers = appendCallResults[i]; 377 var providers = appendCallResults[i];
370 var target = this._pendingTargets[i]; 378 var target = this._pendingTargets[i];
371 379
372 for (var j = 0; j < providers.length; ++j) { 380 for (var j = 0; j < providers.length; ++j) {
373 var provider = /** @type {!WebInspector.ContextMenu.Provider } */ (providers[j]); 381 var provider = /** @type {!WebInspector.ContextMenu.Provider } */ (providers[j]);
374 this.appendSeparator(); 382 this.appendSeparator();
375 provider.appendApplicableItems(this._event, this, target); 383 provider.appendApplicableItems(this._event, this, target);
376 this.appendSeparator(); 384 this.appendSeparator();
377 } 385 }
378 } 386 }
379 387
380 this._pendingPromises = []; 388 this._pendingPromises = [];
381 this._pendingTargets = []; 389 this._pendingTargets = [];
382 this._innerShow();
383 } 390 }
384 391
385 this._event.consume(true); 392 this._event.consume(true);
386 }, 393 },
387 394
388 discard: function() 395 discard: function()
389 { 396 {
390 if (this._softMenu) 397 if (this._softMenu)
391 this._softMenu.discard(); 398 this._softMenu.discard();
392 }, 399 },
393 400
394 _innerShow: function() 401 _innerShow: function()
395 { 402 {
403 if (typeof this._beforeShow === "function") {
404 this._beforeShow();
405 delete this._beforeShow;
406 }
407
396 var menuObject = this._buildDescriptors(); 408 var menuObject = this._buildDescriptors();
397 409
398 WebInspector._contextMenu = this; 410 WebInspector._contextMenu = this;
399 if (this._useSoftMenu || WebInspector.ContextMenu._useSoftMenu || Inspec torFrontendHost.isHostedMode()) { 411 if (this._useSoftMenu || WebInspector.ContextMenu._useSoftMenu || Inspec torFrontendHost.isHostedMode()) {
400 this._softMenu = new WebInspector.SoftContextMenu(menuObject, this._ itemSelected.bind(this)); 412 this._softMenu = new WebInspector.SoftContextMenu(menuObject, this._ itemSelected.bind(this));
401 this._softMenu.show(this._event.target.ownerDocument, this._x, this. _y); 413 this._softMenu.show(this._event.target.ownerDocument, this._x, this. _y);
402 } else { 414 } else {
403 InspectorFrontendHost.showContextMenuAtPoint(this._x, this._y, menuO bject, this._event.target.ownerDocument); 415 InspectorFrontendHost.showContextMenuAtPoint(this._x, this._y, menuO bject, this._event.target.ownerDocument);
404 416
405 /** 417 /**
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 } 493 }
482 494
483 WebInspector.ContextMenu.Provider.prototype = { 495 WebInspector.ContextMenu.Provider.prototype = {
484 /** 496 /**
485 * @param {!Event} event 497 * @param {!Event} event
486 * @param {!WebInspector.ContextMenu} contextMenu 498 * @param {!WebInspector.ContextMenu} contextMenu
487 * @param {!Object} target 499 * @param {!Object} target
488 */ 500 */
489 appendApplicableItems: function(event, contextMenu, target) { } 501 appendApplicableItems: function(event, contextMenu, target) { }
490 } 502 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698