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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 var selectedFileSystemIndex = response['selectedFileSystemIndex']; | 59 var selectedFileSystemIndex = response['selectedFileSystemIndex']; |
60 if (selectedFileSystemIndex >= 0) { | 60 if (selectedFileSystemIndex >= 0) { |
61 selectedFileSystemName = fileSystems[selectedFileSystemIndex].name; | 61 selectedFileSystemName = fileSystems[selectedFileSystemIndex].name; |
62 } | 62 } |
63 } | 63 } |
64 if (request.callback) | 64 if (request.callback) |
65 request.callback(fileSystems, selectedFileSystemName); | 65 request.callback(fileSystems, selectedFileSystemName); |
66 request.callback = null; | 66 request.callback = null; |
67 }); | 67 }); |
68 | 68 |
| 69 apiFunctions.setUpdateArgumentsPostValidate('forgetMediaFileSystem', |
| 70 function(filesystem, callback) { |
| 71 var metadata = {}; |
| 72 if (filesystem && filesystem.name && |
| 73 mediaGalleriesMetadata[filesystem.name]) { |
| 74 metadata = mediaGalleriesMetadata[filesystem.name]; |
| 75 } |
| 76 return [metadata, callback]; |
| 77 }); |
| 78 |
69 apiFunctions.setHandleRequest('getMediaFileSystemMetadata', | 79 apiFunctions.setHandleRequest('getMediaFileSystemMetadata', |
70 function(filesystem) { | 80 function(filesystem) { |
71 if (filesystem && filesystem.name && | 81 if (filesystem && filesystem.name && |
72 mediaGalleriesMetadata[filesystem.name]) { | 82 mediaGalleriesMetadata[filesystem.name]) { |
73 return mediaGalleriesMetadata[filesystem.name]; | 83 return mediaGalleriesMetadata[filesystem.name]; |
74 } | 84 } |
75 return {}; | 85 return {}; |
76 }); | 86 }); |
77 | 87 |
78 apiFunctions.setUpdateArgumentsPostValidate('getMetadata', | 88 apiFunctions.setUpdateArgumentsPostValidate('getMetadata', |
79 function(mediaFile, options, callback) { | 89 function(mediaFile, options, callback) { |
80 var blobUuid = blobNatives.GetBlobUuid(mediaFile) | 90 var blobUuid = blobNatives.GetBlobUuid(mediaFile) |
81 return [blobUuid, options, callback]; | 91 return [blobUuid, options, callback]; |
82 }); | 92 }); |
83 }); | 93 }); |
84 | 94 |
85 exports.binding = binding.generate(); | 95 exports.binding = binding.generate(); |
OLD | NEW |