OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 /** | 5 /** |
6 * Global fileManager reference useful for poking at from the console. | 6 * Global fileManager reference useful for poking at from the console. |
7 */ | 7 */ |
8 var fileManager; | 8 var fileManager; |
9 | 9 |
10 /** | 10 /** |
11 * Kick off the file manager dialog. | 11 * Kick off the file manager dialog. |
12 * | 12 * |
13 * Called by main.html after the dom has been parsed. | 13 * Called by main.html after the dom has been parsed. |
14 */ | 14 */ |
15 function init() { | 15 function init() { |
16 var params; | 16 var params; |
17 | 17 |
18 var rootPaths = ['Downloads', 'removable', 'archive', 'tmp']; | 18 var rootPaths = ['Downloads', 'removable', 'archive', 'tmp']; |
19 | 19 |
20 if (document.location.search) { | 20 if (document.location.search) { |
21 var json = decodeURIComponent(document.location.search.substr(1)); | 21 var json = decodeURIComponent(document.location.search.substr(1)); |
22 var params = JSON.parse(json); | 22 var params = JSON.parse(json); |
23 console.log('params: ' + JSON.stringify(params)); | 23 console.log('params: ' + JSON.stringify(params)); |
24 } | 24 } |
25 | 25 |
26 function onEntriesFound(filesystem, entries) { | 26 function onEntriesFound(filesystem, entries) { |
27 FileManager.initStrings(function () { | 27 FileManager.initStrings(function () { |
28 fileManager = new FileManager(document.body, filesystem, entries, params); | 28 fileManager = new FileManager(document.body, filesystem, entries, params); |
29 // We're ready to run. Tests can monitor for this state with | |
30 // ExtensionTestMessageListener listener("ready"); | |
31 // ASSERT_TRUE(listener.WaitUntilSatisfied()); | |
32 chrome.test.sendMessage('ready'); | |
33 }); | 29 }); |
34 } | 30 } |
35 | 31 |
36 function onFileSystemFound(filesystem) { | 32 function onFileSystemFound(filesystem) { |
37 console.log('Found filesystem: ' + filesystem.name, filesystem); | 33 console.log('Found filesystem: ' + filesystem.name, filesystem); |
38 | 34 |
39 var entries = []; | 35 var entries = []; |
40 | 36 |
41 function onPathError(path, err) { | 37 function onPathError(path, err) { |
42 console.error('Error locating root path: ' + path + ': ' + err); | 38 console.error('Error locating root path: ' + path + ': ' + err); |
(...skipping 15 matching lines...) Expand all Loading... |
58 } else { | 54 } else { |
59 util.forEachDirEntry(filesystem.root, onEntryFound); | 55 util.forEachDirEntry(filesystem.root, onEntryFound); |
60 } | 56 } |
61 }; | 57 }; |
62 | 58 |
63 util.installFileErrorToString(); | 59 util.installFileErrorToString(); |
64 | 60 |
65 console.log('Requesting filesystem.'); | 61 console.log('Requesting filesystem.'); |
66 chrome.fileBrowserPrivate.requestLocalFileSystem(onFileSystemFound); | 62 chrome.fileBrowserPrivate.requestLocalFileSystem(onFileSystemFound); |
67 } | 63 } |
OLD | NEW |