|
1 /* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 interface nsIFile; |
|
9 interface nsIProfileUnlocker; |
|
10 |
|
11 /** |
|
12 * Hold on to a profile lock. Once you release the last reference to this |
|
13 * interface, the profile lock is released. |
|
14 */ |
|
15 [scriptable, uuid(7c58c703-d245-4864-8d75-9648ca4a6139)] |
|
16 interface nsIProfileLock : nsISupports |
|
17 { |
|
18 /** |
|
19 * The main profile directory. |
|
20 */ |
|
21 readonly attribute nsIFile directory; |
|
22 |
|
23 /** |
|
24 * A directory corresponding to the main profile directory that exists for |
|
25 * the purpose of storing data on the local filesystem, including cache |
|
26 * files or other data files that may not represent critical user data. |
|
27 * (e.g., this directory may not be included as part of a backup scheme.) |
|
28 * |
|
29 * In some cases, this directory may just be the main profile directory. |
|
30 */ |
|
31 readonly attribute nsIFile localDirectory; |
|
32 |
|
33 /** |
|
34 * The timestamp of an existing profile lock at lock time. |
|
35 */ |
|
36 readonly attribute PRTime replacedLockTime; |
|
37 |
|
38 /** |
|
39 * Unlock the profile. |
|
40 */ |
|
41 void unlock(); |
|
42 }; |
|
43 |
|
44 /** |
|
45 * A interface representing a profile. |
|
46 * @note THIS INTERFACE SHOULD BE IMPLEMENTED BY THE TOOLKIT CODE ONLY! DON'T |
|
47 * EVEN THINK ABOUT IMPLEMENTING THIS IN JAVASCRIPT! |
|
48 */ |
|
49 [scriptable, uuid(7422b090-4a86-4407-972e-75468a625388)] |
|
50 interface nsIToolkitProfile : nsISupports |
|
51 { |
|
52 /** |
|
53 * The location of the profile directory. |
|
54 */ |
|
55 readonly attribute nsIFile rootDir; |
|
56 |
|
57 /** |
|
58 * The location of the profile local directory, which may be the same as |
|
59 * the root directory. See nsIProfileLock::localDirectory. |
|
60 */ |
|
61 readonly attribute nsIFile localDir; |
|
62 |
|
63 /** |
|
64 * The name of the profile. |
|
65 */ |
|
66 attribute AUTF8String name; |
|
67 |
|
68 /** |
|
69 * Removes the profile from the registry of profiles. |
|
70 * |
|
71 * @param removeFiles |
|
72 * Indicates whether or not the profile directory should be |
|
73 * removed in addition. |
|
74 */ |
|
75 void remove(in boolean removeFiles); |
|
76 |
|
77 /** |
|
78 * Lock this profile using platform-specific locking methods. |
|
79 * |
|
80 * @param lockFile If locking fails, this may return a lockFile object |
|
81 * which can be used in platform-specific ways to |
|
82 * determine which process has the file locked. Null |
|
83 * may be passed. |
|
84 * @return An interface which holds a profile lock as long as you reference |
|
85 * it. |
|
86 * @throws NS_ERROR_FILE_ACCESS_DENIED if the profile was already locked. |
|
87 */ |
|
88 nsIProfileLock lock(out nsIProfileUnlocker aUnlocker); |
|
89 }; |