1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef _NSSYSTEMINFO_H_
8 #define _NSSYSTEMINFO_H_
10 #include "nsHashPropertyBag.h"
11 #include "nsISystemInfo.h"
12 #include "mozilla/MozPromise.h"
14 #ifdef MOZ_WIDGET_ANDROID
15 # include "mozilla/dom/PContent.h"
16 #endif // MOZ_WIDGET_ANDROID
19 # include <inspectable.h>
21 // The UUID comes from winrt/windows.system.profile.idl
23 MIDL_INTERFACE("7D1D81DB-8D63-4789-9EA5-DDCF65A94F3C")
24 IWindowsIntegrityPolicyStatics
: public IInspectable
{
26 virtual HRESULT STDMETHODCALLTYPE
get_IsEnabled(bool* value
) = 0;
30 class nsISerialEventTarget
;
32 struct FolderDiskInfo
{
39 FolderDiskInfo binary
;
40 FolderDiskInfo profile
;
41 FolderDiskInfo system
;
52 bool isWowARM64
= false;
53 // Whether or not the system is Windows 10 or 11 in S Mode.
54 // S Mode existed prior to us being able to query it, so this
55 // is unreliable on Windows versions prior to 1810.
56 bool isWindowsSMode
= false;
59 int32_t cpuPCount
= 0;
60 int32_t cpuMCount
= 0;
61 int32_t cpuECount
= 0;
64 int32_t cpuFamily
= 0;
66 int32_t cpuStepping
= 0;
67 int32_t l2cacheKB
= 0;
68 int32_t l3cacheKB
= 0;
72 typedef mozilla::MozPromise
<DiskInfo
, nsresult
, /* IsExclusive */ false>
75 typedef mozilla::MozPromise
<nsAutoString
, nsresult
, /* IsExclusive */ false>
78 typedef mozilla::MozPromise
<OSInfo
, nsresult
, /* IsExclusive */ false>
81 typedef mozilla::MozPromise
<ProcessInfo
, nsresult
, /* IsExclusive */ false>
84 // Synchronous info collection, avoid calling it from the main thread, consider
85 // using the promise-based `nsISystemInfo::GetProcessInfo()` instead.
86 // Note that only known fields will be written.
87 nsresult
CollectProcessInfo(ProcessInfo
& info
);
89 class nsSystemInfo final
: public nsISystemInfo
, public nsHashPropertyBag
{
91 NS_DECL_ISUPPORTS_INHERITED
98 // Slot for NS_InitXPCOM to pass information to nsSystemInfo::Init.
99 // See comments above the variable definition and in NS_InitXPCOM.
100 static uint32_t gUserUmask
;
102 #ifdef MOZ_WIDGET_ANDROID
103 static void GetAndroidSystemInfo(mozilla::dom::AndroidSystemInfo
* aInfo
);
106 void SetupAndroidInfo(const mozilla::dom::AndroidSystemInfo
&);
110 void SetInt32Property(const nsAString
& aPropertyName
, const int32_t aValue
);
111 void SetUint32Property(const nsAString
& aPropertyName
, const uint32_t aValue
);
112 void SetUint64Property(const nsAString
& aPropertyName
, const uint64_t aValue
);
117 RefPtr
<DiskInfoPromise
> mDiskInfoPromise
;
118 RefPtr
<CountryCodePromise
> mCountryCodePromise
;
119 RefPtr
<OSInfoPromise
> mOSInfoPromise
;
120 RefPtr
<ProcessInfoPromise
> mProcessInfoPromise
;
121 RefPtr
<nsISerialEventTarget
> mBackgroundET
;
122 RefPtr
<nsISerialEventTarget
> GetBackgroundTarget();
125 #define NS_SYSTEMINFO_CONTRACTID "@mozilla.org/system-info;1"
126 #define NS_SYSTEMINFO_CID \
128 0xd962398a, 0x99e5, 0x49b2, { \
129 0x85, 0x7a, 0xc1, 0x59, 0x04, 0x9c, 0x7f, 0x6c \
133 #endif /* _NSSYSTEMINFO_H_ */