| OLD | NEW |
| 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 fileSystem API. | 5 // Custom binding for the fileSystem API. |
| 6 | 6 |
| 7 var binding = require('binding').Binding.create('fileSystem'); | 7 var binding = require('binding').Binding.create('fileSystem'); |
| 8 | 8 |
| 9 var fileSystemNatives = requireNative('file_system_natives'); | 9 var fileSystemNatives = requireNative('file_system_natives'); |
| 10 var GetIsolatedFileSystem = fileSystemNatives.GetIsolatedFileSystem; | 10 var GetIsolatedFileSystem = fileSystemNatives.GetIsolatedFileSystem; |
| 11 var lastError = require('lastError'); | 11 var lastError = require('lastError'); |
| 12 var sendRequest = require('sendRequest'); | 12 var sendRequest = require('sendRequest'); |
| 13 var GetModuleSystem = requireNative('v8_context').GetModuleSystem; | 13 var GetModuleSystem = requireNative('v8_context').GetModuleSystem; |
| 14 // TODO(sammc): Don't require extension. See http://crbug.com/235689. | 14 // TODO(sammc): Don't require extension. See http://crbug.com/235689. |
| 15 var GetExtensionViews = requireNative('runtime').GetExtensionViews; | 15 var GetExtensionViews = requireNative('runtime_natives').GetExtensionViews; |
| 16 | 16 |
| 17 // Fallback to using the current window if no background page is running. | 17 // Fallback to using the current window if no background page is running. |
| 18 var backgroundPage = GetExtensionViews(-1, 'BACKGROUND')[0] || window; | 18 var backgroundPage = GetExtensionViews(-1, 'BACKGROUND')[0] || window; |
| 19 var backgroundPageModuleSystem = GetModuleSystem(backgroundPage); | 19 var backgroundPageModuleSystem = GetModuleSystem(backgroundPage); |
| 20 | 20 |
| 21 // All windows use the bindFileEntryCallback from the background page so their | 21 // All windows use the bindFileEntryCallback from the background page so their |
| 22 // FileEntry objects have the background page's context as their own. This | 22 // FileEntry objects have the background page's context as their own. This |
| 23 // allows them to be used from other windows (including the background page) | 23 // allows them to be used from other windows (including the background page) |
| 24 // after the original window is closed. | 24 // after the original window is closed. |
| 25 if (window == backgroundPage) { | 25 if (window == backgroundPage) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 fileSystem.chooseFile = function() { | 192 fileSystem.chooseFile = function() { |
| 193 console.log("chrome.fileSystem.chooseFile is deprecated"); | 193 console.log("chrome.fileSystem.chooseFile is deprecated"); |
| 194 console.log("Please use chrome.fileSystem.chooseEntry instead"); | 194 console.log("Please use chrome.fileSystem.chooseEntry instead"); |
| 195 $Function.apply(fileSystem.chooseEntry, this, arguments); | 195 $Function.apply(fileSystem.chooseEntry, this, arguments); |
| 196 }; | 196 }; |
| 197 }); | 197 }); |
| 198 | 198 |
| 199 exports.bindFileEntryCallback = bindFileEntryCallback; | 199 exports.bindFileEntryCallback = bindFileEntryCallback; |
| 200 exports.binding = binding.generate(); | 200 exports.binding = binding.generate(); |
| OLD | NEW |