Bug 1777519 [wpt PR 34660] - Avoid OSError from --kill-safari stat'ing random paths...
[gecko.git] / widget / windows / nsWidgetFactory.cpp
blob47c7d021edcee0b49f3131a494f546ecf36d81e3
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 "nsWidgetFactory.h"
8 #include "mozilla/Components.h"
9 #include "nsISupports.h"
10 #include "nsdefs.h"
11 #include "nsWidgetsCID.h"
12 #include "nsAppShell.h"
13 #include "nsAppShellSingleton.h"
14 #include "mozilla/WidgetUtils.h"
15 #include "mozilla/widget/ScreenManager.h"
16 #include "nsLookAndFeel.h"
17 #include "WinMouseScrollHandler.h"
18 #include "KeyboardLayout.h"
19 #include "nsToolkit.h"
21 // Modules that switch out based on the environment
22 #include "nsXULAppAPI.h"
23 // Desktop
24 #include "nsFilePicker.h" // needs to be included before other shobjidl.h includes
25 #include "nsColorPicker.h"
26 // Content processes
27 #include "nsFilePickerProxy.h"
29 // Clipboard
30 #include "nsClipboardHelper.h"
31 #include "nsClipboard.h"
32 #include "HeadlessClipboard.h"
34 #include "WindowsUIUtils.h"
36 using namespace mozilla;
37 using namespace mozilla::widget;
39 NS_IMPL_COMPONENT_FACTORY(nsIClipboard) {
40 nsCOMPtr<nsIClipboard> inst;
41 if (gfxPlatform::IsHeadless()) {
42 inst = new HeadlessClipboard();
43 } else {
44 inst = new nsClipboard();
46 return inst.forget().downcast<nsISupports>();
49 nsresult nsWidgetWindowsModuleCtor() { return nsAppShellInit(); }
51 void nsWidgetWindowsModuleDtor() {
52 // Shutdown all XP level widget classes.
53 WidgetUtils::Shutdown();
55 KeyboardLayout::Shutdown();
56 MouseScrollHandler::Shutdown();
57 nsLookAndFeel::Shutdown();
58 nsToolkit::Shutdown();
59 nsAppShellShutdown();