dom/system/gonk/AutoMounter.h

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

mercurial