1 /* -*- Mode: C++; tab-width: 2; 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 "mozilla/widget/NativeMenuSupport.h"
8 #include "mozilla/StaticPrefs_widget.h"
9 #include "MainThreadUtils.h"
10 #include "NativeMenuGtk.h"
14 namespace mozilla::widget
{
16 void NativeMenuSupport::CreateNativeMenuBar(nsIWidget
* aParent
,
17 dom::Element
* aMenuBarElement
) {
18 MOZ_RELEASE_ASSERT(NS_IsMainThread(),
19 "Attempting to create native menu bar on wrong thread!");
21 #ifdef MOZ_ENABLE_DBUS
22 if (aMenuBarElement
&& StaticPrefs::widget_gtk_global_menu_enabled() &&
23 DBusMenuFunctions::Init()) {
24 static_cast<nsWindow
*>(aParent
)->SetDBusMenuBar(
25 DBusMenuBar::Create(aMenuBarElement
));
30 already_AddRefed
<NativeMenu
> NativeMenuSupport::CreateNativeContextMenu(
31 dom::Element
* aPopup
) {
32 return MakeAndAddRef
<NativeMenuGtk
>(aPopup
);
35 bool NativeMenuSupport::ShouldUseNativeContextMenus() {
36 return NativeMenuGtk::CanUse();
39 } // namespace mozilla::widget