summaryrefslogtreecommitdiffstats
path: root/toolkit/components/extensions/webidl-api/ExtensionBrowserSettings.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /toolkit/components/extensions/webidl-api/ExtensionBrowserSettings.cpp
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/extensions/webidl-api/ExtensionBrowserSettings.cpp')
-rw-r--r--toolkit/components/extensions/webidl-api/ExtensionBrowserSettings.cpp106
1 files changed, 106 insertions, 0 deletions
diff --git a/toolkit/components/extensions/webidl-api/ExtensionBrowserSettings.cpp b/toolkit/components/extensions/webidl-api/ExtensionBrowserSettings.cpp
new file mode 100644
index 0000000000..57a5db3fe8
--- /dev/null
+++ b/toolkit/components/extensions/webidl-api/ExtensionBrowserSettings.cpp
@@ -0,0 +1,106 @@
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* 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 "ExtensionBrowserSettings.h"
+#include "ExtensionEventManager.h"
+#include "ExtensionSetting.h"
+#include "ExtensionBrowserSettingsColorManagement.h"
+
+#include "mozilla/dom/ExtensionBrowserSettingsBinding.h"
+#include "nsIGlobalObject.h"
+
+namespace mozilla::extensions {
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF(ExtensionBrowserSettings);
+NS_IMPL_CYCLE_COLLECTING_RELEASE(ExtensionBrowserSettings)
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(
+ ExtensionBrowserSettings, mGlobal, mExtensionBrowser,
+ mAllowPopupsForUserEventsSetting, mCacheEnabledSetting,
+ mCloseTabsByDoubleClickSetting, mContextMenuShowEventSetting,
+ mFtpProtocolEnabledSetting, mHomepageOverrideSetting,
+ mImageAnimationBehaviorSetting, mNewTabPageOverrideSetting,
+ mNewTabPositionSetting, mOpenBookmarksInNewTabsSetting,
+ mOpenSearchResultsInNewTabsSetting, mOpenUrlbarResultsInNewTabsSetting,
+ mWebNotificationsDisabledSetting, mOverrideDocumentColorsSetting,
+ mOverrideContentColorSchemeSetting, mUseDocumentFontsSetting,
+ mZoomFullPageSetting, mZoomSiteSpecificSetting, mColorManagementNamespace);
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ExtensionBrowserSettings)
+ NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+ NS_INTERFACE_MAP_ENTRY(nsISupports)
+NS_INTERFACE_MAP_END
+
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"allowPopupsForUserEvents"_ns,
+ AllowPopupsForUserEvents)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"cacheEnabled"_ns,
+ CacheEnabled)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"closeTabsByDoubleClick"_ns,
+ CloseTabsByDoubleClick)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"contextMenuShowEvent"_ns,
+ ContextMenuShowEvent)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"ftpProtocolEnabled"_ns,
+ FtpProtocolEnabled)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"homepageOverride"_ns,
+ HomepageOverride)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"imageAnimationBehavior"_ns,
+ ImageAnimationBehavior)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"newTabPageOverride"_ns,
+ NewTabPageOverride)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"newTabPosition"_ns,
+ NewTabPosition)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"openBookmarksInNewTabs"_ns,
+ OpenBookmarksInNewTabs)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings,
+ u"openSearchResultsInNewTabs"_ns,
+ OpenSearchResultsInNewTabs)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings,
+ u"openUrlbarResultsInNewTabs"_ns,
+ OpenUrlbarResultsInNewTabs)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"webNotificationsDisabled"_ns,
+ WebNotificationsDisabled)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"overrideDocumentColors"_ns,
+ OverrideDocumentColors)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings,
+ u"overrideContentColorScheme"_ns,
+ OverrideContentColorScheme)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"useDocumentFonts"_ns,
+ UseDocumentFonts)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"zoomFullPage"_ns,
+ ZoomFullPage)
+NS_IMPL_WEBEXT_SETTING(ExtensionBrowserSettings, u"zoomSiteSpecific"_ns,
+ ZoomSiteSpecific)
+
+ExtensionBrowserSettings::ExtensionBrowserSettings(
+ nsIGlobalObject* aGlobal, ExtensionBrowser* aExtensionBrowser)
+ : mGlobal(aGlobal), mExtensionBrowser(aExtensionBrowser) {
+ MOZ_DIAGNOSTIC_ASSERT(mGlobal);
+ MOZ_DIAGNOSTIC_ASSERT(mExtensionBrowser);
+}
+
+/* static */
+bool ExtensionBrowserSettings::IsAllowed(JSContext* aCx, JSObject* aGlobal) {
+ return true;
+}
+
+JSObject* ExtensionBrowserSettings::WrapObject(
+ JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
+ return dom::ExtensionBrowserSettings_Binding::Wrap(aCx, this, aGivenProto);
+}
+
+nsIGlobalObject* ExtensionBrowserSettings::GetParentObject() const {
+ return mGlobal;
+}
+
+ExtensionBrowserSettingsColorManagement*
+ExtensionBrowserSettings::GetExtensionBrowserSettingsColorManagement() {
+ if (!mColorManagementNamespace) {
+ mColorManagementNamespace =
+ new ExtensionBrowserSettingsColorManagement(mGlobal, mExtensionBrowser);
+ }
+
+ return mColorManagementNamespace;
+}
+
+} // namespace mozilla::extensions