| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* globals g_mount, lib, hterm, NaClTerm, makeRootDir, initMounter */ |
| 8 /* globals mounter: true, mounterHeader: true, mounterBackground: true */ |
| 9 /* globals mounterThumb: true, MounterClient */ |
| 10 |
| 11 'use strict'; |
| 12 |
| 7 function addMount(mountPoint, entry, localPath, mounted) { | 13 function addMount(mountPoint, entry, localPath, mounted) { |
| 8 g_mount.mountPoint = mountPoint; | 14 g_mount.mountPoint = mountPoint; |
| 9 g_mount.entry = entry; | 15 g_mount.entry = entry; |
| 10 g_mount.localPath = localPath; | 16 g_mount.localPath = localPath; |
| 11 g_mount.mounted = mounted; | 17 g_mount.mounted = mounted; |
| 12 g_mount.entryId = ''; | 18 g_mount.entryId = ''; |
| 13 } | 19 } |
| 14 | 20 |
| 15 function handleChooseFolder(mount, callback) { | 21 function handleChooseFolder(mount, callback) { |
| 16 chrome.fileSystem.chooseEntry({'type': 'openDirectory'}, function(entry) { | 22 chrome.fileSystem.chooseEntry({'type': 'openDirectory'}, function(entry) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 function handleMount(mount, callback) { | 60 function handleMount(mount, callback) { |
| 55 mount.operationId = 'mount'; | 61 mount.operationId = 'mount'; |
| 56 mount.available = true; | 62 mount.available = true; |
| 57 mount.mounted = false; | 63 mount.mounted = false; |
| 58 var message = {}; | 64 var message = {}; |
| 59 message.mount = mount; | 65 message.mount = mount; |
| 60 window.term_.command.processManager.broadcastMessage(message, callback); | 66 window.term_.command.processManager.broadcastMessage(message, callback); |
| 61 } | 67 } |
| 62 | 68 |
| 63 function handleUnmount(mount, callback) { | 69 function handleUnmount(mount, callback) { |
| 64 mount.operationId = 'unmount' | 70 mount.operationId = 'unmount'; |
| 65 mount.available = false; | 71 mount.available = false; |
| 66 var message = {}; | 72 var message = {}; |
| 67 message.unmount = mount; | 73 message.unmount = mount; |
| 68 window.term_.command.processManager.broadcastMessage(message, callback); | 74 window.term_.command.processManager.broadcastMessage(message, callback); |
| 69 addMount('/mnt/local/', null, '', false); | 75 addMount('/mnt/local/', null, '', false); |
| 70 chrome.storage.local.remove('oldMounts', function() {}); | 76 chrome.storage.local.remove('oldMounts', function() {}); |
| 71 } | 77 } |
| 72 | 78 |
| 73 function initMountSystem() { | 79 function initMountSystem() { |
| 74 var terminal = document.getElementById('terminal'); | 80 var terminal = document.getElementById('terminal'); |
| 75 var mounterClient = new initMounterclient(g_mount, handleChooseFolder, | 81 var mounterClient = new MounterClient(g_mount, handleChooseFolder, |
| 76 handleMount, handleUnmount, terminal); | 82 handleMount, handleUnmount, terminal); |
| 77 addMount('/mnt/local/', null, '', false); | 83 addMount('/mnt/local/', null, '', false); |
| 78 restoreMount(g_mount, function() { | 84 restoreMount(g_mount, function() { |
| 79 initMounter(false, mounterClient, function(update) { | 85 initMounter(false, mounterClient, function(update) { |
| 80 // Mount any restore mount. | 86 // Mount any restore mount. |
| 81 if (g_mount.entryId !== '') { | 87 if (g_mount.entryId !== '') { |
| 82 handleMount(g_mount, update); | 88 handleMount(g_mount, update); |
| 83 } | 89 } |
| 84 }); | 90 }); |
| 85 }); | 91 }); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 }); | 153 }); |
| 148 }; | 154 }; |
| 149 | 155 |
| 150 // Patch hterm to intercept Ctrl-Shift-N to create new windows. | 156 // Patch hterm to intercept Ctrl-Shift-N to create new windows. |
| 151 hterm.Keyboard.KeyMap.prototype.onCtrlN_ = function(e, keyDef) { | 157 hterm.Keyboard.KeyMap.prototype.onCtrlN_ = function(e, keyDef) { |
| 152 if (e.shiftKey) { | 158 if (e.shiftKey) { |
| 153 chrome.runtime.sendMessage({'name': 'new_window'}); | 159 chrome.runtime.sendMessage({'name': 'new_window'}); |
| 154 } | 160 } |
| 155 return '\x0e'; | 161 return '\x0e'; |
| 156 }; | 162 }; |
| OLD | NEW |