| OLD | NEW |
| 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 Loading... |
| 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); |
| OLD | NEW |