OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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('schema_generated_bindings').SetIconCommon; | 5 var SetIconCommon = requireNative('setIcon').SetIconCommon; |
6 var sendRequest = require('sendRequest').sendRequest; | 6 var sendRequest = require('sendRequest').sendRequest; |
7 | 7 |
8 function setIcon(details, name, parameters, actionType) { | 8 function setIcon(details, name, parameters, actionType) { |
9 var iconSize = 19; | 9 var iconSize = 19; |
10 if ("iconIndex" in details) { | 10 if ("iconIndex" in details) { |
11 sendRequest(name, [details], parameters); | 11 sendRequest(name, [details], parameters); |
12 } else if ("imageData" in details) { | 12 } else if ("imageData" in details) { |
13 // Verify that this at least looks like an ImageData element. | 13 // Verify that this at least looks like an ImageData element. |
14 // Unfortunately, we cannot use instanceof because the ImageData | 14 // Unfortunately, we cannot use instanceof because the ImageData |
15 // constructor is not public. | 15 // constructor is not public. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 {noStringify: true, nativeFunction: SetIconCommon}); | 53 {noStringify: true, nativeFunction: SetIconCommon}); |
54 }; | 54 }; |
55 img.src = details.path; | 55 img.src = details.path; |
56 } else { | 56 } else { |
57 throw new Error( | 57 throw new Error( |
58 "Either the path or imageData property must be specified."); | 58 "Either the path or imageData property must be specified."); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 exports.setIcon = setIcon; | 62 exports.setIcon = setIcon; |
OLD | NEW |