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

Unified Diff: chrome/renderer/resources/extension_process_bindings.js

Issue 337026: Don't scale up small browser action icons.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 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: chrome/renderer/resources/extension_process_bindings.js
===================================================================
--- chrome/renderer/resources/extension_process_bindings.js (revision 30046)
+++ chrome/renderer/resources/extension_process_bindings.js (working copy)
@@ -364,20 +364,17 @@
}
sendCustomRequest(SetExtensionActionIcon, name, [details], parameters);
} else if ("path" in details) {
- if (!canvas) {
- var canvas = document.createElement("canvas");
- canvas.width = 19;
- canvas.height = 19;
- }
-
- var canvas_context = canvas.getContext('2d');
var img = new Image();
- var self = this;
img.onerror = function() {
console.error("Could not load browser action icon '" + details.path +
"'.");
}
img.onload = function() {
+ var canvas = document.createElement("canvas");
+ canvas.width = img.width > 19 ? 19 : img.width;
+ canvas.height = img.height > 19 ? 19 : img.height;
+
+ var canvas_context = canvas.getContext('2d');
canvas_context.clearRect(0, 0, canvas.width, canvas.height);
canvas_context.drawImage(img, 0, 0, canvas.width, canvas.height);
delete details.path;
« 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