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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/HandlerRegistry.js

Issue 2512013002: [DevTools] Handle external link clicks and context menu separately. (Closed)
Patch Set: rebased 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js » ('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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 /** 158 /**
159 * @param {!UI.ContextMenu} contextMenu 159 * @param {!UI.ContextMenu} contextMenu
160 * @param {!Object} target 160 * @param {!Object} target
161 */ 161 */
162 _appendHrefItems(contextMenu, target) { 162 _appendHrefItems(contextMenu, target) {
163 if (!(target instanceof Node)) 163 if (!(target instanceof Node))
164 return; 164 return;
165 var targetNode = /** @type {!Node} */ (target); 165 var targetNode = /** @type {!Node} */ (target);
166 166
167 var anchorElement = targetNode.enclosingNodeOrSelfWithClass('webkit-html-res ource-link') || 167 var anchorElement = targetNode.enclosingNodeOrSelfWithClass('webkit-html-res ource-link');
168 targetNode.enclosingNodeOrSelfWithClass('webkit-html-external-link');
169 if (!anchorElement) 168 if (!anchorElement)
170 return; 169 return;
171 170
172 var uiLocation = Components.Linkifier.uiLocationByAnchor(anchorElement); 171 var uiLocation = Components.Linkifier.uiLocationByAnchor(anchorElement);
173 var resourceURL = uiLocation ? uiLocation.uiSourceCode.contentURL() : anchor Element.href; 172 var resourceURL = uiLocation ? uiLocation.uiSourceCode.contentURL() : anchor Element.href;
174 var uiSourceCode = uiLocation ? 173 var uiSourceCode = uiLocation ? uiLocation.uiSourceCode :
175 uiLocation.uiSourceCode : 174 (resourceURL ? Workspace.workspace.uiSourceC odeForURL(resourceURL) : null);
176 (resourceURL ? Workspace.workspace.uiSourceCodeForURL(resourceURL) : nul l);
177 function open() { 175 function open() {
178 Common.Revealer.reveal(uiSourceCode); 176 Common.Revealer.reveal(uiSourceCode);
179 } 177 }
180 if (uiSourceCode) 178 if (uiSourceCode)
181 contextMenu.appendItem('Open', open); 179 contextMenu.appendItem('Open', open);
182 180
183 if (!resourceURL) 181 if (!resourceURL)
184 return; 182 return;
185 // Add resource-related actions. 183 // Add resource-related actions.
186 contextMenu.appendItem(UI.openLinkExternallyLabel(), this._openInNewTab.bind (this, resourceURL)); 184 contextMenu.appendItem(UI.openLinkExternallyLabel(), this._openInNewTab.bind (this, resourceURL));
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 288
291 var handlerSelector = new Components.HandlerSelector(Components.openAnchorLo cationRegistry); 289 var handlerSelector = new Components.HandlerSelector(Components.openAnchorLo cationRegistry);
292 return UI.SettingsUI.createCustomSetting(Common.UIString('Link handling:'), handlerSelector.element); 290 return UI.SettingsUI.createCustomSetting(Common.UIString('Link handling:'), handlerSelector.element);
293 } 291 }
294 }; 292 };
295 293
296 /** 294 /**
297 * @type {!Components.HandlerRegistry} 295 * @type {!Components.HandlerRegistry}
298 */ 296 */
299 Components.openAnchorLocationRegistry; 297 Components.openAnchorLocationRegistry;
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698