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

Unified 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: transition to AttachedPicture struct and eliminate a copy Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/resources/extensions/media_galleries_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/media_galleries_custom_bindings.js b/chrome/renderer/resources/extensions/media_galleries_custom_bindings.js
index 9b51fcc271685b3f9afbc0011f1aa4decbeb0cdd..6e2272c3a6f469b5a8a7cbaa015b526ab59140d3 100644
--- a/chrome/renderer/resources/extensions/media_galleries_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/media_galleries_custom_bindings.js
@@ -103,6 +103,22 @@ binding.registerCustomHook(function(bindingsAPI, extensionId) {
var blobUuid = blobNatives.GetBlobUuid(mediaFile)
return [blobUuid, options, callback];
});
+
+ apiFunctions.setCustomCallback('getMetadata',
+ function(name, request, response) {
+ if (response.attachedPictures) {
+ for (var i = 0; i < response.attachedPictures.length; i++) {
+ var dataView = new DataView(response.attachedPictures[i].data);
+ var blob =
+ new Blob([dataView], {type : response.attachedPictures[i].type});
+ response.metadata.attachedPictures.push(blob);
+ }
+ }
+
+ if (request.callback)
+ request.callback(response.metadata);
+ request.callback = null;
+ });
});
exports.binding = binding.generate();

Powered by Google App Engine
This is Rietveld 408576698