Copy as Markdown

Other Tools

//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/widget/nsIJumpListBuilder.idl
//
/// `interface nsIJumpListBuilder : 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 nsIJumpListBuilder {
vtable: &'static nsIJumpListBuilderVTable,
/// 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 nsIJumpListBuilder.
unsafe impl XpCom for nsIJumpListBuilder {
const IID: nsIID = nsID(0x5769f08d, 0x0303, 0x4e38,
[0x8f, 0xe6, 0x86, 0xb5, 0x47, 0x30, 0x22, 0xf6]);
}
// 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 nsIJumpListBuilder {
#[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 nsIJumpListBuilder.
// 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 nsIJumpListBuilderCoerce {
/// Cheaply cast a value of this type from a `nsIJumpListBuilder`.
fn coerce_from(v: &nsIJumpListBuilder) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIJumpListBuilderCoerce for nsIJumpListBuilder {
#[inline]
fn coerce_from(v: &nsIJumpListBuilder) -> &Self {
v
}
}
impl nsIJumpListBuilder {
/// Cast this `nsIJumpListBuilder` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIJumpListBuilderCoerce>(&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 nsIJumpListBuilder {
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> nsIJumpListBuilderCoerce for T {
#[inline]
fn coerce_from(v: &nsIJumpListBuilder) -> &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 nsIJumpListBuilder
// 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 nsIJumpListBuilderVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* AString obtainAndCacheFavicon (in nsIURI faviconURL); */
pub ObtainAndCacheFavicon: unsafe extern "system" fn (this: *const nsIJumpListBuilder, faviconURL: *const nsIURI, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* [implicit_jscontext] Promise isAvailable (); */
/// Unable to generate binding because `jscontext is unsupported`
pub IsAvailable: *const ::libc::c_void,
/* [implicit_jscontext] Promise checkForRemovals (); */
/// Unable to generate binding because `jscontext is unsupported`
pub CheckForRemovals: *const ::libc::c_void,
/* [implicit_jscontext] Promise populateJumpList (in Array<jsval> aTaskDescriptions, in AString aCustomTitle, in Array<jsval> aCustomDescriptions); */
/// Unable to generate binding because `special type jsval unsupported`
pub PopulateJumpList: *const ::libc::c_void,
/* [implicit_jscontext] Promise clearJumpList (); */
/// Unable to generate binding because `jscontext is unsupported`
pub ClearJumpList: *const ::libc::c_void,
}
// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsIJumpListBuilder {
/// ```text
/// /**
/// * Returns the local filesystem path for a favicon for a page hosted at
/// * faviconURL if we happen to have written one to disk before. If we have not,
/// * then a background thread retrieves the favicon and will write it to disk
/// * and NS_ERROR_NOT_AVAILABLE will be thrown.
/// *
/// * @param {nsIURI} faviconURL
/// * The URL for the web page for which we would like a filesystem path for
/// * the favicon.
/// * @returns {AString}
/// * The local filesystem path for the favicon if it has been cached before.
/// * If it has not been cached before, this method will throw
/// * NS_ERROR_NOT_AVAILABLE.
/// * @throws NS_ERROR_NOT_AVAILABLE
/// * In the event that the favicon has never been cached to disk before.
/// */
/// ```
///
/// `AString obtainAndCacheFavicon (in nsIURI faviconURL);`
#[inline]
pub unsafe fn ObtainAndCacheFavicon(&self, faviconURL: *const nsIURI, _retval: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).ObtainAndCacheFavicon)(self, faviconURL, _retval)
}
/// ```text
/// /**
/// * Returns a Promise that resolves with whether or not the Jump List backend
/// * on the background thread is up and running.
/// *
/// * @returns {Promise<boolean>}
/// * Resolves to true if the backend is ready to accept
/// * WindowsJumpListShortcutDescriptions. False, otherwise.
/// * @throws NS_ERROR_FAILURE
/// * If an attempt to communicate with the background thread fails.
/// */
/// ```
///
/// `[implicit_jscontext] Promise isAvailable ();`
const _IsAvailable: () = ();
/// ```text
/// /**
/// * Asks the Windows Jump List API for any items that might have been removed
/// * by the user from the Jump List UI.
/// *
/// * Important: This should be called prior to any attempt to call
/// * `populateJumpList` to ensure that any passed in
/// * WindowsJumpListShortcutDescriptions do not describe items that the user has
/// * just removed. Failing to do so will cause the Promise returned from
/// * `populateJumpList` to reject. This is a constraint of the underlying win32
/// * API. Please see
/// * for more details.
/// *
/// * @returns {Promise<string[], nsresult>}
/// * On success, will return an array of strings for URLs of history that
/// * have been removed by the user via the Windows Jump List. These items will
/// * also have had their cached favicons removed from the disk off of the
/// * main thread. On failure, this will reject with the nsresult failure code.
/// * @throws NS_ERROR_FAILURE
/// * If an attempt to communicate with the background thread fails.
/// */
/// ```
///
/// `[implicit_jscontext] Promise checkForRemovals ();`
const _CheckForRemovals: () = ();
/// ```text
/// /**
/// * Writes a new set of items to the Windows Jump List. This occurs
/// * asynchronously, off of the main thread.
/// *
/// * Important: Callers should first call `checkForRemovals` to remove any
/// * browsing history items that the user chose to remove in the Jump List
/// * Only then should any WindowsJumpListShortcutDescriptions be created
/// * and passed to this method. Any attempt to add
/// * WindowsJumpListShortcutDescriptions matching items that have been removed
/// * by the user will result in the returned Promise rejecting. This is a
/// * constraint of the underlying win32 API. Please see
/// * for more details.
/// *
/// * @param {WindowsJumpListShortcutDescription[]} aTaskDescriptions
/// * 0 or more WindowsJumpListShortcutDescriptions to place items within the
/// * "tasks" section of the Jump List.
/// * @param {AString} aCustomTitle
/// * An optional title for a custom sub-list within the Jump List that will be
/// * populated via aCustomDescriptions. This must be supplied if
/// * aCustomDescriptions is not empty.
/// * @param {WindowsJumpListShortcutDescription[]} aCustomDescriptions
/// * 0 or more WindowsJumpListShortcutDescriptions to place items within the
/// * custom section of the Jump List. aCustomTitle must be supplied if this
/// * array is non-empty.
/// * @returns {Promise<undefined, nsresult>}
/// * Returns a Promise that resolves if the Jump List was properly written
/// * to, and rejects otherwise with the nsresult of the failure.
/// * @throws NS_ERROR_INVALID_ARG
/// * If any of the passed arguments do not meet the requirements set out
/// * above.
/// * @throws NS_ERROR_FAILURE
/// * If an attempt to communicate with the background thread fails.
/// */
/// ```
///
/// `[implicit_jscontext] Promise populateJumpList (in Array<jsval> aTaskDescriptions, in AString aCustomTitle, in Array<jsval> aCustomDescriptions);`
const _PopulateJumpList: () = ();
/// ```text
/// /**
/// * Removes all items from the Jump List.
/// *
/// * @returns {Promise<undefined, nsresult>}
/// * Resolves with undefined on successfully clearing the Jump List. If it
/// * fails to do so, it will reject with the failure code.
/// * @throws NS_ERROR_FAILURE
/// * If an attempt to communicate with the background thread fails.
/// */
/// ```
///
/// `[implicit_jscontext] Promise clearJumpList ();`
const _ClearJumpList: () = ();
}