Bug 1805294 [wpt PR 37463] - WebKit export of https://bugs.webkit.org/show_bug.cgi...
[gecko.git] / widget / uikit / nsWidgetFactory.mm
blobbdf1beceeb053024f4e142035b7c2e19ed7adf46
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsISupports.h"
7 #include "mozilla/ModuleUtils.h"
9 #include "nsWidgetsCID.h"
11 #include "nsAppShell.h"
12 #include "nsAppShellSingleton.h"
13 #include "nsLookAndFeel.h"
14 #include "nsScreenManager.h"
16 NS_GENERIC_FACTORY_CONSTRUCTOR(UIKitScreenManager)
18 #include "GfxInfo.h"
19 namespace mozilla {
20 namespace widget {
21 // This constructor should really be shared with all platforms.
22 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init)
26 NS_DEFINE_NAMED_CID(NS_APPSHELL_CID);
27 NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
28 NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
30 static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
31     {&kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor},
32     {&kNS_SCREENMANAGER_CID, false, nullptr, UIKitScreenManagerConstructor},
33     {&kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor},
34     {nullptr}};
36 static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
37     {"@mozilla.org/widget/appshell/uikit;1", &kNS_APPSHELL_CID},
38     {"@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID},
39     {"@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID},
40     {nullptr}};
42 static void nsWidgetUIKitModuleDtor() {
43   nsLookAndFeel::Shutdown();
44   nsAppShellShutdown();
47 extern const mozilla::Module kWidgetModule = {
48     mozilla::Module::kVersion, kWidgetCIDs, kWidgetContracts, nullptr, nullptr, nsAppShellInit,
49     nsWidgetUIKitModuleDtor};