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 nsIFile; michael@0: interface nsIProfileUnlocker; michael@0: michael@0: /** michael@0: * Hold on to a profile lock. Once you release the last reference to this michael@0: * interface, the profile lock is released. michael@0: */ michael@0: [scriptable, uuid(7c58c703-d245-4864-8d75-9648ca4a6139)] michael@0: interface nsIProfileLock : nsISupports michael@0: { michael@0: /** michael@0: * The main profile directory. michael@0: */ michael@0: readonly attribute nsIFile directory; michael@0: michael@0: /** michael@0: * A directory corresponding to the main profile directory that exists for michael@0: * the purpose of storing data on the local filesystem, including cache michael@0: * files or other data files that may not represent critical user data. michael@0: * (e.g., this directory may not be included as part of a backup scheme.) michael@0: * michael@0: * In some cases, this directory may just be the main profile directory. michael@0: */ michael@0: readonly attribute nsIFile localDirectory; michael@0: michael@0: /** michael@0: * The timestamp of an existing profile lock at lock time. michael@0: */ michael@0: readonly attribute PRTime replacedLockTime; michael@0: michael@0: /** michael@0: * Unlock the profile. michael@0: */ michael@0: void unlock(); michael@0: }; michael@0: michael@0: /** michael@0: * A interface representing a profile. michael@0: * @note THIS INTERFACE SHOULD BE IMPLEMENTED BY THE TOOLKIT CODE ONLY! DON'T michael@0: * EVEN THINK ABOUT IMPLEMENTING THIS IN JAVASCRIPT! michael@0: */ michael@0: [scriptable, uuid(7422b090-4a86-4407-972e-75468a625388)] michael@0: interface nsIToolkitProfile : nsISupports michael@0: { michael@0: /** michael@0: * The location of the profile directory. michael@0: */ michael@0: readonly attribute nsIFile rootDir; michael@0: michael@0: /** michael@0: * The location of the profile local directory, which may be the same as michael@0: * the root directory. See nsIProfileLock::localDirectory. michael@0: */ michael@0: readonly attribute nsIFile localDir; michael@0: michael@0: /** michael@0: * The name of the profile. michael@0: */ michael@0: attribute AUTF8String name; michael@0: michael@0: /** michael@0: * Removes the profile from the registry of profiles. michael@0: * michael@0: * @param removeFiles michael@0: * Indicates whether or not the profile directory should be michael@0: * removed in addition. michael@0: */ michael@0: void remove(in boolean removeFiles); michael@0: michael@0: /** michael@0: * Lock this profile using platform-specific locking methods. michael@0: * michael@0: * @param lockFile If locking fails, this may return a lockFile object michael@0: * which can be used in platform-specific ways to michael@0: * determine which process has the file locked. Null michael@0: * may be passed. michael@0: * @return An interface which holds a profile lock as long as you reference michael@0: * it. michael@0: * @throws NS_ERROR_FILE_ACCESS_DENIED if the profile was already locked. michael@0: */ michael@0: nsIProfileLock lock(out nsIProfileUnlocker aUnlocker); michael@0: };