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.
5 function attachListeners() {
6 document.getElementById('choosedir').addEventListener('click', function(e) {
7 chrome.fileSystem.chooseEntry({type: 'openDirectory'}, function(entry) {
9 // The user cancelled the dialog.
13 // Send the filesystem and the directory path to the NaCl module.
14 common.naclModule.postMessage({
15 filesystem: entry.filesystem,
16 fullPath: entry.fullPath
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
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.');
35 // Called by the common.js module.
36 function handleMessage(message_event) {
37 common.logMessage(message_event.data);