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