Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef mozilla_system_automounter_h__ |
michael@0 | 6 | #define mozilla_system_automounter_h__ |
michael@0 | 7 | |
michael@0 | 8 | #include <stdint.h> |
michael@0 | 9 | |
michael@0 | 10 | class nsCString; |
michael@0 | 11 | |
michael@0 | 12 | namespace mozilla { |
michael@0 | 13 | namespace system { |
michael@0 | 14 | |
michael@0 | 15 | // AutoMounter modes |
michael@0 | 16 | #define AUTOMOUNTER_DISABLE 0 |
michael@0 | 17 | #define AUTOMOUNTER_ENABLE 1 |
michael@0 | 18 | #define AUTOMOUNTER_DISABLE_WHEN_UNPLUGGED 2 |
michael@0 | 19 | |
michael@0 | 20 | // Automounter statuses |
michael@0 | 21 | #define AUTOMOUNTER_STATUS_DISABLED 0 |
michael@0 | 22 | #define AUTOMOUNTER_STATUS_ENABLED 1 |
michael@0 | 23 | #define AUTOMOUNTER_STATUS_FILES_OPEN 2 |
michael@0 | 24 | |
michael@0 | 25 | /** |
michael@0 | 26 | * Initialize the automounter. This causes some of the phone's |
michael@0 | 27 | * directories to show up on the host when the phone is plugged |
michael@0 | 28 | * into the host via USB. |
michael@0 | 29 | * |
michael@0 | 30 | * When the AutoMounter starts, it will poll the current state |
michael@0 | 31 | * of affairs (usb cable plugged in, automounter enabled, etc) |
michael@0 | 32 | * and try to make the state of the volumes match. |
michael@0 | 33 | */ |
michael@0 | 34 | void |
michael@0 | 35 | InitAutoMounter(); |
michael@0 | 36 | |
michael@0 | 37 | /** |
michael@0 | 38 | * Sets the enabled state of the automounter. |
michael@0 | 39 | * |
michael@0 | 40 | * This will in turn cause the automounter to re-evaluate |
michael@0 | 41 | * whether it should mount/unmount/share/unshare volumes. |
michael@0 | 42 | */ |
michael@0 | 43 | void |
michael@0 | 44 | SetAutoMounterMode(int32_t aMode); |
michael@0 | 45 | |
michael@0 | 46 | /** |
michael@0 | 47 | * Reports the status of the automounter. |
michael@0 | 48 | */ |
michael@0 | 49 | int32_t |
michael@0 | 50 | GetAutoMounterStatus(); |
michael@0 | 51 | |
michael@0 | 52 | /** |
michael@0 | 53 | * Sets the sharing mode of an individual volume. |
michael@0 | 54 | * |
michael@0 | 55 | * If a volume is enabled for sharing, and the autmounter |
michael@0 | 56 | * is in a state to share, then the volume will be shared |
michael@0 | 57 | * with the PC. |
michael@0 | 58 | */ |
michael@0 | 59 | void |
michael@0 | 60 | SetAutoMounterSharingMode(const nsCString& aVolumeName, bool aAllowSharing); |
michael@0 | 61 | |
michael@0 | 62 | /** |
michael@0 | 63 | * Formats the volume with specified volume name. |
michael@0 | 64 | * |
michael@0 | 65 | * If the volume is ready to format, automounter |
michael@0 | 66 | * will unmount it, format it and then mount it again. |
michael@0 | 67 | */ |
michael@0 | 68 | void |
michael@0 | 69 | AutoMounterFormatVolume(const nsCString& aVolumeName); |
michael@0 | 70 | |
michael@0 | 71 | /** |
michael@0 | 72 | * Mounts the volume with specified volume name. |
michael@0 | 73 | * |
michael@0 | 74 | * If the volume is already unmounted, automounter |
michael@0 | 75 | * will mount it. Otherwise automounter will skip this. |
michael@0 | 76 | */ |
michael@0 | 77 | void |
michael@0 | 78 | AutoMounterMountVolume(const nsCString& aVolumeName); |
michael@0 | 79 | |
michael@0 | 80 | /** |
michael@0 | 81 | * Unmounts the volume with specified volume name. |
michael@0 | 82 | * |
michael@0 | 83 | * If the volume is already mounted, automounter |
michael@0 | 84 | * will unmount it. Otherwise automounter will skip this. |
michael@0 | 85 | */ |
michael@0 | 86 | void |
michael@0 | 87 | AutoMounterUnmountVolume(const nsCString& aVolumeName); |
michael@0 | 88 | |
michael@0 | 89 | /** |
michael@0 | 90 | * Shuts down the automounter. |
michael@0 | 91 | * |
michael@0 | 92 | * This leaves the volumes in whatever state they're in. |
michael@0 | 93 | */ |
michael@0 | 94 | void |
michael@0 | 95 | ShutdownAutoMounter(); |
michael@0 | 96 | |
michael@0 | 97 | } // system |
michael@0 | 98 | } // mozilla |
michael@0 | 99 | |
michael@0 | 100 | #endif // mozilla_system_automounter_h__ |