Copy as Markdown

Other Tools

//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/toolkit/components/contentanalysis/nsIContentAnalysis.idl
//
/// `interface nsIContentAnalysisAcknowledgement : 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 nsIContentAnalysisAcknowledgement {
vtable: &'static nsIContentAnalysisAcknowledgementVTable,
/// 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 nsIContentAnalysisAcknowledgement.
unsafe impl XpCom for nsIContentAnalysisAcknowledgement {
const IID: nsIID = nsID(0x06e6a60f, 0x3a2b, 0x41fa,
[0xa6, 0x3b, 0xfe, 0xa7, 0xa7, 0xf7, 0x16, 0x49]);
}
// 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 nsIContentAnalysisAcknowledgement {
#[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 nsIContentAnalysisAcknowledgement.
// 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 nsIContentAnalysisAcknowledgementCoerce {
/// Cheaply cast a value of this type from a `nsIContentAnalysisAcknowledgement`.
fn coerce_from(v: &nsIContentAnalysisAcknowledgement) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIContentAnalysisAcknowledgementCoerce for nsIContentAnalysisAcknowledgement {
#[inline]
fn coerce_from(v: &nsIContentAnalysisAcknowledgement) -> &Self {
v
}
}
impl nsIContentAnalysisAcknowledgement {
/// Cast this `nsIContentAnalysisAcknowledgement` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIContentAnalysisAcknowledgementCoerce>(&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 nsIContentAnalysisAcknowledgement {
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> nsIContentAnalysisAcknowledgementCoerce for T {
#[inline]
fn coerce_from(v: &nsIContentAnalysisAcknowledgement) -> &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 nsIContentAnalysisAcknowledgement
// 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 nsIContentAnalysisAcknowledgementVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute nsIContentAnalysisAcknowledgement_Result result; */
pub GetResult: unsafe extern "system" fn (this: *const nsIContentAnalysisAcknowledgement, aResult: *mut u32) -> ::nserror::nsresult,
/* readonly attribute nsIContentAnalysisAcknowledgement_FinalAction finalAction; */
pub GetFinalAction: unsafe extern "system" fn (this: *const nsIContentAnalysisAcknowledgement, aFinalAction: *mut u32) -> ::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 nsIContentAnalysisAcknowledgement {
pub const eSuccess: u32 = 1;
pub const eInvalidResponse: u32 = 2;
pub const eTooLate: u32 = 3;
pub const eUnspecified: u32 = 0;
pub const eAllow: u32 = 1;
pub const eReportOnly: u32 = 2;
pub const eWarn: u32 = 3;
pub const eBlock: u32 = 4;
/// `readonly attribute nsIContentAnalysisAcknowledgement_Result result;`
#[inline]
pub unsafe fn GetResult(&self, aResult: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetResult)(self, aResult)
}
/// `readonly attribute nsIContentAnalysisAcknowledgement_FinalAction finalAction;`
#[inline]
pub unsafe fn GetFinalAction(&self, aFinalAction: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetFinalAction)(self, aFinalAction)
}
}
/// `interface nsIContentAnalysisResponse : 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 nsIContentAnalysisResponse {
vtable: &'static nsIContentAnalysisResponseVTable,
/// 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 nsIContentAnalysisResponse.
unsafe impl XpCom for nsIContentAnalysisResponse {
const IID: nsIID = nsID(0x89088c61, 0x15f6, 0x4ace,
[0xa8, 0x80, 0xa1, 0xb5, 0xea, 0x47, 0xca, 0x66]);
}
// 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 nsIContentAnalysisResponse {
#[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 nsIContentAnalysisResponse.
// 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 nsIContentAnalysisResponseCoerce {
/// Cheaply cast a value of this type from a `nsIContentAnalysisResponse`.
fn coerce_from(v: &nsIContentAnalysisResponse) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIContentAnalysisResponseCoerce for nsIContentAnalysisResponse {
#[inline]
fn coerce_from(v: &nsIContentAnalysisResponse) -> &Self {
v
}
}
impl nsIContentAnalysisResponse {
/// Cast this `nsIContentAnalysisResponse` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIContentAnalysisResponseCoerce>(&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 nsIContentAnalysisResponse {
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> nsIContentAnalysisResponseCoerce for T {
#[inline]
fn coerce_from(v: &nsIContentAnalysisResponse) -> &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 nsIContentAnalysisResponse
// 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 nsIContentAnalysisResponseVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute nsIContentAnalysisResponse_Action action; */
pub GetAction: unsafe extern "system" fn (this: *const nsIContentAnalysisResponse, aAction: *mut u32) -> ::nserror::nsresult,
/* readonly attribute boolean shouldAllowContent; */
pub GetShouldAllowContent: unsafe extern "system" fn (this: *const nsIContentAnalysisResponse, aShouldAllowContent: *mut bool) -> ::nserror::nsresult,
/* readonly attribute nsIContentAnalysisResponse_CancelError cancelError; */
pub GetCancelError: unsafe extern "system" fn (this: *const nsIContentAnalysisResponse, aCancelError: *mut u32) -> ::nserror::nsresult,
/* readonly attribute ACString requestToken; */
pub GetRequestToken: unsafe extern "system" fn (this: *const nsIContentAnalysisResponse, aRequestToken: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* void acknowledge (in nsIContentAnalysisAcknowledgement aCaa); */
pub Acknowledge: unsafe extern "system" fn (this: *const nsIContentAnalysisResponse, aCaa: *const nsIContentAnalysisAcknowledgement) -> ::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 nsIContentAnalysisResponse {
pub const eUnspecified: u32 = 0;
pub const eReportOnly: u32 = 1;
pub const eWarn: u32 = 2;
pub const eBlock: u32 = 3;
pub const eAllow: u32 = 1000;
pub const eCanceled: u32 = 1001;
pub const eUserInitiated: u32 = 0;
pub const eNoAgent: u32 = 1;
pub const eInvalidAgentSignature: u32 = 2;
pub const eErrorOther: u32 = 3;
/// `readonly attribute nsIContentAnalysisResponse_Action action;`
#[inline]
pub unsafe fn GetAction(&self, aAction: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetAction)(self, aAction)
}
/// `readonly attribute boolean shouldAllowContent;`
#[inline]
pub unsafe fn GetShouldAllowContent(&self, aShouldAllowContent: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetShouldAllowContent)(self, aShouldAllowContent)
}
/// `readonly attribute nsIContentAnalysisResponse_CancelError cancelError;`
#[inline]
pub unsafe fn GetCancelError(&self, aCancelError: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetCancelError)(self, aCancelError)
}
/// `readonly attribute ACString requestToken;`
#[inline]
pub unsafe fn GetRequestToken(&self, aRequestToken: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetRequestToken)(self, aRequestToken)
}
/// ```text
/// /**
/// * Acknowledge receipt of an analysis response.
/// * If false is passed for aAutoAcknowledge to AnalyzeContentRequest,
/// * the caller is responsible for calling this after successful
/// * resolution of the promise.
/// */
/// ```
///
/// `void acknowledge (in nsIContentAnalysisAcknowledgement aCaa);`
#[inline]
pub unsafe fn Acknowledge(&self, aCaa: *const nsIContentAnalysisAcknowledgement) -> ::nserror::nsresult {
((*self.vtable).Acknowledge)(self, aCaa)
}
}
/// `interface nsIClientDownloadResource : 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 nsIClientDownloadResource {
vtable: &'static nsIClientDownloadResourceVTable,
/// 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 nsIClientDownloadResource.
unsafe impl XpCom for nsIClientDownloadResource {
const IID: nsIID = nsID(0x48d31df1, 0x204d, 0x42ce,
[0xa5, 0x7f, 0xf1, 0x56, 0xbb, 0x87, 0x0d, 0x89]);
}
// 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 nsIClientDownloadResource {
#[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 nsIClientDownloadResource.
// 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 nsIClientDownloadResourceCoerce {
/// Cheaply cast a value of this type from a `nsIClientDownloadResource`.
fn coerce_from(v: &nsIClientDownloadResource) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIClientDownloadResourceCoerce for nsIClientDownloadResource {
#[inline]
fn coerce_from(v: &nsIClientDownloadResource) -> &Self {
v
}
}
impl nsIClientDownloadResource {
/// Cast this `nsIClientDownloadResource` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIClientDownloadResourceCoerce>(&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 nsIClientDownloadResource {
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> nsIClientDownloadResourceCoerce for T {
#[inline]
fn coerce_from(v: &nsIClientDownloadResource) -> &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 nsIClientDownloadResource
// 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 nsIClientDownloadResourceVTable {
/// 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 url; */
pub GetUrl: unsafe extern "system" fn (this: *const nsIClientDownloadResource, aUrl: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute unsigned long type; */
pub GetType: unsafe extern "system" fn (this: *const nsIClientDownloadResource, aType: *mut u32) -> ::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 nsIClientDownloadResource {
pub const DOWNLOAD_URL: u32 = 0;
pub const DOWNLOAD_REDIRECT: u32 = 1;
pub const TAB_URL: u32 = 2;
pub const TAB_REDIRECT: u32 = 3;
pub const PPAPI_DOCUMENT: u32 = 4;
pub const PPAPI_PLUGIN: u32 = 5;
/// `readonly attribute AString url;`
#[inline]
pub unsafe fn GetUrl(&self, aUrl: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetUrl)(self, aUrl)
}
/// `readonly attribute unsigned long type;`
#[inline]
pub unsafe fn GetType(&self, aType: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetType)(self, aType)
}
}
/// `interface nsIContentAnalysisRequest : nsISupports`
///
/// ```text
/// /**
/// * A nsIContentAnalysisRequest represents a request that the browser
/// * consult any required content analysis resources (like external data-loss
/// * prevention applications) to determine if the attempted operation should
/// * be permitted to complete.
/// */
/// ```
///
// 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 nsIContentAnalysisRequest {
vtable: &'static nsIContentAnalysisRequestVTable,
/// 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 nsIContentAnalysisRequest.
unsafe impl XpCom for nsIContentAnalysisRequest {
const IID: nsIID = nsID(0xc11a6636, 0xda2a, 0x4afc,
[0xbd, 0xd1, 0x0b, 0xca, 0xe2, 0x31, 0x0e, 0x6d]);
}
// 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 nsIContentAnalysisRequest {
#[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 nsIContentAnalysisRequest.
// 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 nsIContentAnalysisRequestCoerce {
/// Cheaply cast a value of this type from a `nsIContentAnalysisRequest`.
fn coerce_from(v: &nsIContentAnalysisRequest) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIContentAnalysisRequestCoerce for nsIContentAnalysisRequest {
#[inline]
fn coerce_from(v: &nsIContentAnalysisRequest) -> &Self {
v
}
}
impl nsIContentAnalysisRequest {
/// Cast this `nsIContentAnalysisRequest` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIContentAnalysisRequestCoerce>(&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 nsIContentAnalysisRequest {
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> nsIContentAnalysisRequestCoerce for T {
#[inline]
fn coerce_from(v: &nsIContentAnalysisRequest) -> &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 nsIContentAnalysisRequest
// 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 nsIContentAnalysisRequestVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute nsIContentAnalysisRequest_AnalysisType analysisType; */
pub GetAnalysisType: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aAnalysisType: *mut u32) -> ::nserror::nsresult,
/* readonly attribute nsIContentAnalysisRequest_OperationType operationTypeForDisplay; */
pub GetOperationTypeForDisplay: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aOperationTypeForDisplay: *mut u32) -> ::nserror::nsresult,
/* readonly attribute AString operationDisplayString; */
pub GetOperationDisplayString: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aOperationDisplayString: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AString textContent; */
pub GetTextContent: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aTextContent: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AString filePath; */
pub GetFilePath: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aFilePath: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute unsigned long long printDataHandle; */
pub GetPrintDataHandle: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aPrintDataHandle: *mut u64) -> ::nserror::nsresult,
/* readonly attribute unsigned long long printDataSize; */
pub GetPrintDataSize: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aPrintDataSize: *mut u64) -> ::nserror::nsresult,
/* readonly attribute AString printerName; */
pub GetPrinterName: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aPrinterName: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute nsIURI url; */
pub GetUrl: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aUrl: *mut*const nsIURI) -> ::nserror::nsresult,
/* readonly attribute ACString sha256Digest; */
pub GetSha256Digest: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aSha256Digest: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* readonly attribute Array<nsIClientDownloadResource> resources; */
pub GetResources: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aResources: *mut thin_vec::ThinVec<Option<RefPtr<nsIClientDownloadResource>>>) -> ::nserror::nsresult,
/* readonly attribute AString email; */
pub GetEmail: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aEmail: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute ACString requestToken; */
pub GetRequestToken: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aRequestToken: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* readonly attribute WindowGlobalParent windowGlobalParent; */
pub GetWindowGlobalParent: unsafe extern "system" fn (this: *const nsIContentAnalysisRequest, aWindowGlobalParent: *mut *const libc::c_void) -> ::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 nsIContentAnalysisRequest {
pub const eUnspecified: u32 = 0;
pub const eFileDownloaded: u32 = 1;
pub const eFileAttached: u32 = 2;
pub const eBulkDataEntry: u32 = 3;
pub const ePrint: u32 = 4;
pub const eFileTransfer: u32 = 5;
pub const eCustomDisplayString: u32 = 0;
pub const eClipboard: u32 = 1;
pub const eDroppedText: u32 = 2;
pub const eOperationPrint: u32 = 3;
/// `readonly attribute nsIContentAnalysisRequest_AnalysisType analysisType;`
#[inline]
pub unsafe fn GetAnalysisType(&self, aAnalysisType: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetAnalysisType)(self, aAnalysisType)
}
/// `readonly attribute nsIContentAnalysisRequest_OperationType operationTypeForDisplay;`
#[inline]
pub unsafe fn GetOperationTypeForDisplay(&self, aOperationTypeForDisplay: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetOperationTypeForDisplay)(self, aOperationTypeForDisplay)
}
/// `readonly attribute AString operationDisplayString;`
#[inline]
pub unsafe fn GetOperationDisplayString(&self, aOperationDisplayString: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetOperationDisplayString)(self, aOperationDisplayString)
}
/// `readonly attribute AString textContent;`
#[inline]
pub unsafe fn GetTextContent(&self, aTextContent: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetTextContent)(self, aTextContent)
}
/// `readonly attribute AString filePath;`
#[inline]
pub unsafe fn GetFilePath(&self, aFilePath: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetFilePath)(self, aFilePath)
}
/// `readonly attribute unsigned long long printDataHandle;`
#[inline]
pub unsafe fn GetPrintDataHandle(&self, aPrintDataHandle: *mut u64) -> ::nserror::nsresult {
((*self.vtable).GetPrintDataHandle)(self, aPrintDataHandle)
}
/// `readonly attribute unsigned long long printDataSize;`
#[inline]
pub unsafe fn GetPrintDataSize(&self, aPrintDataSize: *mut u64) -> ::nserror::nsresult {
((*self.vtable).GetPrintDataSize)(self, aPrintDataSize)
}
/// `readonly attribute AString printerName;`
#[inline]
pub unsafe fn GetPrinterName(&self, aPrinterName: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetPrinterName)(self, aPrinterName)
}
/// `readonly attribute nsIURI url;`
#[inline]
pub unsafe fn GetUrl(&self, aUrl: *mut*const nsIURI) -> ::nserror::nsresult {
((*self.vtable).GetUrl)(self, aUrl)
}
/// `readonly attribute ACString sha256Digest;`
#[inline]
pub unsafe fn GetSha256Digest(&self, aSha256Digest: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetSha256Digest)(self, aSha256Digest)
}
/// `readonly attribute Array<nsIClientDownloadResource> resources;`
#[inline]
pub unsafe fn GetResources(&self, aResources: *mut thin_vec::ThinVec<Option<RefPtr<nsIClientDownloadResource>>>) -> ::nserror::nsresult {
((*self.vtable).GetResources)(self, aResources)
}
/// `readonly attribute AString email;`
#[inline]
pub unsafe fn GetEmail(&self, aEmail: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetEmail)(self, aEmail)
}
/// `readonly attribute ACString requestToken;`
#[inline]
pub unsafe fn GetRequestToken(&self, aRequestToken: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetRequestToken)(self, aRequestToken)
}
/// `readonly attribute WindowGlobalParent windowGlobalParent;`
#[inline]
pub unsafe fn GetWindowGlobalParent(&self, aWindowGlobalParent: *mut *const libc::c_void) -> ::nserror::nsresult {
((*self.vtable).GetWindowGlobalParent)(self, aWindowGlobalParent)
}
}
/// `interface nsIContentAnalysisResult : 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 nsIContentAnalysisResult {
vtable: &'static nsIContentAnalysisResultVTable,
/// 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 nsIContentAnalysisResult.
unsafe impl XpCom for nsIContentAnalysisResult {
const IID: nsIID = nsID(0x9679545f, 0x4256, 0x4c90,
[0x96, 0x54, 0x90, 0x29, 0x2c, 0x35, 0x5d, 0x25]);
}
// 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 nsIContentAnalysisResult {
#[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 nsIContentAnalysisResult.
// 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 nsIContentAnalysisResultCoerce {
/// Cheaply cast a value of this type from a `nsIContentAnalysisResult`.
fn coerce_from(v: &nsIContentAnalysisResult) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIContentAnalysisResultCoerce for nsIContentAnalysisResult {
#[inline]
fn coerce_from(v: &nsIContentAnalysisResult) -> &Self {
v
}
}
impl nsIContentAnalysisResult {
/// Cast this `nsIContentAnalysisResult` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIContentAnalysisResultCoerce>(&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 nsIContentAnalysisResult {
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> nsIContentAnalysisResultCoerce for T {
#[inline]
fn coerce_from(v: &nsIContentAnalysisResult) -> &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 nsIContentAnalysisResult
// 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 nsIContentAnalysisResultVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* [infallible] readonly attribute boolean shouldAllowContent; */
pub GetShouldAllowContent: unsafe extern "system" fn (this: *const nsIContentAnalysisResult, aShouldAllowContent: *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 nsIContentAnalysisResult {
/// `[infallible] readonly attribute boolean shouldAllowContent;`
#[inline]
pub unsafe fn GetShouldAllowContent(&self) -> bool {
let mut result = <bool as ::std::default::Default>::default();
let _rv = ((*self.vtable).GetShouldAllowContent)(self, &mut result);
debug_assert!(_rv.succeeded());
result
}
}
/// `interface nsIContentAnalysisCallback : 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 nsIContentAnalysisCallback {
vtable: &'static nsIContentAnalysisCallbackVTable,
/// 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 nsIContentAnalysisCallback.
unsafe impl XpCom for nsIContentAnalysisCallback {
const IID: nsIID = nsID(0xcb09fc88, 0x118c, 0x411b,
[0xaa, 0x89, 0x2e, 0x1b, 0xc5, 0xe3, 0xeb, 0xa6]);
}
// 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 nsIContentAnalysisCallback {
#[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 nsIContentAnalysisCallback.
// 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 nsIContentAnalysisCallbackCoerce {
/// Cheaply cast a value of this type from a `nsIContentAnalysisCallback`.
fn coerce_from(v: &nsIContentAnalysisCallback) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIContentAnalysisCallbackCoerce for nsIContentAnalysisCallback {
#[inline]
fn coerce_from(v: &nsIContentAnalysisCallback) -> &Self {
v
}
}
impl nsIContentAnalysisCallback {
/// Cast this `nsIContentAnalysisCallback` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIContentAnalysisCallbackCoerce>(&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 nsIContentAnalysisCallback {
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> nsIContentAnalysisCallbackCoerce for T {
#[inline]
fn coerce_from(v: &nsIContentAnalysisCallback) -> &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 nsIContentAnalysisCallback
// 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 nsIContentAnalysisCallbackVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void contentResult (in nsIContentAnalysisResponse aResult); */
pub ContentResult: unsafe extern "system" fn (this: *const nsIContentAnalysisCallback, aResult: *const nsIContentAnalysisResponse) -> ::nserror::nsresult,
/* void error (in nsresult aResult); */
pub Error: unsafe extern "system" fn (this: *const nsIContentAnalysisCallback, aResult: nserror::nsresult) -> ::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 nsIContentAnalysisCallback {
/// `void contentResult (in nsIContentAnalysisResponse aResult);`
#[inline]
pub unsafe fn ContentResult(&self, aResult: *const nsIContentAnalysisResponse) -> ::nserror::nsresult {
((*self.vtable).ContentResult)(self, aResult)
}
/// `void error (in nsresult aResult);`
#[inline]
pub unsafe fn Error(&self, aResult: nserror::nsresult) -> ::nserror::nsresult {
((*self.vtable).Error)(self, aResult)
}
}
/// `interface nsIContentAnalysisDiagnosticInfo : 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 nsIContentAnalysisDiagnosticInfo {
vtable: &'static nsIContentAnalysisDiagnosticInfoVTable,
/// 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 nsIContentAnalysisDiagnosticInfo.
unsafe impl XpCom for nsIContentAnalysisDiagnosticInfo {
const IID: nsIID = nsID(0xa430f6ef, 0xa526, 0x4055,
[0x8a, 0x82, 0x77, 0x41, 0xea, 0x75, 0x73, 0x67]);
}
// 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 nsIContentAnalysisDiagnosticInfo {
#[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 nsIContentAnalysisDiagnosticInfo.
// 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 nsIContentAnalysisDiagnosticInfoCoerce {
/// Cheaply cast a value of this type from a `nsIContentAnalysisDiagnosticInfo`.
fn coerce_from(v: &nsIContentAnalysisDiagnosticInfo) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIContentAnalysisDiagnosticInfoCoerce for nsIContentAnalysisDiagnosticInfo {
#[inline]
fn coerce_from(v: &nsIContentAnalysisDiagnosticInfo) -> &Self {
v
}
}
impl nsIContentAnalysisDiagnosticInfo {
/// Cast this `nsIContentAnalysisDiagnosticInfo` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIContentAnalysisDiagnosticInfoCoerce>(&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 nsIContentAnalysisDiagnosticInfo {
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> nsIContentAnalysisDiagnosticInfoCoerce for T {
#[inline]
fn coerce_from(v: &nsIContentAnalysisDiagnosticInfo) -> &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 nsIContentAnalysisDiagnosticInfo
// 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 nsIContentAnalysisDiagnosticInfoVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* [infallible] readonly attribute boolean connectedToAgent; */
pub GetConnectedToAgent: unsafe extern "system" fn (this: *const nsIContentAnalysisDiagnosticInfo, aConnectedToAgent: *mut bool) -> ::nserror::nsresult,
/* readonly attribute AString agentPath; */
pub GetAgentPath: unsafe extern "system" fn (this: *const nsIContentAnalysisDiagnosticInfo, aAgentPath: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* [infallible] readonly attribute boolean failedSignatureVerification; */
pub GetFailedSignatureVerification: unsafe extern "system" fn (this: *const nsIContentAnalysisDiagnosticInfo, aFailedSignatureVerification: *mut bool) -> ::nserror::nsresult,
/* [infallible] readonly attribute long long requestCount; */
pub GetRequestCount: unsafe extern "system" fn (this: *const nsIContentAnalysisDiagnosticInfo, aRequestCount: *mut i64) -> ::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 nsIContentAnalysisDiagnosticInfo {
/// `[infallible] readonly attribute boolean connectedToAgent;`
#[inline]
pub unsafe fn GetConnectedToAgent(&self) -> bool {
let mut result = <bool as ::std::default::Default>::default();
let _rv = ((*self.vtable).GetConnectedToAgent)(self, &mut result);
debug_assert!(_rv.succeeded());
result
}
/// `readonly attribute AString agentPath;`
#[inline]
pub unsafe fn GetAgentPath(&self, aAgentPath: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetAgentPath)(self, aAgentPath)
}
/// `[infallible] readonly attribute boolean failedSignatureVerification;`
#[inline]
pub unsafe fn GetFailedSignatureVerification(&self) -> bool {
let mut result = <bool as ::std::default::Default>::default();
let _rv = ((*self.vtable).GetFailedSignatureVerification)(self, &mut result);
debug_assert!(_rv.succeeded());
result
}
/// `[infallible] readonly attribute long long requestCount;`
#[inline]
pub unsafe fn GetRequestCount(&self) -> i64 {
let mut result = <i64 as ::std::default::Default>::default();
let _rv = ((*self.vtable).GetRequestCount)(self, &mut result);
debug_assert!(_rv.succeeded());
result
}
}
/// `interface nsIContentAnalysis : 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 nsIContentAnalysis {
vtable: &'static nsIContentAnalysisVTable,
/// 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 nsIContentAnalysis.
unsafe impl XpCom for nsIContentAnalysis {
const IID: nsIID = nsID(0x61497587, 0x2bba, 0x4a88,
[0xac, 0xd3, 0x3f, 0xbb, 0x2c, 0xed, 0xf1, 0x63]);
}
// 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 nsIContentAnalysis {
#[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 nsIContentAnalysis.
// 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 nsIContentAnalysisCoerce {
/// Cheaply cast a value of this type from a `nsIContentAnalysis`.
fn coerce_from(v: &nsIContentAnalysis) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIContentAnalysisCoerce for nsIContentAnalysis {
#[inline]
fn coerce_from(v: &nsIContentAnalysis) -> &Self {
v
}
}
impl nsIContentAnalysis {
/// Cast this `nsIContentAnalysis` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsIContentAnalysisCoerce>(&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 nsIContentAnalysis {
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> nsIContentAnalysisCoerce for T {
#[inline]
fn coerce_from(v: &nsIContentAnalysis) -> &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 nsIContentAnalysis
// 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 nsIContentAnalysisVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute boolean isActive; */
pub GetIsActive: unsafe extern "system" fn (this: *const nsIContentAnalysis, aIsActive: *mut bool) -> ::nserror::nsresult,
/* readonly attribute boolean mightBeActive; */
pub GetMightBeActive: unsafe extern "system" fn (this: *const nsIContentAnalysis, aMightBeActive: *mut bool) -> ::nserror::nsresult,
/* attribute boolean isSetByEnterprisePolicy; */
pub GetIsSetByEnterprisePolicy: unsafe extern "system" fn (this: *const nsIContentAnalysis, aIsSetByEnterprisePolicy: *mut bool) -> ::nserror::nsresult,
/* attribute boolean isSetByEnterprisePolicy; */
pub SetIsSetByEnterprisePolicy: unsafe extern "system" fn (this: *const nsIContentAnalysis, aIsSetByEnterprisePolicy: bool) -> ::nserror::nsresult,
/* [implicit_jscontext] Promise analyzeContentRequest (in nsIContentAnalysisRequest aCar, in boolean aAutoAcknowledge); */
/// Unable to generate binding because `jscontext is unsupported`
pub AnalyzeContentRequest: *const ::libc::c_void,
/* void analyzeContentRequestCallback (in nsIContentAnalysisRequest aCar, in boolean aAutoAcknowledge, in nsIContentAnalysisCallback callback); */
pub AnalyzeContentRequestCallback: unsafe extern "system" fn (this: *const nsIContentAnalysis, aCar: *const nsIContentAnalysisRequest, aAutoAcknowledge: bool, callback: *const nsIContentAnalysisCallback) -> ::nserror::nsresult,
/* void cancelContentAnalysisRequest (in ACString aRequestToken); */
pub CancelContentAnalysisRequest: unsafe extern "system" fn (this: *const nsIContentAnalysis, aRequestToken: *const ::nsstring::nsACString) -> ::nserror::nsresult,
/* void respondToWarnDialog (in ACString aRequestToken, in boolean aAllowContent); */
pub RespondToWarnDialog: unsafe extern "system" fn (this: *const nsIContentAnalysis, aRequestToken: *const ::nsstring::nsACString, aAllowContent: bool) -> ::nserror::nsresult,
/* void cancelAllRequests (); */
pub CancelAllRequests: unsafe extern "system" fn (this: *const nsIContentAnalysis) -> ::nserror::nsresult,
/* void testOnlySetCACmdLineArg (in boolean aVal); */
pub TestOnlySetCACmdLineArg: unsafe extern "system" fn (this: *const nsIContentAnalysis, aVal: bool) -> ::nserror::nsresult,
/* [implicit_jscontext] Promise getDiagnosticInfo (); */
/// Unable to generate binding because `jscontext is unsupported`
pub GetDiagnosticInfo: *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 nsIContentAnalysis {
/// ```text
/// /**
/// * True if content analysis should be consulted. Must only be accessed from
/// * the parent process's main thread.
/// */
/// ```
///
/// `readonly attribute boolean isActive;`
#[inline]
pub unsafe fn GetIsActive(&self, aIsActive: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetIsActive)(self, aIsActive)
}
/// ```text
/// /**
/// * True if content analysis might be active, and False if content analysis
/// * is definitely not active. Reading this property is guaranteed
/// * to work from a content process, and can be used to avoid having to call
/// * into the parent process to determine whether content analysis is actually
/// * active.
/// */
/// ```
///
/// `readonly attribute boolean mightBeActive;`
#[inline]
pub unsafe fn GetMightBeActive(&self, aMightBeActive: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetMightBeActive)(self, aMightBeActive)
}
/// ```text
/// /**
/// * True if content-analysis activation was determined by enterprise policy,
/// * as opposed to enabled with the `allow-content-analysis` command-line
/// * parameter.
/// */
/// ```
///
/// `attribute boolean isSetByEnterprisePolicy;`
#[inline]
pub unsafe fn GetIsSetByEnterprisePolicy(&self, aIsSetByEnterprisePolicy: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetIsSetByEnterprisePolicy)(self, aIsSetByEnterprisePolicy)
}
/// ```text
/// /**
/// * True if content-analysis activation was determined by enterprise policy,
/// * as opposed to enabled with the `allow-content-analysis` command-line
/// * parameter.
/// */
/// ```
///
/// `attribute boolean isSetByEnterprisePolicy;`
#[inline]
pub unsafe fn SetIsSetByEnterprisePolicy(&self, aIsSetByEnterprisePolicy: bool) -> ::nserror::nsresult {
((*self.vtable).SetIsSetByEnterprisePolicy)(self, aIsSetByEnterprisePolicy)
}
/// ```text
/// /**
/// * Consults content analysis server, if any, to request a permission
/// * decision for a network operation. Allows blocking downloading/
/// * uploading/printing/etc, based on the request.
/// * Consultation with the content analysis tool follows the conventional
/// * request, response, acknowledgement protocol.
/// *
/// * The resulting Promise resolves to a nsIContentAnalysisResponse,
/// * which may take some time to get from the analysis server. It will
/// * be rejected, with an string error description, if any error occurs.
/// *
/// * @param aCar
/// * The request to analyze.
/// * @param aAutoAcknowledge
/// * Whether to send an acknowledge message to the agent after the agent sends a response.
/// * Passing false means that the caller is responsible for
/// * calling nsIContentAnalysisResponse::acknowledge() if the Promise is resolved.
/// */
/// ```
///
/// `[implicit_jscontext] Promise analyzeContentRequest (in nsIContentAnalysisRequest aCar, in boolean aAutoAcknowledge);`
const _AnalyzeContentRequest: () = ();
/// ```text
/// /**
/// * Same functionality as AnalyzeContentRequest(), but more convenient to call
/// * from C++ since it takes a callback instead of returning a Promise.
/// *
/// * @param aCar
/// * The request to analyze.
/// * @param aAutoAcknowledge
/// * Whether to send an acknowledge message to the agent after the agent sends a response.
/// * Passing false means that the caller is responsible for
/// * calling nsIContentAnalysisResponse::acknowledge() if nsIContentAnalysisCallback::contentResult()
/// * is called.
/// * @param callback
/// * Callbacks to be called when the agent sends a response message (or when there is an error).
/// */
/// ```
///
/// `void analyzeContentRequestCallback (in nsIContentAnalysisRequest aCar, in boolean aAutoAcknowledge, in nsIContentAnalysisCallback callback);`
#[inline]
pub unsafe fn AnalyzeContentRequestCallback(&self, aCar: *const nsIContentAnalysisRequest, aAutoAcknowledge: bool, callback: *const nsIContentAnalysisCallback) -> ::nserror::nsresult {
((*self.vtable).AnalyzeContentRequestCallback)(self, aCar, aAutoAcknowledge, callback)
}
/// ```text
/// /**
/// * Cancels the request that is in progress. This may not actually cancel the request
/// * with the analysis server, but it means that Gecko will immediately act like the request
/// * was denied.
/// *
/// * @param aRequestToken
/// * The token for the request to cancel.
/// */
/// ```
///
/// `void cancelContentAnalysisRequest (in ACString aRequestToken);`
#[inline]
pub unsafe fn CancelContentAnalysisRequest(&self, aRequestToken: *const ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).CancelContentAnalysisRequest)(self, aRequestToken)
}
/// ```text
/// /**
/// * Indicates that the user has responded to a WARN dialog. aAllowContent represents
/// * whether the user wants to allow the request to go through.
/// */
/// ```
///
/// `void respondToWarnDialog (in ACString aRequestToken, in boolean aAllowContent);`
#[inline]
pub unsafe fn RespondToWarnDialog(&self, aRequestToken: *const ::nsstring::nsACString, aAllowContent: bool) -> ::nserror::nsresult {
((*self.vtable).RespondToWarnDialog)(self, aRequestToken, aAllowContent)
}
/// ```text
/// /**
/// * Cancels all outstanding DLP requests. Used on shutdown.
/// */
/// ```
///
/// `void cancelAllRequests ();`
#[inline]
pub unsafe fn CancelAllRequests(&self, ) -> ::nserror::nsresult {
((*self.vtable).CancelAllRequests)(self, )
}
/// ```text
/// /**
/// * Test-only function that pretends that "-allow-content-analysis" was
/// * given to Gecko on the command line.
/// */
/// ```
///
/// `void testOnlySetCACmdLineArg (in boolean aVal);`
#[inline]
pub unsafe fn TestOnlySetCACmdLineArg(&self, aVal: bool) -> ::nserror::nsresult {
((*self.vtable).TestOnlySetCACmdLineArg)(self, aVal)
}
/// ```text
/// /**
/// * Gets diagnostic information about content analysis. Returns a
/// * nsIContentAnalysisDiagnosticInfo via the returned promise.
/// */
/// ```
///
/// `[implicit_jscontext] Promise getDiagnosticInfo ();`
const _GetDiagnosticInfo: () = ();
}