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

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

Issue 9358076: Initial extension bindings for Media Gallery API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comment Created 8 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 // Custom bindings for the Media Gallery API.
6
7 var mediaGalleriesNatives = requireNative('experimental_mediaGalleries');
8 var CreateMediaGalleryObject = mediaGalleriesNatives.CreateMediaGalleryObject;
9
10 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
11
12 chromeHidden.registerCustomHook('experimental.mediaGalleries',
13 function(bindingsAPI, extensionId) {
14 var apiFunctions = bindingsAPI.apiFunctions;
15
16 apiFunctions.setCustomCallback('getMediaGalleries',
17 function(name, request, response) {
18 var result = [];
19 var resp = response ? chromeHidden.JSON.parse(response) : [];
20 for (var i = 0; i < resp.length; i++) {
21 result.push(CreateMediaGalleryObject(resp[i].id, resp[i].name,
22 resp[i].flags));
23
24 }
25 if (request.callback)
26 request.callback(result);
27 request.callback = null;
28 });
29 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698