Bug 1885565 - Part 2: Fix up parameter ordering and kDoc descriptions in NavigationBa...
[gecko.git] / widget / nsContentProcessWidgetFactory.h
blobeb2d5a042d5f77662ef3a703fb033577db3809e7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=4:tabstop=4:
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef nsContentProcessWidgetFactory_h
9 #define nsContentProcessWidgetFactory_h
11 #include "nsISupports.h"
12 #include "nsComponentManagerUtils.h"
13 #include "nsServiceManagerUtils.h"
14 #include "nsXULAppAPI.h"
16 #define MAKE_COMPONENT_CHOOSER(name_, parent_, content_, constructor_) \
17 static already_AddRefed<nsISupports> name_() { \
18 nsCOMPtr<nsISupports> inst; \
19 if (XRE_IsContentProcess()) { \
20 inst = constructor_(content_); \
21 } else { \
22 inst = constructor_(parent_); \
23 } \
24 return inst.forget(); \
27 #ifdef MOZ_WIDGET_COCOA
28 // This should be `do_GetService`, but test_bug466599.xhtml erroneously uses
29 // `createInstance` rather than `getService`, and passes only because doing so
30 // bypasses the clipboard contents cache, which does not have the expected
31 // wrapping.
32 MAKE_COMPONENT_CHOOSER(nsClipboardSelector,
33 "@mozilla.org/widget/parent/clipboard;1",
34 "@mozilla.org/widget/content/clipboard;1",
35 do_CreateInstance)
36 #else
37 MAKE_COMPONENT_CHOOSER(nsClipboardSelector,
38 "@mozilla.org/widget/parent/clipboard;1",
39 "@mozilla.org/widget/content/clipboard;1", do_GetService)
40 #endif
41 MAKE_COMPONENT_CHOOSER(nsColorPickerSelector,
42 "@mozilla.org/parent/colorpicker;1",
43 "@mozilla.org/content/colorpicker;1", do_CreateInstance)
44 MAKE_COMPONENT_CHOOSER(nsFilePickerSelector, "@mozilla.org/parent/filepicker;1",
45 "@mozilla.org/content/filepicker;1", do_CreateInstance)
46 MAKE_COMPONENT_CHOOSER(nsScreenManagerSelector,
47 "@mozilla.org/gfx/parent/screenmanager;1",
48 "@mozilla.org/gfx/content/screenmanager;1",
49 do_GetService)
50 MAKE_COMPONENT_CHOOSER(nsDragServiceSelector,
51 "@mozilla.org/widget/parent/dragservice;1",
52 "@mozilla.org/widget/content/dragservice;1",
53 do_GetService)
55 #undef MAKE_COMPONENT_CHOOSER
57 #endif // defined nsContentProcessWidgetFactory_h