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

Side by Side Diff: extensions/renderer/resources/set_icon.js

Issue 2960523002: [Extensions Bindings] Don't load sendRequest module with native bindings (Closed)
Patch Set: remove debug log Created 3 years, 5 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 | « extensions/renderer/dispatcher.cc ('k') | 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var SetIconCommon = requireNative('setIcon').SetIconCommon; 5 var SetIconCommon = requireNative('setIcon').SetIconCommon;
6 var sendRequest = require('sendRequest').sendRequest;
7 6
8 function loadImagePath(path, callback) { 7 function loadImagePath(path, callback) {
9 var img = new Image(); 8 var img = new Image();
10 img.onerror = function() { 9 img.onerror = function() {
11 console.error('Could not load action icon \'' + path + '\'.'); 10 console.error('Could not load action icon \'' + path + '\'.');
12 }; 11 };
13 img.onload = function() { 12 img.onload = function() {
14 var canvas = document.createElement('canvas'); 13 var canvas = document.createElement('canvas');
15 canvas.width = img.width; 14 canvas.width = img.width;
16 canvas.height = img.height; 15 canvas.height = img.height;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 delete details.path; 102 delete details.path;
104 callback(SetIconCommon(details)); 103 callback(SetIconCommon(details));
105 }); 104 });
106 } 105 }
107 return; 106 return;
108 } 107 }
109 throw new Error('Either the path or imageData property must be specified.'); 108 throw new Error('Either the path or imageData property must be specified.');
110 } 109 }
111 110
112 exports.$set('setIcon', setIcon); 111 exports.$set('setIcon', setIcon);
OLDNEW
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698