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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/source_frame/ImageView.js

Issue 2085753003: DevTools: add Save... to images in Application panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months 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 | no next file » | 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) 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
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 }
OLDNEW
« 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