|
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 nsISimpleEnumerator; |
|
9 interface nsIFile; |
|
10 interface nsIToolkitProfile; |
|
11 interface nsIProfileLock; |
|
12 |
|
13 [scriptable, uuid(b81c33a6-1ce8-4695-856b-02b7f15cc114)] |
|
14 interface nsIToolkitProfileService : nsISupports |
|
15 { |
|
16 attribute boolean startWithLastProfile; |
|
17 attribute boolean startOffline; |
|
18 |
|
19 readonly attribute nsISimpleEnumerator /*nsIToolkitProfile*/ profiles; |
|
20 |
|
21 attribute nsIToolkitProfile selectedProfile; |
|
22 |
|
23 /** |
|
24 * Get a profile by name. This is mainly for use by the -P |
|
25 * commandline flag. |
|
26 * |
|
27 * @param aName The profile name to find. |
|
28 */ |
|
29 nsIToolkitProfile getProfileByName(in AUTF8String aName); |
|
30 |
|
31 /** |
|
32 * Lock an arbitrary path as a profile. If the path does not exist, it |
|
33 * will be created and the defaults copied from the application directory. |
|
34 */ |
|
35 nsIProfileLock lockProfilePath(in nsIFile aDirectory, |
|
36 in nsIFile aTempDirectory); |
|
37 |
|
38 /** |
|
39 * Create a new profile. |
|
40 * |
|
41 * The profile temporary directory will be chosen based on where the |
|
42 * profile directory is located. |
|
43 * |
|
44 * @param aRootDir |
|
45 * The profile directory. May be null, in which case a suitable |
|
46 * default will be chosen based on the profile name. |
|
47 * @param aName |
|
48 * The profile name. |
|
49 */ |
|
50 nsIToolkitProfile createProfile(in nsIFile aRootDir, |
|
51 in AUTF8String aName); |
|
52 |
|
53 /** |
|
54 * Create the default profile for an application. |
|
55 * |
|
56 * The profile will be typically in |
|
57 * {Application Data}/.profilename/{salt}.default or |
|
58 * {Application Data}/.appname/{salt}.default |
|
59 * or if aVendorName is provided |
|
60 * {Application Data}/.vendor/appname/{salt}.default |
|
61 * |
|
62 * @note Either aProfileName or aAppName must be non-empty |
|
63 * |
|
64 * The contents of aProfileDefaultsDir will be copied to the |
|
65 * new profile directory. |
|
66 * |
|
67 * @param aProfileName |
|
68 * The name of the profile |
|
69 * @param aAppName |
|
70 * The name of the application |
|
71 * @param aVendorName |
|
72 * The name of the vendor |
|
73 * @param aProfileDefaultsDir |
|
74 * The location where the profile defaults are. |
|
75 * @return The created profile. |
|
76 */ |
|
77 nsIToolkitProfile createDefaultProfileForApp(in AUTF8String aProfileName, |
|
78 in AUTF8String aAppName, |
|
79 in AUTF8String aVendorName, |
|
80 [optional] in nsIFile aProfileDefaultsDir); |
|
81 |
|
82 /** |
|
83 * Returns the number of profiles. |
|
84 * @return 0, 1, or 2. More than 2 profiles will always return 2. |
|
85 */ |
|
86 readonly attribute unsigned long profileCount; |
|
87 |
|
88 /** |
|
89 * Flush the profiles list file. |
|
90 */ |
|
91 void flush(); |
|
92 }; |
|
93 |
|
94 %{C++ |
|
95 #define NS_PROFILESERVICE_CONTRACTID "@mozilla.org/toolkit/profile-service;1" |
|
96 %} |