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

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

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more progress Created 7 years, 11 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 bindings for the fileBrowserPrivate API. 5 // Custom bindings for the fileBrowserPrivate API.
6 6
7 var Bindings = require('schema_binding_generator').Bindings;
8 var bindings = new Bindings('fileBrowserPrivate');
9
7 var fileBrowserPrivateNatives = requireNative('file_browser_private'); 10 var fileBrowserPrivateNatives = requireNative('file_browser_private');
8 var GetLocalFileSystem = fileBrowserPrivateNatives.GetLocalFileSystem; 11 var GetLocalFileSystem = fileBrowserPrivateNatives.GetLocalFileSystem;
9 12
10 var fileBrowserNatives = requireNative('file_browser_handler'); 13 var fileBrowserNatives = requireNative('file_browser_handler');
11 var GetExternalFileEntry = fileBrowserNatives.GetExternalFileEntry; 14 var GetExternalFileEntry = fileBrowserNatives.GetExternalFileEntry;
12 15
13 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); 16 bindings.registerCustomHook(function(bindingsAPI) {
14
15 chromeHidden.registerCustomHook('fileBrowserPrivate', function(bindingsAPI) {
16 var apiFunctions = bindingsAPI.apiFunctions; 17 var apiFunctions = bindingsAPI.apiFunctions;
17 18
18 apiFunctions.setCustomCallback('requestLocalFileSystem', 19 apiFunctions.setCustomCallback('requestLocalFileSystem',
19 function(name, request, response) { 20 function(name, request, response) {
20 var fs = null; 21 var fs = null;
21 if (response && !response.error) 22 if (response && !response.error)
22 fs = GetLocalFileSystem(response.name, response.path); 23 fs = GetLocalFileSystem(response.name, response.path);
23 if (request.callback) 24 if (request.callback)
24 request.callback(fs); 25 request.callback(fs);
25 request.callback = null; 26 request.callback = null;
(...skipping 10 matching lines...) Expand all
36 37
37 // So |request.callback| doesn't break if response is not defined. 38 // So |request.callback| doesn't break if response is not defined.
38 if (!response) 39 if (!response)
39 response = {}; 40 response = {};
40 41
41 if (request.callback) 42 if (request.callback)
42 request.callback(response.results, response.nextFeed); 43 request.callback(response.results, response.nextFeed);
43 request.callback = null; 44 request.callback = null;
44 }); 45 });
45 }); 46 });
47
48 exports.bindings = bindings.generate();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698