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/. */
5
6#include "nsISupports.h"
7#include "mozilla/ModuleUtils.h"
8
9#include "nsWidgetsCID.h"
10
11#include "nsAppShell.h"
12#include "nsAppShellSingleton.h"
13#include "nsLookAndFeel.h"
14#include "nsScreenManager.h"
15
16NS_GENERIC_FACTORY_CONSTRUCTOR(UIKitScreenManager)
17
18#include "GfxInfo.h"
19namespace mozilla {
20namespace widget {
21// This constructor should really be shared with all platforms.
22NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init)
23}
24}
25
26NS_DEFINE_NAMED_CID(NS_APPSHELL_CID);
27NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
28NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
29
30static 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}};
35
36static 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}};
41
42static void nsWidgetUIKitModuleDtor() {
43  nsLookAndFeel::Shutdown();
44  nsAppShellShutdown();
45}
46
47extern const mozilla::Module kWidgetModule = {
48    mozilla::Module::kVersion, kWidgetCIDs, kWidgetContracts, nullptr, nullptr, nsAppShellInit,
49    nsWidgetUIKitModuleDtor};
50