| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 }, | 102 }, |
| 103 | 103 |
| 104 _contextMenu: function(event) | 104 _contextMenu: function(event) |
| 105 { | 105 { |
| 106 var contextMenu = new WebInspector.ContextMenu(event); | 106 var contextMenu = new WebInspector.ContextMenu(event); |
| 107 if (!this._parsedURL.isDataURL()) | 107 if (!this._parsedURL.isDataURL()) |
| 108 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^image
URL"), this._copyImageURL.bind(this)); | 108 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^image
URL"), this._copyImageURL.bind(this)); |
| 109 if (this._imagePreviewElement.src) | 109 if (this._imagePreviewElement.src) |
| 110 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^image
as Data URI"), this._copyImageAsDataURL.bind(this)); | 110 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^image
as Data URI"), this._copyImageAsDataURL.bind(this)); |
| 111 contextMenu.appendItem(WebInspector.UIString.capitalize("Open ^image in
^new ^tab"), this._openInNewTab.bind(this)); | 111 contextMenu.appendItem(WebInspector.UIString.capitalize("Open ^image in
^new ^tab"), this._openInNewTab.bind(this)); |
| 112 contextMenu.appendItem(WebInspector.UIString.capitalize("Save\u2026"), t
his._saveImage.bind(this)); |
| 112 contextMenu.show(); | 113 contextMenu.show(); |
| 113 }, | 114 }, |
| 114 | 115 |
| 115 _copyImageAsDataURL: function() | 116 _copyImageAsDataURL: function() |
| 116 { | 117 { |
| 117 InspectorFrontendHost.copyText(this._imagePreviewElement.src); | 118 InspectorFrontendHost.copyText(this._imagePreviewElement.src); |
| 118 }, | 119 }, |
| 119 | 120 |
| 120 _copyImageURL: function() | 121 _copyImageURL: function() |
| 121 { | 122 { |
| 122 InspectorFrontendHost.copyText(this._url); | 123 InspectorFrontendHost.copyText(this._url); |
| 123 }, | 124 }, |
| 124 | 125 |
| 126 _saveImage: function() |
| 127 { |
| 128 var link = createElement("a"); |
| 129 link.download = this._parsedURL.displayName; |
| 130 link.href = this._url; |
| 131 link.click(); |
| 132 }, |
| 133 |
| 125 _openInNewTab: function() | 134 _openInNewTab: function() |
| 126 { | 135 { |
| 127 InspectorFrontendHost.openInNewTab(this._url); | 136 InspectorFrontendHost.openInNewTab(this._url); |
| 128 }, | 137 }, |
| 129 | 138 |
| 130 __proto__: WebInspector.VBoxWithToolbarItems.prototype | 139 __proto__: WebInspector.VBoxWithToolbarItems.prototype |
| 131 } | 140 } |
| OLD | NEW |