widget/uikit/nsWidgetFactory.mm
author Geoff Brown <gbrown@mozilla.com>
Mon, 22 Apr 2019 15:55:23 +0000
changeset 470372 98df47a219e2088d431e3961fe6ea7f99017a1be
parent 468493 60669a841a87644ba9b2f4d9f17f225e2eca0980
permissions -rw-r--r--
Bug 1318091 - Support |mach gtest| for android; r=bc Add basic support for 'mach gtest' on Android. Handling of Android-only and desktop-only options is awkward; I hope to re-visit this after bug 1519369. Differential Revision: https://phabricator.services.mozilla.com/D28129

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsIComponentManager.h"
#include "mozilla/ModuleUtils.h"

#include "nsWidgetsCID.h"

#include "nsAppShell.h"
#include "nsAppShellSingleton.h"
#include "nsLookAndFeel.h"
#include "nsScreenManager.h"

NS_GENERIC_FACTORY_CONSTRUCTOR(UIKitScreenManager)

#include "GfxInfo.h"
namespace mozilla {
namespace widget {
// This constructor should really be shared with all platforms.
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init)
}
}

NS_DEFINE_NAMED_CID(NS_APPSHELL_CID);
NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);

static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
    {&kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor},
    {&kNS_SCREENMANAGER_CID, false, nullptr, UIKitScreenManagerConstructor},
    {&kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor},
    {nullptr}};

static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
    {"@mozilla.org/widget/appshell/uikit;1", &kNS_APPSHELL_CID},
    {"@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID},
    {"@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID},
    {nullptr}};

static void nsWidgetUIKitModuleDtor() {
  nsLookAndFeel::Shutdown();
  nsAppShellShutdown();
}

extern const mozilla::Module kWidgetModule = {
    mozilla::Module::kVersion, kWidgetCIDs, kWidgetContracts, nullptr, nullptr, nsAppShellInit,
    nsWidgetUIKitModuleDtor};