Copy as Markdown
Other Tools
//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/browser/components/shell/nsIWindowsShellService.idl
//
/// `interface nsIWindowsShellService : nsIShellService`
///
// 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 nsIWindowsShellService {
vtable: &'static nsIWindowsShellServiceVTable,
/// 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 nsIWindowsShellService.
unsafe impl XpCom for nsIWindowsShellService {
const IID: nsIID = nsID(0xfb9b59db, 0x5a91, 0x4e67,
[0x92, 0xb6, 0x35, 0xe7, 0xd6, 0xe6, 0xd3, 0xfd]);
}
// 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 nsIWindowsShellService {
#[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 nsIWindowsShellService.
// 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 nsIWindowsShellServiceCoerce {
/// Cheaply cast a value of this type from a `nsIWindowsShellService`.
fn coerce_from(v: &nsIWindowsShellService) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIWindowsShellServiceCoerce for nsIWindowsShellService {
#[inline]
fn coerce_from(v: &nsIWindowsShellService) -> &Self {
v
}
}
impl nsIWindowsShellService {
/// Cast this `nsIWindowsShellService` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIWindowsShellServiceCoerce>(&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 nsIWindowsShellService {
type Target = nsIShellService;
#[inline]
fn deref(&self) -> &nsIShellService {
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: nsIShellServiceCoerce> nsIWindowsShellServiceCoerce for T {
#[inline]
fn coerce_from(v: &nsIWindowsShellService) -> &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 nsIWindowsShellService
// 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 nsIWindowsShellServiceVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsIShellServiceVTable,
/* [implicit_jscontext] Promise createShortcut (in nsIFile aBinary, in Array<AString> aArguments, in AString aDescription, in nsIFile aIconFile, in unsigned short aIconIndex, in AString aAppUserModelId, in AString aShortcutFolder, in AString aShortcutName); */
/// Unable to generate binding because `jscontext is unsupported`
pub CreateShortcut: *const ::libc::c_void,
/* Array<AString> getLaunchOnLoginShortcuts (); */
pub GetLaunchOnLoginShortcuts: unsafe extern "system" fn (this: *const nsIWindowsShellService, _retval: *mut thin_vec::ThinVec<::nsstring::nsString>) -> ::nserror::nsresult,
/* [implicit_jscontext] Promise pinCurrentAppToStartMenuAsync (in boolean aCheckOnly); */
/// Unable to generate binding because `jscontext is unsupported`
pub PinCurrentAppToStartMenuAsync: *const ::libc::c_void,
/* [implicit_jscontext] Promise isCurrentAppPinnedToStartMenuAsync (); */
/// Unable to generate binding because `jscontext is unsupported`
pub IsCurrentAppPinnedToStartMenuAsync: *const ::libc::c_void,
/* [implicit_jscontext] Promise enableLaunchOnLoginMSIXAsync (in AString aTaskId); */
/// Unable to generate binding because `jscontext is unsupported`
pub EnableLaunchOnLoginMSIXAsync: *const ::libc::c_void,
/* [implicit_jscontext] Promise disableLaunchOnLoginMSIXAsync (in AString aTaskId); */
/// Unable to generate binding because `jscontext is unsupported`
pub DisableLaunchOnLoginMSIXAsync: *const ::libc::c_void,
/* [implicit_jscontext] Promise getLaunchOnLoginEnabledMSIXAsync (in AString aTaskId); */
/// Unable to generate binding because `jscontext is unsupported`
pub GetLaunchOnLoginEnabledMSIXAsync: *const ::libc::c_void,
/* [implicit_jscontext] Promise pinCurrentAppToTaskbarAsync (in boolean aPrivateBrowsing); */
/// Unable to generate binding because `jscontext is unsupported`
pub PinCurrentAppToTaskbarAsync: *const ::libc::c_void,
/* [implicit_jscontext] Promise checkPinCurrentAppToTaskbarAsync (in boolean aPrivateBrowsing); */
/// Unable to generate binding because `jscontext is unsupported`
pub CheckPinCurrentAppToTaskbarAsync: *const ::libc::c_void,
/* [implicit_jscontext] Promise isCurrentAppPinnedToTaskbarAsync (in AString aumid); */
/// Unable to generate binding because `jscontext is unsupported`
pub IsCurrentAppPinnedToTaskbarAsync: *const ::libc::c_void,
/* void pinShortcutToTaskbar (in AString aShortcutPath); */
pub PinShortcutToTaskbar: unsafe extern "system" fn (this: *const nsIWindowsShellService, aShortcutPath: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* void unpinShortcutFromTaskbar (in AString aShortcutPath); */
pub UnpinShortcutFromTaskbar: unsafe extern "system" fn (this: *const nsIWindowsShellService, aShortcutPath: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* AString getTaskbarTabShortcutPath (in AString aShortcutName); */
pub GetTaskbarTabShortcutPath: unsafe extern "system" fn (this: *const nsIWindowsShellService, aShortcutName: *const ::nsstring::nsAString, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* Array<AString> getTaskbarTabPins (); */
pub GetTaskbarTabPins: unsafe extern "system" fn (this: *const nsIWindowsShellService, _retval: *mut thin_vec::ThinVec<::nsstring::nsString>) -> ::nserror::nsresult,
/* AString classifyShortcut (in AString aPath); */
pub ClassifyShortcut: unsafe extern "system" fn (this: *const nsIWindowsShellService, aPath: *const ::nsstring::nsAString, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* [implicit_jscontext] Promise hasPinnableShortcut (in AString aAUMID, in boolean aPrivateBrowsing); */
/// Unable to generate binding because `jscontext is unsupported`
pub HasPinnableShortcut: *const ::libc::c_void,
/* boolean canSetDefaultBrowserUserChoice (); */
pub CanSetDefaultBrowserUserChoice: unsafe extern "system" fn (this: *const nsIWindowsShellService, _retval: *mut bool) -> ::nserror::nsresult,
/* boolean checkAllProgIDsExist (); */
pub CheckAllProgIDsExist: unsafe extern "system" fn (this: *const nsIWindowsShellService, _retval: *mut bool) -> ::nserror::nsresult,
/* boolean checkBrowserUserChoiceHashes (); */
pub CheckBrowserUserChoiceHashes: unsafe extern "system" fn (this: *const nsIWindowsShellService, _retval: *mut bool) -> ::nserror::nsresult,
/* boolean isDefaultHandlerFor (in AString aFileExtensionOrProtocol); */
pub IsDefaultHandlerFor: unsafe extern "system" fn (this: *const nsIWindowsShellService, aFileExtensionOrProtocol: *const ::nsstring::nsAString, _retval: *mut bool) -> ::nserror::nsresult,
/* AString queryCurrentDefaultHandlerFor (in AString aFileExtensionOrProtocol); */
pub QueryCurrentDefaultHandlerFor: unsafe extern "system" fn (this: *const nsIWindowsShellService, aFileExtensionOrProtocol: *const ::nsstring::nsAString, _retval: *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 nsIWindowsShellService {
pub const LAUNCH_ON_LOGIN_DISABLED_BY_SETTINGS: u8 = 0;
pub const LAUNCH_ON_LOGIN_DISABLED: u8 = 1;
pub const LAUNCH_ON_LOGIN_ENABLED: u8 = 2;
pub const LAUNCH_ON_LOGIN_ENABLED_BY_POLICY: u8 = 3;
/// `[implicit_jscontext] Promise createShortcut (in nsIFile aBinary, in Array<AString> aArguments, in AString aDescription, in nsIFile aIconFile, in unsigned short aIconIndex, in AString aAppUserModelId, in AString aShortcutFolder, in AString aShortcutName);`
const _CreateShortcut: () = ();
/// `Array<AString> getLaunchOnLoginShortcuts ();`
#[inline]
pub unsafe fn GetLaunchOnLoginShortcuts(&self, _retval: *mut thin_vec::ThinVec<::nsstring::nsString>) -> ::nserror::nsresult {
((*self.vtable).GetLaunchOnLoginShortcuts)(self, _retval)
}
/// `[implicit_jscontext] Promise pinCurrentAppToStartMenuAsync (in boolean aCheckOnly);`
const _PinCurrentAppToStartMenuAsync: () = ();
/// `[implicit_jscontext] Promise isCurrentAppPinnedToStartMenuAsync ();`
const _IsCurrentAppPinnedToStartMenuAsync: () = ();
/// `[implicit_jscontext] Promise enableLaunchOnLoginMSIXAsync (in AString aTaskId);`
const _EnableLaunchOnLoginMSIXAsync: () = ();
/// `[implicit_jscontext] Promise disableLaunchOnLoginMSIXAsync (in AString aTaskId);`
const _DisableLaunchOnLoginMSIXAsync: () = ();
/// `[implicit_jscontext] Promise getLaunchOnLoginEnabledMSIXAsync (in AString aTaskId);`
const _GetLaunchOnLoginEnabledMSIXAsync: () = ();
/// `[implicit_jscontext] Promise pinCurrentAppToTaskbarAsync (in boolean aPrivateBrowsing);`
const _PinCurrentAppToTaskbarAsync: () = ();
/// `[implicit_jscontext] Promise checkPinCurrentAppToTaskbarAsync (in boolean aPrivateBrowsing);`
const _CheckPinCurrentAppToTaskbarAsync: () = ();
/// `[implicit_jscontext] Promise isCurrentAppPinnedToTaskbarAsync (in AString aumid);`
const _IsCurrentAppPinnedToTaskbarAsync: () = ();
/// `void pinShortcutToTaskbar (in AString aShortcutPath);`
#[inline]
pub unsafe fn PinShortcutToTaskbar(&self, aShortcutPath: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).PinShortcutToTaskbar)(self, aShortcutPath)
}
/// `void unpinShortcutFromTaskbar (in AString aShortcutPath);`
#[inline]
pub unsafe fn UnpinShortcutFromTaskbar(&self, aShortcutPath: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).UnpinShortcutFromTaskbar)(self, aShortcutPath)
}
/// ```text
/// /**
/// * Gets the full path of a taskbar tab shortcut.
/// *
/// * @param aShortcutName
/// * The name of the taskbar tab shortcut, excluding the file extension.
/// * @throws NS_ERROR_FAILURE
/// * If the user token cannot be found.
/// * @throws NS_ERROR_ABORT
/// * If converting the sid to a string fails.
/// *
/// * @return The full path of the taskbar tab shortcut
/// */
/// ```
///
/// `AString getTaskbarTabShortcutPath (in AString aShortcutName);`
#[inline]
pub unsafe fn GetTaskbarTabShortcutPath(&self, aShortcutName: *const ::nsstring::nsAString, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetTaskbarTabShortcutPath)(self, aShortcutName, _retval)
}
/// `Array<AString> getTaskbarTabPins ();`
#[inline]
pub unsafe fn GetTaskbarTabPins(&self, _retval: *mut thin_vec::ThinVec<::nsstring::nsString>) -> ::nserror::nsresult {
((*self.vtable).GetTaskbarTabPins)(self, _retval)
}
/// `AString classifyShortcut (in AString aPath);`
#[inline]
pub unsafe fn ClassifyShortcut(&self, aPath: *const ::nsstring::nsAString, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).ClassifyShortcut)(self, aPath, _retval)
}
/// `[implicit_jscontext] Promise hasPinnableShortcut (in AString aAUMID, in boolean aPrivateBrowsing);`
const _HasPinnableShortcut: () = ();
/// `boolean canSetDefaultBrowserUserChoice ();`
#[inline]
pub unsafe fn CanSetDefaultBrowserUserChoice(&self, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).CanSetDefaultBrowserUserChoice)(self, _retval)
}
/// `boolean checkAllProgIDsExist ();`
#[inline]
pub unsafe fn CheckAllProgIDsExist(&self, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).CheckAllProgIDsExist)(self, _retval)
}
/// `boolean checkBrowserUserChoiceHashes ();`
#[inline]
pub unsafe fn CheckBrowserUserChoiceHashes(&self, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).CheckBrowserUserChoiceHashes)(self, _retval)
}
/// `boolean isDefaultHandlerFor (in AString aFileExtensionOrProtocol);`
#[inline]
pub unsafe fn IsDefaultHandlerFor(&self, aFileExtensionOrProtocol: *const ::nsstring::nsAString, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).IsDefaultHandlerFor)(self, aFileExtensionOrProtocol, _retval)
}
/// `AString queryCurrentDefaultHandlerFor (in AString aFileExtensionOrProtocol);`
#[inline]
pub unsafe fn QueryCurrentDefaultHandlerFor(&self, aFileExtensionOrProtocol: *const ::nsstring::nsAString, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).QueryCurrentDefaultHandlerFor)(self, aFileExtensionOrProtocol, _retval)
}
}