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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js

Issue 1409693007: DevTools fixes #459685. Right Clicking on an element should show "Store as Global Variable". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Making context menu message a bit more descriptive. Created 5 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
« no previous file with comments | « AUTHORS ('k') | third_party/WebKit/Source/devtools/front_end/sources/module.json » ('j') | 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 * @override 804 * @override
805 * @param {!Event} event 805 * @param {!Event} event
806 * @param {!WebInspector.ContextMenu} contextMenu 806 * @param {!WebInspector.ContextMenu} contextMenu
807 * @param {!Object} target 807 * @param {!Object} target
808 */ 808 */
809 appendApplicableItems: function(event, contextMenu, target) 809 appendApplicableItems: function(event, contextMenu, target)
810 { 810 {
811 this._appendUISourceCodeItems(event, contextMenu, target); 811 this._appendUISourceCodeItems(event, contextMenu, target);
812 this.appendUILocationItems(contextMenu, target); 812 this.appendUILocationItems(contextMenu, target);
813 this._appendRemoteObjectItems(contextMenu, target); 813 this._appendRemoteObjectItems(contextMenu, target);
814 this._appendDOMNodeItems(contextMenu, target);
814 this._appendNetworkRequestItems(contextMenu, target); 815 this._appendNetworkRequestItems(contextMenu, target);
815 }, 816 },
816 817
817 /** 818 /**
818 * @param {!WebInspector.UISourceCode} uiSourceCode 819 * @param {!WebInspector.UISourceCode} uiSourceCode
819 */ 820 */
820 mapFileSystemToNetwork: function(uiSourceCode) 821 mapFileSystemToNetwork: function(uiSourceCode)
821 { 822 {
822 WebInspector.SelectUISourceCodeForProjectTypesDialog.show(uiSourceCode.n ame(), [WebInspector.projectTypes.Network, WebInspector.projectTypes.ContentScri pts], mapFileSystemToNetwork.bind(this)); 823 WebInspector.SelectUISourceCodeForProjectTypesDialog.show(uiSourceCode.n ame(), [WebInspector.projectTypes.Network, WebInspector.projectTypes.ContentScri pts], mapFileSystemToNetwork.bind(this));
823 824
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 if (remoteObject.type === "function") 964 if (remoteObject.type === "function")
964 contextMenu.appendItem(WebInspector.UIString.capitalize("Show ^funct ion ^definition"), this._showFunctionDefinition.bind(this, remoteObject)); 965 contextMenu.appendItem(WebInspector.UIString.capitalize("Show ^funct ion ^definition"), this._showFunctionDefinition.bind(this, remoteObject));
965 if (remoteObject.subtype === "generator") 966 if (remoteObject.subtype === "generator")
966 contextMenu.appendItem(WebInspector.UIString.capitalize("Show ^gener ator ^location"), this._showGeneratorLocation.bind(this, remoteObject)); 967 contextMenu.appendItem(WebInspector.UIString.capitalize("Show ^gener ator ^location"), this._showGeneratorLocation.bind(this, remoteObject));
967 }, 968 },
968 969
969 /** 970 /**
970 * @param {!WebInspector.ContextMenu} contextMenu 971 * @param {!WebInspector.ContextMenu} contextMenu
971 * @param {!Object} target 972 * @param {!Object} target
972 */ 973 */
974 _appendDOMNodeItems: function (contextMenu, target) {
975 if (!(target instanceof WebInspector.DOMNode))
976 return;
977 var domNode = /** @type {!WebInspector.DOMNode} */ (target);
978
979 function resolveNodeAndCall(domNode, callback)
980 {
981 function resolvedNode(remoteObject)
982 {
983 if(remoteObject)
984 callback(remoteObject);
985 }
986
987 domNode.resolveToObject("", resolvedNode);
988 }
989
990 contextMenu.appendItem(WebInspector.UIString.capitalize("Store ^node as ^global ^variable"), resolveNodeAndCall.bind(null, domNode, this._saveToTempVari able.bind(this)));
pfeldman 2015/10/29 23:50:34 It'd be great if we could surface all the object-r
991 },
992
993 /**
994 * @param {!WebInspector.ContextMenu} contextMenu
995 * @param {!Object} target
996 */
973 _appendNetworkRequestItems: function(contextMenu, target) 997 _appendNetworkRequestItems: function(contextMenu, target)
974 { 998 {
975 if (!(target instanceof WebInspector.NetworkRequest)) 999 if (!(target instanceof WebInspector.NetworkRequest))
976 return; 1000 return;
977 var request = /** @type {!WebInspector.NetworkRequest} */ (target); 1001 var request = /** @type {!WebInspector.NetworkRequest} */ (target);
978 var uiSourceCode = this._networkMapping.uiSourceCodeForURLForAnyTarget(r equest.url); 1002 var uiSourceCode = this._networkMapping.uiSourceCodeForURLForAnyTarget(r equest.url);
979 if (!uiSourceCode) 1003 if (!uiSourceCode)
980 return; 1004 return;
981 var openText = WebInspector.UIString.capitalize("Open in Sources ^panel" ); 1005 var openText = WebInspector.UIString.capitalize("Open in Sources ^panel" );
982 contextMenu.appendItem(openText, this.showUILocation.bind(this, uiSource Code.uiLocation(0, 0))); 1006 contextMenu.appendItem(openText, this.showUILocation.bind(this, uiSource Code.uiLocation(0, 0)));
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 WebInspector.SourcesPanelFactory.prototype = { 1451 WebInspector.SourcesPanelFactory.prototype = {
1428 /** 1452 /**
1429 * @override 1453 * @override
1430 * @return {!WebInspector.Panel} 1454 * @return {!WebInspector.Panel}
1431 */ 1455 */
1432 createPanel: function() 1456 createPanel: function()
1433 { 1457 {
1434 return WebInspector.SourcesPanel.instance(); 1458 return WebInspector.SourcesPanel.instance();
1435 } 1459 }
1436 } 1460 }
OLDNEW
« no previous file with comments | « AUTHORS ('k') | third_party/WebKit/Source/devtools/front_end/sources/module.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698