toolkit/profile/nsIToolkitProfileService.idl
author Gervase Markham <gerv@gerv.net>
Mon, 21 May 2012 12:12:37 +0100
changeset 96742 f4157e8c410708d76703f19e4dfb61859bfe32d8
parent 63497 86e1b854470687f5c2029a70d065f1b098af0f45
child 96951 4f66e59eaa773e1e61d56ba08dff8eba5009447b
permissions -rw-r--r--
Bug 716478 - update licence to MPL 2.

/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsISimpleEnumerator;
interface nsILocalFile;
interface nsIToolkitProfile;
interface nsIProfileLock;

[scriptable, uuid(9b434f48-438c-4f85-89de-b7f321a45341)]
interface nsIToolkitProfileService : nsISupports
{
    attribute boolean startWithLastProfile;
    attribute boolean startOffline;

    readonly attribute nsISimpleEnumerator /*nsIToolkitProfile*/ profiles;

    attribute nsIToolkitProfile selectedProfile;

    /**
     * Get a profile by name. This is mainly for use by the -P
     * commandline flag.
     *
     * @param aName The profile name to find.
     */
    nsIToolkitProfile getProfileByName(in AUTF8String aName);

    /**
     * Lock an arbitrary path as a profile. If the path does not exist, it
     * will be created and the defaults copied from the application directory.
     */
    nsIProfileLock lockProfilePath(in nsILocalFile aDirectory,
                                   in nsILocalFile aTempDirectory);

    /**
     * Create a new profile.
     * 
     * @param aRootDir
     *        The profile directory. May be null, in which case a suitable
     *        default will be chosen based on the profile name.
     * @param aTempDir
     *        The profile temporary directory. May be null, in which case a
     *        suitable default will be chosen based either on the profile name
     *        if aRootDir is null or aRootDir itself.
     * @param aName
     *        The profile name.
     */
    nsIToolkitProfile createProfile(in nsILocalFile aRootDir,
                                    in nsILocalFile aTempDir,
                                    in AUTF8String aName);

    /**
     * Returns the number of profiles.
     * @return 0, 1, or 2. More than 2 profiles will always return 2.
     */
    readonly attribute unsigned long profileCount;

    /**
     * Flush the profiles list file.
     */
    void flush();
};

%{C++
#define NS_PROFILESERVICE_CONTRACTID "@mozilla.org/toolkit/profile-service;1"
%}