gecko-dev/toolkit/profile/nsIToolkitProfileService.idl

100 строки
3.6 KiB
Plaintext

/* -*- 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, builtinclass, uuid(1947899b-f369-48fa-89da-f7c37bb1e6bc)]
interface nsIToolkitProfileService : nsISupports
{
attribute boolean startWithLastProfile;
readonly attribute nsISimpleEnumerator /*nsIToolkitProfile*/ profiles;
/**
* The currently selected profile (the one used or about to be used by the
* browser).
*/
attribute nsIToolkitProfile selectedProfile;
/**
* The default profile (the one used or about to be used by the
* browser if no other profile is specified at runtime). This is the profile
* marked with Default=1 in profiles.ini and is usually the same as
* selectedProfile, except on Developer Edition.
*
* Developer Edition uses a profile named "dev-edition-default" as the
* default profile (which it creates if it doesn't exist), unless a special
* empty file named "ignore-dev-edition-profile" is present next to
* profiles.ini. In that case Developer Edition behaves the same as any
* other build of Firefox.
*/
attribute nsIToolkitProfile defaultProfile;
/**
* Selects or creates a profile to use based on the profiles database, any
* environment variables and any command line arguments. Will not create
* a profile if aIsResetting is true. The profile is selected based on this
* order of preference:
* * Environment variables (set when restarting the application).
* * --profile command line argument.
* * --createprofile command line argument (this also causes the app to exit).
* * -p command line argument.
* * A new profile created if this is the first run of the application.
* * The default profile.
* aRootDir and aLocalDir are set to the data and local directories for the
* profile data. If a profile from the database was selected it will be
* returned in aProfile.
* This returns true if a new profile was created.
* This method is primarily for testing. It can be called only once.
*/
bool selectStartupProfile(in Array<ACString> aArgv,
in boolean aIsResetting,
out nsIFile aRootDir, out nsIFile aLocalDir,
out nsIToolkitProfile aProfile);
/**
* 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);
/**
* Create a new profile.
*
* The profile temporary directory will be chosen based on where the
* profile directory is located.
*
* @param aRootDir
* The profile directory. May be null, in which case a suitable
* default will be chosen based on the profile name.
* @param aName
* The profile name.
*/
nsIToolkitProfile createProfile(in nsIFile aRootDir,
in AUTF8String aName);
/**
* Returns the number of profiles.
* @return the number of profiles.
*/
readonly attribute unsigned long profileCount;
/**
* Flush the profiles list file.
*/
void flush();
};
%{C++
#define NS_PROFILESERVICE_CONTRACTID "@mozilla.org/toolkit/profile-service;1"
%}