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/. */
6 #include
"nsISupports.idl"
8 interface nsISimpleEnumerator
;
10 interface nsIToolkitProfile
;
11 interface nsIProfileLock
;
13 [scriptable
, builtinclass
, uuid(1947899b
-f369
-48fa
-89da
-f7c37bb1e6bc
)]
14 interface nsIToolkitProfileService
: nsISupports
17 * Tests whether the profile lists on disk have changed since they were
18 * loaded. When this is true attempts to flush changes to disk will fail.
20 [infallible
] readonly attribute
boolean isListOutdated
;
23 * When a downgrade is detected UI is presented to the user to ask how to
24 * proceed. These flags are used to pass some information to the UI.
26 cenum downgradeUIFlags
: 8 {
31 * When a downgrade is detected UI is presented to the user to ask how to
32 * proceed. These are the possible options the user can choose.
34 cenum downgradeUIChoice
: 8 {
39 cenum profileManagerResult
: 8 {
41 launchWithProfile
= 1,
45 attribute
boolean startWithLastProfile
;
47 readonly attribute nsISimpleEnumerator
/*nsIToolkitProfile*/ profiles
;
50 * The profile currently in use if it is a named profile. This will return
51 * null if the current profile path doesn't match a profile in the database.
53 readonly attribute nsIToolkitProfile currentProfile
;
56 * The default profile for this build.
57 * On startup this is the profile selected unless overridden by command line
58 * arguments or environment variables. Setting this will change the profile
59 * used by default the next time the application is started.
60 * Attempting to change the default may throw an exception on builds that do
61 * not support changing the default profile, such as developer edition.
63 attribute nsIToolkitProfile defaultProfile
;
66 * Selects or creates a profile to use based on the profiles database, any
67 * environment variables and any command line arguments. Will not create
68 * a profile if aIsResetting is true. The profile is selected based on this
69 * order of preference:
70 * * Environment variables (set when restarting the application).
71 * * --profile command line argument.
72 * * --createprofile command line argument (this also causes the app to exit).
73 * * -p command line argument.
74 * * A new profile created if this is the first run of the application.
75 * * The default profile.
76 * aRootDir and aLocalDir are set to the data and local directories for the
77 * profile data. If a profile from the database was selected it will be
78 * returned in aProfile.
79 * This returns true if a new profile was created.
80 * This method is primarily for testing. It can be called only once.
82 bool selectStartupProfile
(in Array
<ACString
> aArgv
,
83 in boolean aIsResetting
, in AUTF8String aUpdateChannel
,
84 in AUTF8String aLegacyInstallHash
,
85 out nsIFile aRootDir
, out nsIFile aLocalDir
,
86 out nsIToolkitProfile aProfile
);
89 * Get a profile by name. This is mainly for use by the -P
92 * @param aName The profile name to find.
94 nsIToolkitProfile getProfileByName
(in AUTF8String aName
);
97 * Create a new profile.
99 * The profile temporary directory will be chosen based on where the
100 * profile directory is located.
102 * If a profile with the given name already exists it will be returned
103 * instead of creating a new profile.
106 * The profile directory. May be null, in which case a suitable
107 * default will be chosen based on the profile name.
111 nsIToolkitProfile createProfile
(in nsIFile aRootDir
,
112 in AUTF8String aName
);
115 * Create a new profile with a unique name.
117 * As above however the name given will be altered to make it a unique
121 * The profile directory. May be null, in which case a suitable
122 * default will be chosen based on the profile name.
124 * The prefix to use for the profile name. If unused this will be
125 * used as the profile name otherwise additional characters will be
126 * added to make the name unique.
128 nsIToolkitProfile createUniqueProfile
(in nsIFile aRootDir
,
129 in AUTF8String aNamePrefix
);
132 * Returns the number of profiles.
133 * @return the number of profiles.
135 readonly attribute
unsigned long profileCount
;
138 * Flush the profiles list file. This will fail with
139 * NS_ERROR_DATABASE_CHANGED if the files on disk have changed since the
140 * profiles were loaded.
146 #define NS_PROFILESERVICE_CONTRACTID
"@mozilla.org/toolkit/profile-service;1"