Copy as Markdown

Other Tools

//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/toolkit/mozapps/defaultagent/nsIDefaultAgent.idl
//
/// `interface nsIDefaultAgent : 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 nsIDefaultAgent {
vtable: &'static nsIDefaultAgentVTable,
/// 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
// 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 nsIDefaultAgent.
unsafe impl XpCom for nsIDefaultAgent {
const IID: nsIID = nsID(0xedc38cb5, 0xb6f6, 0x4aeb,
[0xbd, 0x45, 0x7b, 0xe8, 0xe0, 0x0f, 0xc3, 0x64]);
}
// 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 nsIDefaultAgent {
#[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 nsIDefaultAgent.
// 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 nsIDefaultAgentCoerce {
/// Cheaply cast a value of this type from a `nsIDefaultAgent`.
fn coerce_from(v: &nsIDefaultAgent) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIDefaultAgentCoerce for nsIDefaultAgent {
#[inline]
fn coerce_from(v: &nsIDefaultAgent) -> &Self {
v
}
}
impl nsIDefaultAgent {
/// Cast this `nsIDefaultAgent` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIDefaultAgentCoerce>(&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 nsIDefaultAgent {
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> nsIDefaultAgentCoerce for T {
#[inline]
fn coerce_from(v: &nsIDefaultAgent) -> &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 nsIDefaultAgent
// 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 nsIDefaultAgentVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void registerTask (in AString aUniqueToken); */
pub RegisterTask: unsafe extern "system" fn (this: *const nsIDefaultAgent, aUniqueToken: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* void updateTask (in AString aUniqueToken); */
pub UpdateTask: unsafe extern "system" fn (this: *const nsIDefaultAgent, aUniqueToken: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* void unregisterTask (in AString aUniqueToken); */
pub UnregisterTask: unsafe extern "system" fn (this: *const nsIDefaultAgent, aUniqueToken: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* void uninstall (in AString aUniqueToken); */
pub Uninstall: unsafe extern "system" fn (this: *const nsIDefaultAgent, aUniqueToken: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* boolean appRanRecently (); */
pub AppRanRecently: unsafe extern "system" fn (this: *const nsIDefaultAgent, _retval: *mut bool) -> ::nserror::nsresult,
/* AString getDefaultBrowser (); */
pub GetDefaultBrowser: unsafe extern "system" fn (this: *const nsIDefaultAgent, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* AString getReplacePreviousDefaultBrowser (in AString aCurrentBrowser); */
pub GetReplacePreviousDefaultBrowser: unsafe extern "system" fn (this: *const nsIDefaultAgent, aCurrentBrowser: *const ::nsstring::nsAString, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* AString getDefaultPdfHandler (); */
pub GetDefaultPdfHandler: unsafe extern "system" fn (this: *const nsIDefaultAgent, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* void sendPing (in AString aCurrentBrowser, in AString aPreviousBrowser, in AString aPdfHandler, in AString aNotificationShown, in AString aNotificationAction); */
pub SendPing: unsafe extern "system" fn (this: *const nsIDefaultAgent, aCurrentBrowser: *const ::nsstring::nsAString, aPreviousBrowser: *const ::nsstring::nsAString, aPdfHandler: *const ::nsstring::nsAString, aNotificationShown: *const ::nsstring::nsAString, aNotificationAction: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* void setDefaultBrowserUserChoice (in AString aAumid, in Array<AString> aExtraFileExtensions); */
pub SetDefaultBrowserUserChoice: unsafe extern "system" fn (this: *const nsIDefaultAgent, aAumid: *const ::nsstring::nsAString, aExtraFileExtensions: *const thin_vec::ThinVec<::nsstring::nsString>) -> ::nserror::nsresult,
/* [implicit_jscontext] Promise setDefaultBrowserUserChoiceAsync (in AString aAumid, in Array<AString> aExtraFileExtensions); */
/// Unable to generate binding because `jscontext is unsupported`
pub SetDefaultBrowserUserChoiceAsync: *const ::libc::c_void,
/* void setDefaultExtensionHandlersUserChoice (in AString aAumid, in Array<AString> aFileExtensions); */
pub SetDefaultExtensionHandlersUserChoice: unsafe extern "system" fn (this: *const nsIDefaultAgent, aAumid: *const ::nsstring::nsAString, aFileExtensions: *const thin_vec::ThinVec<::nsstring::nsString>) -> ::nserror::nsresult,
/* boolean agentDisabled (); */
pub AgentDisabled: unsafe extern "system" fn (this: *const nsIDefaultAgent, _retval: *mut bool) -> ::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 nsIDefaultAgent {
/// ```text
/// /**
/// * Create a Windows scheduled task that will launch this binary with the
/// * do-task command every 24 hours, starting from 24 hours after register-task
/// * is run.
/// *
/// * @param {AString} aUniqueToken
/// * A unique identifier for this installation; typically the install path
/// * hash that's used for the update directory, the AppUserModelID, and
/// * other related purposes.
/// */
/// ```
///
/// `void registerTask (in AString aUniqueToken);`
#[inline]
pub unsafe fn RegisterTask(&self, aUniqueToken: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).RegisterTask)(self, aUniqueToken)
}
/// ```text
/// /**
/// * Update an existing task registration, without changing its schedule. This
/// * should be called during updates of the application, in case this program
/// * has been updated and any of the task parameters have changed.
/// *
/// * @param {AString} aUniqueToken
/// * A unique identifier for this installation; the same one provided when
/// * the task was registered.
/// */
/// ```
///
/// `void updateTask (in AString aUniqueToken);`
#[inline]
pub unsafe fn UpdateTask(&self, aUniqueToken: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).UpdateTask)(self, aUniqueToken)
}
/// ```text
/// /**
/// * Removes the previously created task. The unique token argument is required
/// * and should be the same one that was passed in when the task was registered.
/// *
/// * @param {AString} aUniqueToken
/// * A unique identifier for this installation; the same one provided when
/// * the task was registered.
/// */
/// ```
///
/// `void unregisterTask (in AString aUniqueToken);`
#[inline]
pub unsafe fn UnregisterTask(&self, aUniqueToken: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).UnregisterTask)(self, aUniqueToken)
}
/// ```text
/// /**
/// * Removes the previously created task, and also removes all registry entries
/// * running the task may have created.
/// *
/// * @param {AString} aUniqueToken
/// * A unique identifier for this installation; the same one provided when
/// * the task was registered.
/// */
/// ```
///
/// `void uninstall (in AString aUniqueToken);`
#[inline]
pub unsafe fn Uninstall(&self, aUniqueToken: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).Uninstall)(self, aUniqueToken)
}
/// ```text
/// /**
/// * Checks that the main app ran recently.
/// *
/// * @return {boolean} true if the app ran recently.
/// */
/// ```
///
/// `boolean appRanRecently ();`
#[inline]
pub unsafe fn AppRanRecently(&self, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).AppRanRecently)(self, _retval)
}
/// ```text
/// /**
/// * Returns a string for the default browser if known, binned to known browsers.
/// *
/// * @return {AString}
/// * The current default browser.
/// */
/// ```
///
/// `AString getDefaultBrowser ();`
#[inline]
pub unsafe fn GetDefaultBrowser(&self, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetDefaultBrowser)(self, _retval)
}
/// ```text
/// /**
/// * Gets and replaces the previously found default browser from the registry.
/// *
/// * @param {AString} aCurrentBrowser
/// * The current known browser to save to the registry.
/// * @return {AString}
/// * The previous known browser from the registry.
/// */
/// ```
///
/// `AString getReplacePreviousDefaultBrowser (in AString aCurrentBrowser);`
#[inline]
pub unsafe fn GetReplacePreviousDefaultBrowser(&self, aCurrentBrowser: *const ::nsstring::nsAString, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetReplacePreviousDefaultBrowser)(self, aCurrentBrowser, _retval)
}
/// ```text
/// /**
/// * Returns a string for the default PDF handler if known, binned to known
/// * PDF handlers.
/// *
/// * @return {AString}
/// * The previous default PDF handler.
/// */
/// ```
///
/// `AString getDefaultPdfHandler ();`
#[inline]
pub unsafe fn GetDefaultPdfHandler(&self, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetDefaultPdfHandler)(self, _retval)
}
/// ```text
/// /**
/// * Sends a Default Agent telemetry ping.
/// *
/// * @param {AString} aCurrentBrowser
/// * The current known browser.
/// * @param {AString} aPreviousBrowser
/// * The previous known browser.
/// * @param {AString} aPdfHandler
/// * The current known PDF handler.
/// * @param {AString} aNotificationShown
/// * If the notification was or wasn't shown. See
/// * `toolkit/mozapps/defaultagent/Notification.h` for valid values.
/// * @param {AString} aNotificationAction
/// * The notification action taken by the user. See
/// * `toolkit/mozapps/defaultagent/Notification.h` for valid values.
/// *
/// */
/// ```
///
/// `void sendPing (in AString aCurrentBrowser, in AString aPreviousBrowser, in AString aPdfHandler, in AString aNotificationShown, in AString aNotificationAction);`
#[inline]
pub unsafe fn SendPing(&self, aCurrentBrowser: *const ::nsstring::nsAString, aPreviousBrowser: *const ::nsstring::nsAString, aPdfHandler: *const ::nsstring::nsAString, aNotificationShown: *const ::nsstring::nsAString, aNotificationAction: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).SendPing)(self, aCurrentBrowser, aPreviousBrowser, aPdfHandler, aNotificationShown, aNotificationAction)
}
/// ```text
/// /**
/// * Set the default browser and optionally additional file extensions via the
/// * UserChoice registry keys.
/// *
/// * @param {AString} aAumid
/// * Suffix to be appended to ProgIDs when registering system defaults.
/// * @param {Array<AString>} aExtraFileExtensions
/// * Additional optional file extensions to register specified as argument
/// * pairs: the first element is the file extension, the second element is
/// * the root of a ProgID, which will be suffixed with `-{aAumid}`.
/// */
/// ```
///
/// `void setDefaultBrowserUserChoice (in AString aAumid, in Array<AString> aExtraFileExtensions);`
#[inline]
pub unsafe fn SetDefaultBrowserUserChoice(&self, aAumid: *const ::nsstring::nsAString, aExtraFileExtensions: *const thin_vec::ThinVec<::nsstring::nsString>) -> ::nserror::nsresult {
((*self.vtable).SetDefaultBrowserUserChoice)(self, aAumid, aExtraFileExtensions)
}
/// ```text
/// /**
/// * Set the default browser and optionally additional file extensions via the
/// * UserChoice registry keys, asynchronously. Does the actual work on a
/// * background thread.
/// *
/// * @param {AString} aAumid
/// * Suffix to be appended to ProgIDs when registering system defaults.
/// * @param {Array<AString>} aExtraFileExtensions
/// * Additional optional file extensions to register specified as argument
/// * pairs: the first element is the file extension, the second element is
/// * the root of a ProgID, which will be suffixed with `-{aAumid}`.
/// */
/// ```
///
/// `[implicit_jscontext] Promise setDefaultBrowserUserChoiceAsync (in AString aAumid, in Array<AString> aExtraFileExtensions);`
const _SetDefaultBrowserUserChoiceAsync: () = ();
/// ```text
/// /**
/// * Sets file extensions via the UserChoice registry keys.
/// *
/// * @param {AString} aAumid
/// * Suffix to be appended to ProgIDs when registering system defaults.
/// * @param {Array<AString>} aExtraFileExtensions
/// * File extensions to register specified as argument pairs: the first
/// * element is the file extension, the second element is the root of a
/// * ProgID, which will be suffixed with `-{aAumid}`.
/// */
/// ```
///
/// `void setDefaultExtensionHandlersUserChoice (in AString aAumid, in Array<AString> aFileExtensions);`
#[inline]
pub unsafe fn SetDefaultExtensionHandlersUserChoice(&self, aAumid: *const ::nsstring::nsAString, aFileExtensions: *const thin_vec::ThinVec<::nsstring::nsString>) -> ::nserror::nsresult {
((*self.vtable).SetDefaultExtensionHandlersUserChoice)(self, aAumid, aFileExtensions)
}
/// ```text
/// /**
/// * Checks if the default agent has been disabled.
/// *
/// * @return {boolean} true if the default agent is disabled.
/// */
/// ```
///
/// `boolean agentDisabled ();`
#[inline]
pub unsafe fn AgentDisabled(&self, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).AgentDisabled)(self, _retval)
}
}