Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1129)

Side by Side Diff: chrome/renderer/resources/extensions/media_galleries_custom_bindings.js

Issue 250143002: Media Galleries API: Audio/Video attached pictures support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Create Blobs on browser-process, eliminating two IPC copies. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698