michael@0: /* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsISimpleEnumerator; michael@0: interface nsIFile; michael@0: interface nsIToolkitProfile; michael@0: interface nsIProfileLock; michael@0: michael@0: [scriptable, uuid(b81c33a6-1ce8-4695-856b-02b7f15cc114)] michael@0: interface nsIToolkitProfileService : nsISupports michael@0: { michael@0: attribute boolean startWithLastProfile; michael@0: attribute boolean startOffline; michael@0: michael@0: readonly attribute nsISimpleEnumerator /*nsIToolkitProfile*/ profiles; michael@0: michael@0: attribute nsIToolkitProfile selectedProfile; michael@0: michael@0: /** michael@0: * Get a profile by name. This is mainly for use by the -P michael@0: * commandline flag. michael@0: * michael@0: * @param aName The profile name to find. michael@0: */ michael@0: nsIToolkitProfile getProfileByName(in AUTF8String aName); michael@0: michael@0: /** michael@0: * Lock an arbitrary path as a profile. If the path does not exist, it michael@0: * will be created and the defaults copied from the application directory. michael@0: */ michael@0: nsIProfileLock lockProfilePath(in nsIFile aDirectory, michael@0: in nsIFile aTempDirectory); michael@0: michael@0: /** michael@0: * Create a new profile. michael@0: * michael@0: * The profile temporary directory will be chosen based on where the michael@0: * profile directory is located. michael@0: * michael@0: * @param aRootDir michael@0: * The profile directory. May be null, in which case a suitable michael@0: * default will be chosen based on the profile name. michael@0: * @param aName michael@0: * The profile name. michael@0: */ michael@0: nsIToolkitProfile createProfile(in nsIFile aRootDir, michael@0: in AUTF8String aName); michael@0: michael@0: /** michael@0: * Create the default profile for an application. michael@0: * michael@0: * The profile will be typically in michael@0: * {Application Data}/.profilename/{salt}.default or michael@0: * {Application Data}/.appname/{salt}.default michael@0: * or if aVendorName is provided michael@0: * {Application Data}/.vendor/appname/{salt}.default michael@0: * michael@0: * @note Either aProfileName or aAppName must be non-empty michael@0: * michael@0: * The contents of aProfileDefaultsDir will be copied to the michael@0: * new profile directory. michael@0: * michael@0: * @param aProfileName michael@0: * The name of the profile michael@0: * @param aAppName michael@0: * The name of the application michael@0: * @param aVendorName michael@0: * The name of the vendor michael@0: * @param aProfileDefaultsDir michael@0: * The location where the profile defaults are. michael@0: * @return The created profile. michael@0: */ michael@0: nsIToolkitProfile createDefaultProfileForApp(in AUTF8String aProfileName, michael@0: in AUTF8String aAppName, michael@0: in AUTF8String aVendorName, michael@0: [optional] in nsIFile aProfileDefaultsDir); michael@0: michael@0: /** michael@0: * Returns the number of profiles. michael@0: * @return 0, 1, or 2. More than 2 profiles will always return 2. michael@0: */ michael@0: readonly attribute unsigned long profileCount; michael@0: michael@0: /** michael@0: * Flush the profiles list file. michael@0: */ michael@0: void flush(); michael@0: }; michael@0: michael@0: %{C++ michael@0: #define NS_PROFILESERVICE_CONTRACTID "@mozilla.org/toolkit/profile-service;1" michael@0: %}