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

Unified Diff: Source/devtools/front_end/ImageView.js

Issue 88103002: [DevTools] Resources: add "copy image as data url" menu item. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reupload Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ImageView.js
diff --git a/Source/devtools/front_end/ImageView.js b/Source/devtools/front_end/ImageView.js
index f5cb0dc1efe75905d4de42e08ac9a8ca354b72bb..bf79de76486fe8ccc283d1ad1bf3522e6652a04d 100644
--- a/Source/devtools/front_end/ImageView.js
+++ b/Source/devtools/front_end/ImageView.js
@@ -110,6 +110,7 @@ WebInspector.ImageView.prototype = {
this._container.appendChild(infoListElement);
}
imagePreviewElement.addEventListener("load", onImageLoad.bind(this), false);
+ this._imagePreviewElement = imagePreviewElement;
},
_base64ToSize: function(content)
@@ -128,10 +129,17 @@ WebInspector.ImageView.prototype = {
{
var contextMenu = new WebInspector.ContextMenu(event);
contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy image URL" : "Copy Image URL"), this._copyImageURL.bind(this));
+ if (this._imagePreviewElement.src)
+ contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy image as Data URL" : "Copy Image As Data URL"), this._copyImageAsDataURL.bind(this));
contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Open image in new tab" : "Open Image in New Tab"), this._openInNewTab.bind(this));
contextMenu.show();
},
+ _copyImageAsDataURL: function()
+ {
+ InspectorFrontendHost.copyText(this._imagePreviewElement.src);
+ },
+
_copyImageURL: function()
{
InspectorFrontendHost.copyText(this.resource.url);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698