1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/profile/nsIToolkitProfileService.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,96 @@ 1.4 +/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +interface nsISimpleEnumerator; 1.12 +interface nsIFile; 1.13 +interface nsIToolkitProfile; 1.14 +interface nsIProfileLock; 1.15 + 1.16 +[scriptable, uuid(b81c33a6-1ce8-4695-856b-02b7f15cc114)] 1.17 +interface nsIToolkitProfileService : nsISupports 1.18 +{ 1.19 + attribute boolean startWithLastProfile; 1.20 + attribute boolean startOffline; 1.21 + 1.22 + readonly attribute nsISimpleEnumerator /*nsIToolkitProfile*/ profiles; 1.23 + 1.24 + attribute nsIToolkitProfile selectedProfile; 1.25 + 1.26 + /** 1.27 + * Get a profile by name. This is mainly for use by the -P 1.28 + * commandline flag. 1.29 + * 1.30 + * @param aName The profile name to find. 1.31 + */ 1.32 + nsIToolkitProfile getProfileByName(in AUTF8String aName); 1.33 + 1.34 + /** 1.35 + * Lock an arbitrary path as a profile. If the path does not exist, it 1.36 + * will be created and the defaults copied from the application directory. 1.37 + */ 1.38 + nsIProfileLock lockProfilePath(in nsIFile aDirectory, 1.39 + in nsIFile aTempDirectory); 1.40 + 1.41 + /** 1.42 + * Create a new profile. 1.43 + * 1.44 + * The profile temporary directory will be chosen based on where the 1.45 + * profile directory is located. 1.46 + * 1.47 + * @param aRootDir 1.48 + * The profile directory. May be null, in which case a suitable 1.49 + * default will be chosen based on the profile name. 1.50 + * @param aName 1.51 + * The profile name. 1.52 + */ 1.53 + nsIToolkitProfile createProfile(in nsIFile aRootDir, 1.54 + in AUTF8String aName); 1.55 + 1.56 + /** 1.57 + * Create the default profile for an application. 1.58 + * 1.59 + * The profile will be typically in 1.60 + * {Application Data}/.profilename/{salt}.default or 1.61 + * {Application Data}/.appname/{salt}.default 1.62 + * or if aVendorName is provided 1.63 + * {Application Data}/.vendor/appname/{salt}.default 1.64 + * 1.65 + * @note Either aProfileName or aAppName must be non-empty 1.66 + * 1.67 + * The contents of aProfileDefaultsDir will be copied to the 1.68 + * new profile directory. 1.69 + * 1.70 + * @param aProfileName 1.71 + * The name of the profile 1.72 + * @param aAppName 1.73 + * The name of the application 1.74 + * @param aVendorName 1.75 + * The name of the vendor 1.76 + * @param aProfileDefaultsDir 1.77 + * The location where the profile defaults are. 1.78 + * @return The created profile. 1.79 + */ 1.80 + nsIToolkitProfile createDefaultProfileForApp(in AUTF8String aProfileName, 1.81 + in AUTF8String aAppName, 1.82 + in AUTF8String aVendorName, 1.83 + [optional] in nsIFile aProfileDefaultsDir); 1.84 + 1.85 + /** 1.86 + * Returns the number of profiles. 1.87 + * @return 0, 1, or 2. More than 2 profiles will always return 2. 1.88 + */ 1.89 + readonly attribute unsigned long profileCount; 1.90 + 1.91 + /** 1.92 + * Flush the profiles list file. 1.93 + */ 1.94 + void flush(); 1.95 +}; 1.96 + 1.97 +%{C++ 1.98 +#define NS_PROFILESERVICE_CONTRACTID "@mozilla.org/toolkit/profile-service;1" 1.99 +%}