Copy as Markdown
Other Tools
//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/toolkit/components/aboutthirdparty/nsIAboutThirdParty.idl
//
/// `interface nsIInstalledApplication : nsISupports`
///
// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.
#[repr(C)]
pub struct nsIInstalledApplication {
vtable: &'static nsIInstalledApplicationVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// introduced by https://github.com/llvm/llvm-project/commit/01859da84bad95fd51d6a03b08b60c660e642a4f
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsIInstalledApplication.
unsafe impl XpCom for nsIInstalledApplication {
const IID: nsIID = nsID(0x063813a0, 0x85d8, 0x4e77,
[0x80, 0xea, 0xb6, 0x12, 0x92, 0xc0, 0x49, 0x3d]);
}
// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsIInstalledApplication {
#[inline]
unsafe fn addref(&self) {
self.AddRef();
}
#[inline]
unsafe fn release(&self) {
self.Release();
}
}
// This trait is implemented on all types which can be coerced to from nsIInstalledApplication.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsIInstalledApplicationCoerce {
/// Cheaply cast a value of this type from a `nsIInstalledApplication`.
fn coerce_from(v: &nsIInstalledApplication) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIInstalledApplicationCoerce for nsIInstalledApplication {
#[inline]
fn coerce_from(v: &nsIInstalledApplication) -> &Self {
v
}
}
impl nsIInstalledApplication {
/// Cast this `nsIInstalledApplication` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIInstalledApplicationCoerce>(&self) -> &T {
T::coerce_from(self)
}
}
// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsIInstalledApplication {
type Target = nsISupports;
#[inline]
fn deref(&self) -> &nsISupports {
unsafe {
::std::mem::transmute(self)
}
}
}
// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsISupportsCoerce> nsIInstalledApplicationCoerce for T {
#[inline]
fn coerce_from(v: &nsIInstalledApplication) -> &Self {
T::coerce_from(v)
}
}
// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsIInstalledApplication
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsIInstalledApplicationVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute AString name; */
pub GetName: unsafe extern "system" fn (this: *const nsIInstalledApplication, aName: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AString publisher; */
pub GetPublisher: unsafe extern "system" fn (this: *const nsIInstalledApplication, aPublisher: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
}
// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsIInstalledApplication {
/// `readonly attribute AString name;`
#[inline]
pub unsafe fn GetName(&self, aName: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetName)(self, aName)
}
/// `readonly attribute AString publisher;`
#[inline]
pub unsafe fn GetPublisher(&self, aPublisher: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetPublisher)(self, aPublisher)
}
}
/// `interface nsIAboutThirdParty : nsISupports`
///
// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.
#[repr(C)]
pub struct nsIAboutThirdParty {
vtable: &'static nsIAboutThirdPartyVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// introduced by https://github.com/llvm/llvm-project/commit/01859da84bad95fd51d6a03b08b60c660e642a4f
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsIAboutThirdParty.
unsafe impl XpCom for nsIAboutThirdParty {
const IID: nsIID = nsID(0xd33ff086, 0xb328, 0x4ae6,
[0xaa, 0xf5, 0x52, 0xd4, 0x1a, 0xa5, 0xdf, 0x38]);
}
// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsIAboutThirdParty {
#[inline]
unsafe fn addref(&self) {
self.AddRef();
}
#[inline]
unsafe fn release(&self) {
self.Release();
}
}
// This trait is implemented on all types which can be coerced to from nsIAboutThirdParty.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsIAboutThirdPartyCoerce {
/// Cheaply cast a value of this type from a `nsIAboutThirdParty`.
fn coerce_from(v: &nsIAboutThirdParty) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIAboutThirdPartyCoerce for nsIAboutThirdParty {
#[inline]
fn coerce_from(v: &nsIAboutThirdParty) -> &Self {
v
}
}
impl nsIAboutThirdParty {
/// Cast this `nsIAboutThirdParty` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIAboutThirdPartyCoerce>(&self) -> &T {
T::coerce_from(self)
}
}
// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsIAboutThirdParty {
type Target = nsISupports;
#[inline]
fn deref(&self) -> &nsISupports {
unsafe {
::std::mem::transmute(self)
}
}
}
// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsISupportsCoerce> nsIAboutThirdPartyCoerce for T {
#[inline]
fn coerce_from(v: &nsIAboutThirdParty) -> &Self {
T::coerce_from(v)
}
}
// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsIAboutThirdParty
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsIAboutThirdPartyVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* unsigned long lookupModuleType (in AString aLeafName); */
pub LookupModuleType: unsafe extern "system" fn (this: *const nsIAboutThirdParty, aLeafName: *const ::nsstring::nsAString, _retval: *mut u32) -> ::nserror::nsresult,
/* nsIInstalledApplication lookupApplication (in AString aModulePath); */
pub LookupApplication: unsafe extern "system" fn (this: *const nsIAboutThirdParty, aModulePath: *const ::nsstring::nsAString, _retval: *mut *const nsIInstalledApplication) -> ::nserror::nsresult,
/* readonly attribute boolean isDynamicBlocklistAvailable; */
pub GetIsDynamicBlocklistAvailable: unsafe extern "system" fn (this: *const nsIAboutThirdParty, aIsDynamicBlocklistAvailable: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean isDynamicBlocklistDisabled; */
pub GetIsDynamicBlocklistDisabled: unsafe extern "system" fn (this: *const nsIAboutThirdParty, aIsDynamicBlocklistDisabled: *mut bool) -> ::nserror::nsresult,
/* [implicit_jscontext] Promise updateBlocklist (in AString aLeafName, in boolean aNewBlockStatus); */
/// Unable to generate binding because `jscontext is unsupported`
pub UpdateBlocklist: *const ::libc::c_void,
/* [implicit_jscontext] Promise collectSystemInfo (); */
/// Unable to generate binding because `jscontext is unsupported`
pub CollectSystemInfo: *const ::libc::c_void,
/* void openAndCloseFileDialogForTesting (in AString aModuleName, in AString aInitialDir, in AString aFilter); */
pub OpenAndCloseFileDialogForTesting: unsafe extern "system" fn (this: *const nsIAboutThirdParty, aModuleName: *const ::nsstring::nsAString, aInitialDir: *const ::nsstring::nsAString, aFilter: *const ::nsstring::nsAString) -> ::nserror::nsresult,
}
// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsIAboutThirdParty {
/// ```text
/// /**
/// * ModuleType flags used by lookupModuleType.
/// */
/// ```
///
pub const ModuleType_Unknown: u32 = 1;
pub const ModuleType_IME: u32 = 2;
pub const ModuleType_ShellExtension: u32 = 4;
pub const ModuleType_BlockedByUser: u32 = 8;
pub const ModuleType_BlockedByUserAtLaunch: u32 = 16;
/// ```text
/// /**
/// * Returns a bitwise combination of the ModuleType_* flags
/// * for the given leaf name of a module.
/// */
/// ```
///
/// `unsigned long lookupModuleType (in AString aLeafName);`
#[inline]
pub unsafe fn LookupModuleType(&self, aLeafName: *const ::nsstring::nsAString, _retval: *mut u32) -> ::nserror::nsresult {
((*self.vtable).LookupModuleType)(self, aLeafName, _retval)
}
/// ```text
/// /**
/// * Returns an object representing an application which includes
/// * the given path of a module in its installation.
/// */
/// ```
///
/// `nsIInstalledApplication lookupApplication (in AString aModulePath);`
#[inline]
pub unsafe fn LookupApplication(&self, aModulePath: *const ::nsstring::nsAString, _retval: *mut *const nsIInstalledApplication) -> ::nserror::nsresult {
((*self.vtable).LookupApplication)(self, aModulePath, _retval)
}
/// ```text
/// /**
/// * Returns true if DynamicBlocklist is available.
/// */
/// ```
///
/// `readonly attribute boolean isDynamicBlocklistAvailable;`
#[inline]
pub unsafe fn GetIsDynamicBlocklistAvailable(&self, aIsDynamicBlocklistAvailable: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetIsDynamicBlocklistAvailable)(self, aIsDynamicBlocklistAvailable)
}
/// ```text
/// /**
/// * Returns true if DynamicBlocklist is available but disabled.
/// */
/// ```
///
/// `readonly attribute boolean isDynamicBlocklistDisabled;`
#[inline]
pub unsafe fn GetIsDynamicBlocklistDisabled(&self, aIsDynamicBlocklistDisabled: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetIsDynamicBlocklistDisabled)(self, aIsDynamicBlocklistDisabled)
}
/// ```text
/// /**
/// * Add or remove an entry from the dynamic blocklist and save
/// * the resulting file.
/// */
/// ```
///
/// `[implicit_jscontext] Promise updateBlocklist (in AString aLeafName, in boolean aNewBlockStatus);`
const _UpdateBlocklist: () = ();
/// ```text
/// /**
/// * Posts a background task to collect system information and resolves
/// * the returned promise when the task is finished.
/// */
/// ```
///
/// `[implicit_jscontext] Promise collectSystemInfo ();`
const _CollectSystemInfo: () = ();
/// ```text
/// /**
/// * Open an OpenFile dialog with given parameters and immediately close it.
/// * This method should only be used for testing.
/// */
/// ```
///
/// `void openAndCloseFileDialogForTesting (in AString aModuleName, in AString aInitialDir, in AString aFilter);`
#[inline]
pub unsafe fn OpenAndCloseFileDialogForTesting(&self, aModuleName: *const ::nsstring::nsAString, aInitialDir: *const ::nsstring::nsAString, aFilter: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).OpenAndCloseFileDialogForTesting)(self, aModuleName, aInitialDir, aFilter)
}
}