widget/gonk/nsWidgetFactory.cpp

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* Copyright 2012 Mozilla Foundation and Mozilla contributors
michael@0 3 *
michael@0 4 * Licensed under the Apache License, Version 2.0 (the "License");
michael@0 5 * you may not use this file except in compliance with the License.
michael@0 6 * You may obtain a copy of the License at
michael@0 7 *
michael@0 8 * http://www.apache.org/licenses/LICENSE-2.0
michael@0 9 *
michael@0 10 * Unless required by applicable law or agreed to in writing, software
michael@0 11 * distributed under the License is distributed on an "AS IS" BASIS,
michael@0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
michael@0 13 * See the License for the specific language governing permissions and
michael@0 14 * limitations under the License.
michael@0 15 */
michael@0 16
michael@0 17 #include "base/basictypes.h"
michael@0 18
michael@0 19 #include "mozilla/ModuleUtils.h"
michael@0 20
michael@0 21 #include "nsCOMPtr.h"
michael@0 22 #include "nsWidgetsCID.h"
michael@0 23 #include "nsAppShell.h"
michael@0 24
michael@0 25 #include "nsWindow.h"
michael@0 26 #include "nsLookAndFeel.h"
michael@0 27 #include "nsAppShellSingleton.h"
michael@0 28 #include "nsScreenManagerGonk.h"
michael@0 29 #include "nsIdleServiceGonk.h"
michael@0 30 #include "nsTransferable.h"
michael@0 31 #include "nsClipboard.h"
michael@0 32 #include "nsClipboardHelper.h"
michael@0 33
michael@0 34 #include "nsHTMLFormatConverter.h"
michael@0 35 #include "nsXULAppAPI.h"
michael@0 36
michael@0 37 #include "PuppetWidget.h"
michael@0 38
michael@0 39 using namespace mozilla::widget;
michael@0 40
michael@0 41 // taken from android/nsWidgetFactory.cpp. GfxInfo is a legacy kludge, unfortunately
michael@0 42 // for the time being we still have to implement it on all platforms.
michael@0 43 #include "GfxInfo.h"
michael@0 44 namespace mozilla {
michael@0 45 namespace widget {
michael@0 46 // This constructor should really be shared with all platforms.
michael@0 47 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init)
michael@0 48 }
michael@0 49 }
michael@0 50
michael@0 51 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
michael@0 52 NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerGonk)
michael@0 53 NS_GENERIC_FACTORY_CONSTRUCTOR(PuppetScreenManager)
michael@0 54 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
michael@0 55 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceGonk, nsIdleServiceGonk::GetInstance)
michael@0 56 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
michael@0 57 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
michael@0 58 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
michael@0 59
michael@0 60 NS_DEFINE_NAMED_CID(NS_APPSHELL_CID);
michael@0 61 NS_DEFINE_NAMED_CID(NS_WINDOW_CID);
michael@0 62 NS_DEFINE_NAMED_CID(NS_CHILD_CID);
michael@0 63 NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
michael@0 64 NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
michael@0 65 NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID);
michael@0 66 NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID);
michael@0 67 NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
michael@0 68 NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
michael@0 69 NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID);
michael@0 70
michael@0 71 static nsresult
michael@0 72 ScreenManagerConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
michael@0 73 {
michael@0 74 return (XRE_GetProcessType() == GeckoProcessType_Default) ?
michael@0 75 nsScreenManagerGonkConstructor(aOuter, aIID, aResult) :
michael@0 76 PuppetScreenManagerConstructor(aOuter, aIID, aResult);
michael@0 77 }
michael@0 78
michael@0 79 static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
michael@0 80 { &kNS_WINDOW_CID, false, nullptr, nsWindowConstructor },
michael@0 81 { &kNS_CHILD_CID, false, nullptr, nsWindowConstructor },
michael@0 82 { &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor },
michael@0 83 { &kNS_SCREENMANAGER_CID, false, nullptr, ScreenManagerConstructor },
michael@0 84 { &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor },
michael@0 85 { &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceGonkConstructor },
michael@0 86 { &kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor },
michael@0 87 { &kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor },
michael@0 88 { &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor },
michael@0 89 { &kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor },
michael@0 90 { nullptr }
michael@0 91 };
michael@0 92
michael@0 93 static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
michael@0 94 { "@mozilla.org/widgets/window/gonk;1", &kNS_WINDOW_CID },
michael@0 95 { "@mozilla.org/widgets/child_window/gonk;1", &kNS_CHILD_CID },
michael@0 96 { "@mozilla.org/widget/appshell/gonk;1", &kNS_APPSHELL_CID },
michael@0 97 { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID },
michael@0 98 { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID },
michael@0 99 { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID },
michael@0 100 { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID },
michael@0 101 { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID },
michael@0 102 { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID },
michael@0 103 { "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID },
michael@0 104 { nullptr }
michael@0 105 };
michael@0 106
michael@0 107 static void
michael@0 108 nsWidgetGonkModuleDtor()
michael@0 109 {
michael@0 110 nsLookAndFeel::Shutdown();
michael@0 111 nsAppShellShutdown();
michael@0 112 }
michael@0 113
michael@0 114 static const mozilla::Module kWidgetModule = {
michael@0 115 mozilla::Module::kVersion,
michael@0 116 kWidgetCIDs,
michael@0 117 kWidgetContracts,
michael@0 118 nullptr,
michael@0 119 nullptr,
michael@0 120 nsAppShellInit,
michael@0 121 nsWidgetGonkModuleDtor
michael@0 122 };
michael@0 123
michael@0 124 NSMODULE_DEFN(nsWidgetGonkModule) = &kWidgetModule;

mercurial