| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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; |
| OLD | NEW |