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

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

Issue 11414152: Drive: Rename GData to Drive in extension JS API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: review fix (comment #7) Created 8 years 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
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 bindings for the fileBrowserPrivate API. 5 // Custom bindings for the fileBrowserPrivate API.
6 6
7 var fileBrowserPrivateNatives = requireNative('file_browser_private'); 7 var fileBrowserPrivateNatives = requireNative('file_browser_private');
8 var GetLocalFileSystem = fileBrowserPrivateNatives.GetLocalFileSystem; 8 var GetLocalFileSystem = fileBrowserPrivateNatives.GetLocalFileSystem;
9 9
10 var fileBrowserNatives = requireNative('file_browser_handler'); 10 var fileBrowserNatives = requireNative('file_browser_handler');
11 var GetExternalFileEntry = fileBrowserNatives.GetExternalFileEntry; 11 var GetExternalFileEntry = fileBrowserNatives.GetExternalFileEntry;
12 12
13 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); 13 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
14 14
15 chromeHidden.registerCustomHook('fileBrowserPrivate', function(bindingsAPI) { 15 chromeHidden.registerCustomHook('fileBrowserPrivate', function(bindingsAPI) {
16 var apiFunctions = bindingsAPI.apiFunctions; 16 var apiFunctions = bindingsAPI.apiFunctions;
17 17
18 apiFunctions.setCustomCallback('requestLocalFileSystem', 18 apiFunctions.setCustomCallback('requestLocalFileSystem',
19 function(name, request, response) { 19 function(name, request, response) {
20 var fs = null; 20 var fs = null;
21 if (response && !response.error) 21 if (response && !response.error)
22 fs = GetLocalFileSystem(response.name, response.path); 22 fs = GetLocalFileSystem(response.name, response.path);
23 if (request.callback) 23 if (request.callback)
24 request.callback(fs); 24 request.callback(fs);
25 request.callback = null; 25 request.callback = null;
26 }); 26 });
27 27
28 apiFunctions.setCustomCallback('searchGData', 28 apiFunctions.setCustomCallback('searchDrive',
29 function(name, request, response) { 29 function(name, request, response) {
30 if (response && !response.error && response.entries) { 30 if (response && !response.error && response.entries) {
31 for (var i = 0; i < response.entries.length; i++) 31 for (var i = 0; i < response.entries.length; i++)
32 response.entries[i] = GetExternalFileEntry(response.entries[i]); 32 response.entries[i] = GetExternalFileEntry(response.entries[i]);
33 } 33 }
34 34
35 // So |request.callback| doesn't break if response is not defined. 35 // So |request.callback| doesn't break if response is not defined.
36 if (!response) 36 if (!response)
37 response = {}; 37 response = {};
38 38
39 if (request.callback) 39 if (request.callback)
40 request.callback(response.entries, response.nextFeed); 40 request.callback(response.entries, response.nextFeed);
41 request.callback = null; 41 request.callback = null;
42 }); 42 });
43 }); 43 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698