1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/profile/nsIToolkitProfile.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,89 @@ 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 nsIFile; 1.12 +interface nsIProfileUnlocker; 1.13 + 1.14 +/** 1.15 + * Hold on to a profile lock. Once you release the last reference to this 1.16 + * interface, the profile lock is released. 1.17 + */ 1.18 +[scriptable, uuid(7c58c703-d245-4864-8d75-9648ca4a6139)] 1.19 +interface nsIProfileLock : nsISupports 1.20 +{ 1.21 + /** 1.22 + * The main profile directory. 1.23 + */ 1.24 + readonly attribute nsIFile directory; 1.25 + 1.26 + /** 1.27 + * A directory corresponding to the main profile directory that exists for 1.28 + * the purpose of storing data on the local filesystem, including cache 1.29 + * files or other data files that may not represent critical user data. 1.30 + * (e.g., this directory may not be included as part of a backup scheme.) 1.31 + * 1.32 + * In some cases, this directory may just be the main profile directory. 1.33 + */ 1.34 + readonly attribute nsIFile localDirectory; 1.35 + 1.36 + /** 1.37 + * The timestamp of an existing profile lock at lock time. 1.38 + */ 1.39 + readonly attribute PRTime replacedLockTime; 1.40 + 1.41 + /** 1.42 + * Unlock the profile. 1.43 + */ 1.44 + void unlock(); 1.45 +}; 1.46 + 1.47 +/** 1.48 + * A interface representing a profile. 1.49 + * @note THIS INTERFACE SHOULD BE IMPLEMENTED BY THE TOOLKIT CODE ONLY! DON'T 1.50 + * EVEN THINK ABOUT IMPLEMENTING THIS IN JAVASCRIPT! 1.51 + */ 1.52 +[scriptable, uuid(7422b090-4a86-4407-972e-75468a625388)] 1.53 +interface nsIToolkitProfile : nsISupports 1.54 +{ 1.55 + /** 1.56 + * The location of the profile directory. 1.57 + */ 1.58 + readonly attribute nsIFile rootDir; 1.59 + 1.60 + /** 1.61 + * The location of the profile local directory, which may be the same as 1.62 + * the root directory. See nsIProfileLock::localDirectory. 1.63 + */ 1.64 + readonly attribute nsIFile localDir; 1.65 + 1.66 + /** 1.67 + * The name of the profile. 1.68 + */ 1.69 + attribute AUTF8String name; 1.70 + 1.71 + /** 1.72 + * Removes the profile from the registry of profiles. 1.73 + * 1.74 + * @param removeFiles 1.75 + * Indicates whether or not the profile directory should be 1.76 + * removed in addition. 1.77 + */ 1.78 + void remove(in boolean removeFiles); 1.79 + 1.80 + /** 1.81 + * Lock this profile using platform-specific locking methods. 1.82 + * 1.83 + * @param lockFile If locking fails, this may return a lockFile object 1.84 + * which can be used in platform-specific ways to 1.85 + * determine which process has the file locked. Null 1.86 + * may be passed. 1.87 + * @return An interface which holds a profile lock as long as you reference 1.88 + * it. 1.89 + * @throws NS_ERROR_FILE_ACCESS_DENIED if the profile was already locked. 1.90 + */ 1.91 + nsIProfileLock lock(out nsIProfileUnlocker aUnlocker); 1.92 +};