1 /* vim: se cin sw=2 ts=2 et : */
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 
8 #ifndef __mozilla_widget_GfxInfo_h__
9 #define __mozilla_widget_GfxInfo_h__
10 
11 #include "GfxInfoBase.h"
12 
13 #include "nsString.h"
14 
15 namespace mozilla {
16 namespace widget {
17 
18 class GfxInfo : public GfxInfoBase
19 {
20 public:
21 
22   GfxInfo();
23   // We only declare the subset of nsIGfxInfo that we actually implement. The
24   // rest is brought forward from GfxInfoBase.
25   NS_IMETHOD GetD2DEnabled(bool *aD2DEnabled) override;
26   NS_IMETHOD GetDWriteEnabled(bool *aDWriteEnabled) override;
27   NS_IMETHOD GetDWriteVersion(nsAString & aDwriteVersion) override;
28   NS_IMETHOD GetCleartypeParameters(nsAString & aCleartypeParams) override;
29   NS_IMETHOD GetAdapterDescription(nsAString & aAdapterDescription) override;
30   NS_IMETHOD GetAdapterDriver(nsAString & aAdapterDriver) override;
31   NS_IMETHOD GetAdapterVendorID(nsAString & aAdapterVendorID) override;
32   NS_IMETHOD GetAdapterDeviceID(nsAString & aAdapterDeviceID) override;
33   NS_IMETHOD GetAdapterSubsysID(nsAString & aAdapterSubsysID) override;
34   NS_IMETHOD GetAdapterRAM(nsAString & aAdapterRAM) override;
35   NS_IMETHOD GetAdapterDriverVersion(nsAString & aAdapterDriverVersion) override;
36   NS_IMETHOD GetAdapterDriverDate(nsAString & aAdapterDriverDate) override;
37   NS_IMETHOD GetAdapterDescription2(nsAString & aAdapterDescription) override;
38   NS_IMETHOD GetAdapterDriver2(nsAString & aAdapterDriver) override;
39   NS_IMETHOD GetAdapterVendorID2(nsAString & aAdapterVendorID) override;
40   NS_IMETHOD GetAdapterDeviceID2(nsAString & aAdapterDeviceID) override;
41   NS_IMETHOD GetAdapterSubsysID2(nsAString & aAdapterSubsysID) override;
42   NS_IMETHOD GetAdapterRAM2(nsAString & aAdapterRAM) override;
43   NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion) override;
44   NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate) override;
45   NS_IMETHOD GetIsGPU2Active(bool *aIsGPU2Active) override;
46 
47   using GfxInfoBase::GetFeatureStatus;
48   using GfxInfoBase::GetFeatureSuggestedDriverVersion;
49   using GfxInfoBase::GetWebGLParameter;
50 
51   virtual nsresult Init() override;
52 
53 #ifdef DEBUG
54   NS_DECL_ISUPPORTS_INHERITED
55   NS_DECL_NSIGFXINFODEBUG
56 #endif
57 
58   virtual uint32_t OperatingSystemVersion() override { return mOSXVersion; }
59 
60   nsresult FindMonitors(JSContext* cx, JS::HandleObject array) override;
61 
62 protected:
63 
64   virtual ~GfxInfo() {}
65 
66   virtual nsresult GetFeatureStatusImpl(int32_t aFeature,
67                                         int32_t *aStatus,
68                                         nsAString & aSuggestedDriverVersion,
69                                         const nsTArray<GfxDriverInfo>& aDriverInfo,
70                                         nsACString &aFailureId,
71                                         OperatingSystem* aOS = nullptr) override;
72   virtual const nsTArray<GfxDriverInfo>& GetGfxDriverInfo() override;
73 
74 private:
75 
76   void GetDeviceInfo();
77   void GetSelectedCityInfo();
78   void AddCrashReportAnnotations();
79 
80   nsString mAdapterRAMString;
81   nsString mDeviceID;
82   nsString mDriverVersion;
83   nsString mDriverDate;
84   nsString mDeviceKey;
85 
86   nsString mAdapterVendorID;
87   nsString mAdapterDeviceID;
88 
89   uint32_t mOSXVersion;
90 };
91 
92 } // namespace widget
93 } // namespace mozilla
94 
95 #endif /* __mozilla_widget_GfxInfo_h__ */
96