| 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('set_icon_natives').SetIconCommon; |
| 6 var sendRequest = require('sendRequest').sendRequest; | 6 var sendRequest = require('sendRequest').sendRequest; |
| 7 | 7 |
| 8 function loadImagePath(path, iconSize, actionType, callback) { | 8 function loadImagePath(path, iconSize, actionType, callback) { |
| 9 var img = new Image(); | 9 var img = new Image(); |
| 10 img.onerror = function() { | 10 img.onerror = function() { |
| 11 console.error('Could not load ' + actionType + ' icon \'' + | 11 console.error('Could not load ' + actionType + ' icon \'' + |
| 12 path + '\'.'); | 12 path + '\'.'); |
| 13 }; | 13 }; |
| 14 img.onload = function() { | 14 img.onload = function() { |
| 15 var canvas = document.createElement('canvas'); | 15 var canvas = document.createElement('canvas'); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 throw new Error('The path property should contain either string or ' + | 122 throw new Error('The path property should contain either string or ' + |
| 123 'dictionary of strings.'); | 123 'dictionary of strings.'); |
| 124 } | 124 } |
| 125 } else { | 125 } else { |
| 126 throw new Error( | 126 throw new Error( |
| 127 'Either the path or imageData property must be specified.'); | 127 'Either the path or imageData property must be specified.'); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 exports.setIcon = setIcon; | 131 exports.setIcon = setIcon; |
| OLD | NEW |