OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 function attachListeners() { |
| 6 document.getElementById('choosedir').addEventListener('click', function(e) { |
| 7 chrome.fileSystem.chooseEntry({type: 'openDirectory'}, function(entry) { |
| 8 if (!entry) { |
| 9 // The user cancelled the dialog. |
| 10 return; |
| 11 } |
| 12 |
| 13 // Send the filesystem and the directory path to the NaCl module. |
| 14 common.naclModule.postMessage({ |
| 15 filesystem: entry.filesystem, |
| 16 fullPath: entry.fullPath |
| 17 }); |
| 18 }); |
| 19 }, false); |
| 20 } |
| 21 |
| 22 // Called by the common.js module. |
| 23 function moduleDidLoad() { |
| 24 // The module is not hidden by default so we can easily see if the plugin |
| 25 // failed to load. |
| 26 common.hideModule(); |
| 27 |
| 28 // Make sure this example is running as an App. If not, display a warning. |
| 29 if (!chrome.fileSystem) { |
| 30 common.updateStatus('Error: must be run as an App.'); |
| 31 return; |
| 32 } |
| 33 } |
| 34 |
| 35 // Called by the common.js module. |
| 36 function handleMessage(message_event) { |
| 37 common.logMessage(message_event.data); |
| 38 } |
OLD | NEW |