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; | |
17 | |
18 var rootPaths = ['Downloads', 'removable', 'archive', 'tmp']; | 16 var rootPaths = ['Downloads', 'removable', 'archive', 'tmp']; |
19 | 17 |
20 if (document.location.search) { | |
21 var json = decodeURIComponent(document.location.search.substr(1)); | |
22 var params = JSON.parse(json); | |
23 console.log('params: ' + JSON.stringify(params)); | |
24 } | |
25 | |
26 function onEntriesFound(filesystem, entries) { | 18 function onEntriesFound(filesystem, entries) { |
27 FileManager.initStrings(function () { | 19 FileManager.initStrings(function () { |
28 fileManager = new FileManager(document.body, filesystem, entries, params); | 20 fileManager = new FileManager(document.body, filesystem, entries); |
| 21 // We're ready to run. Tests can monitor for this state with |
| 22 // ExtensionTestMessageListener listener("ready"); |
| 23 // ASSERT_TRUE(listener.WaitUntilSatisfied()); |
| 24 chrome.test.sendMessage('ready'); |
29 }); | 25 }); |
30 } | 26 } |
31 | 27 |
32 function onFileSystemFound(filesystem) { | 28 function onFileSystemFound(filesystem) { |
33 console.log('Found filesystem: ' + filesystem.name, filesystem); | 29 console.log('Found filesystem: ' + filesystem.name, filesystem); |
34 | 30 |
35 var entries = []; | 31 var entries = []; |
36 | 32 |
37 function onPathError(path, err) { | 33 function onPathError(path, err) { |
38 console.error('Error locating root path: ' + path + ': ' + err); | 34 console.error('Error locating root path: ' + path + ': ' + err); |
(...skipping 15 matching lines...) Expand all Loading... |
54 } else { | 50 } else { |
55 util.forEachDirEntry(filesystem.root, onEntryFound); | 51 util.forEachDirEntry(filesystem.root, onEntryFound); |
56 } | 52 } |
57 }; | 53 }; |
58 | 54 |
59 util.installFileErrorToString(); | 55 util.installFileErrorToString(); |
60 | 56 |
61 console.log('Requesting filesystem.'); | 57 console.log('Requesting filesystem.'); |
62 chrome.fileBrowserPrivate.requestLocalFileSystem(onFileSystemFound); | 58 chrome.fileBrowserPrivate.requestLocalFileSystem(onFileSystemFound); |
63 } | 59 } |
OLD | NEW |