Chromium Code Reviews| 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 // Custom binding for the Media Gallery API. | 5 // Custom binding for the Media Gallery API. |
| 6 | 6 |
| 7 var binding = require('binding').Binding.create('mediaGalleries'); | 7 var binding = require('binding').Binding.create('mediaGalleries'); |
| 8 var blobNatives = requireNative('blob_natives'); | 8 var blobNatives = requireNative('blob_natives'); |
| 9 var mediaGalleriesNatives = requireNative('mediaGalleries'); | 9 var mediaGalleriesNatives = requireNative('mediaGalleries'); |
| 10 | 10 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 'isMediaDevice': false, | 96 'isMediaDevice': false, |
| 97 'isAvailable': false, | 97 'isAvailable': false, |
| 98 }; | 98 }; |
| 99 }); | 99 }); |
| 100 | 100 |
| 101 apiFunctions.setUpdateArgumentsPostValidate('getMetadata', | 101 apiFunctions.setUpdateArgumentsPostValidate('getMetadata', |
| 102 function(mediaFile, options, callback) { | 102 function(mediaFile, options, callback) { |
| 103 var blobUuid = blobNatives.GetBlobUuid(mediaFile) | 103 var blobUuid = blobNatives.GetBlobUuid(mediaFile) |
| 104 return [blobUuid, options, callback]; | 104 return [blobUuid, options, callback]; |
| 105 }); | 105 }); |
| 106 | |
| 107 apiFunctions.setCustomCallback('getMetadata', | |
| 108 function(name, request, response) { | |
| 109 if (response.attachedImages) { | |
| 110 for (var i = 0; i < response.attachedImages.length; i++) { | |
| 111 var image = response.attachedImages[i]; | |
| 112 var blob = blobNatives.TakeBrowserProcessBlob( | |
| 113 image.blobUUID, image.type, image.size); | |
|
michaeln
2014/05/01 21:27:35
nit: indent by 2 more
tommycli
2014/05/07 21:39:04
Done.
| |
| 114 response.metadata.attachedImages.push(blob); | |
| 115 } | |
| 116 } | |
| 117 | |
| 118 if (request.callback) | |
| 119 request.callback(response.metadata); | |
| 120 request.callback = null; | |
| 121 }); | |
| 106 }); | 122 }); |
| 107 | 123 |
| 108 exports.binding = binding.generate(); | 124 exports.binding = binding.generate(); |
| OLD | NEW |