nsIProfile 编辑

profile/public/nsIProfile.idlUnknown The Profile Manager is responsible for creating, maintaining, and organizing user profiles. This interface was superseded by the nsIToolkitProfileService interface in Gecko 1.8.1. 66 Introduced Gecko 0.9 Deprecated Gecko 1.8.1 Obsolete Gecko 20.0 Inherits from: nsISupports Last changed in Gecko 1.6

Implemented by: @mozilla.org/profile/manager;1. To get access to the Profile Manager service:

var profile = Components.classes["@mozilla.org/profile/manager;1"]
              .getService(Components.interfaces.nsIProfile);
Note: This interface was used by SeaMonkey up through SeaMonkey 1.1 versions, which were based off Gecko 1.8.1. However, it hasn't been used in Firefox since before Firefox 1.0.

Method overview

void cloneProfile(in wstring profileName);
void createNewProfile(in wstring profileName, in wstring nativeProfileDir, in wstring langcode, in boolean useExistingDir);
void deleteProfile(in wstring name, in boolean canDeleteFiles);
void getProfileList(out unsigned long length, [retval, array, size_is(length)] out wstring profileNames);
boolean profileExists(in wstring profileName);
void renameProfile(in wstring oldName, in wstring newName);
void shutDownCurrentProfile(in unsigned long shutDownType);

Attributes

AttributeTypeDescription
currentProfilewstringThe name of the profile currently in use.
profileCountlongThe number of profiles. Read only.

Constants

Profile shutdown types

ConstantValueDescription
SHUTDOWN_PERSIST0x00000001When shutting down the profile, save all changes.
SHUTDOWN_CLEANSE0x00000002When shutting down the profile, discard changes. Unimplemented

Methods

cloneProfile()

Clones the current profile, creating a copy of it with a new name.

void cloneProfile(
  in wstring profileName
);
Parameters
profileName
The name to assign to the new clone of the current profile.

createNewProfile()

Creates a new profile. Appropriate default values will be copied into the preferences in the new profile.

void createNewProfile(
  in wstring profileName,
  in wstring nativeProfileDir,
  in wstring langcode,
  in boolean useExistingDir
);
Parameters
profileName
The name to assign to the new profile.
nativeProfileDir
The pathname of the directory to use as the profile directory; if you specify null, a new folder will be created in the default profiles directory.
langcode
The locale to use for the new profile.
useExistingDir
If true, an existing directory may be used; otherwise, the profile directory will be unique.

deleteProfile()

Deletes the specified profile.

void deleteProfile(
  in wstring name,
  in boolean canDeleteFiles
);
Parameters
name
The name of the profile to delete.
canDeleteFiles
If true, the Profile Manager will try to delete all of the profile's files and its directory.

getProfileList()

Returns an array of strings indicating the names of all the available profiles.

void getProfileList(
  out unsigned long length,
  [retval, array, size_is(length)] out wstring profileNames
);
Parameters
length
On return, contains the number of profiles in the profileNames array.
profileNames
On return, contains an array of all of the available profiles' names.

profileExists()

Determine whether or not a profile with the specified name exists.

boolean profileExists(
  in wstring profileName
);
Parameters
profileName
The name of the profile to look for.
Return value

true if there is a profile with the specified name.

renameProfile()

Renames an existing profile.

void renameProfile(
  in wstring oldName,
  in wstring newName
);
Parameters
oldName
The name of the profile to rename.
newName
The new name to assign to the profile.
Exceptions thrown
NS_ERROR_FAILURE
A profile already exists with the name newName.

shutDownCurrentProfile()

Shuts down the current profile; this essentially "logs out" the current profile.

void shutDownCurrentProfile(
  in unsigned long shutDownType
);
Parameters
shutDownType
The type of shutdown to perform; see Shutdown type constants.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:68 次

字数:8585

最后编辑:8 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文