toolkit/profile/nsIToolkitProfileService.idl
author Andrea Marchesini <amarchesini@mozilla.com>
Wed, 31 Jul 2013 17:48:46 +0200
changeset 153074 9f455064253542311a0f971eb7e9c2698cccc733
parent 100626 a15d75939cd5d820507656f64edae9a18e10918e
child 171689 e2cc0ab6587195ccd3ec154e9ff826dd9b58eb59
permissions -rw-r--r--
Bug 888596 - Move IDBDatabase to WebIDL, r=janv

/* -*- 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 nsIFile;
interface nsIToolkitProfile;
interface nsIProfileLock;

[scriptable, uuid(b619f83d-8317-473c-b342-67905993fdc7)]
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 nsIFile aDirectory,
                                   in nsIFile 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 nsIFile aRootDir,
                                    in nsIFile aTempDir,
                                    in AUTF8String aName);

    /**
     * Create the default profile for an application.
     *
     * The profile will be typically in
     * {Application Data}/.profilename/{salt}.default or
     * {Application Data}/.appname/{salt}.default
     * or if aVendorName is provided
     * {Application Data}/.vendor/appname/{salt}.default
     *
     * @note Either aProfileName or aAppName must be non-empty
     *
     * The contents of aProfileDefaultsDir will be copied to the
     * new profile directory.
     * 
     * @param  aProfileName
     *         The name of the profile
     * @param  aAppName
     *         The name of the application
     * @param  aVendorName
     *         The name of the vendor
     * @param  aProfileDefaultsDir
     *         The location where the profile defaults are.
     * @return The created profile.
     */                                    
    nsIToolkitProfile createDefaultProfileForApp(in AUTF8String aProfileName,
                                                 in AUTF8String aAppName,
                                                 in AUTF8String aVendorName,
                                                 [optional] in nsIFile aProfileDefaultsDir);

    /**
     * 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"
%}