diff options
author | Moonchild <moonchild@palemoon.org> | 2021-06-21 17:52:42 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-06-21 17:52:42 +0000 |
commit | 1fe9c19305dadf2d5bcaa0e589fcd250389dfa8a (patch) | |
tree | 0fcd737a94f1b9f4807c159a66bdc6a214f1a5db /toolkit/components | |
parent | 5afcb4a0925e371bd7d0f78288ca2fd3b359f597 (diff) | |
download | uxp-1fe9c19305dadf2d5bcaa0e589fcd250389dfa8a.tar.gz |
Issue #1751 - Remove Mac code behind MOZ_WIDGET_TOOLKIT == 'cocoa'
Diffstat (limited to 'toolkit/components')
-rw-r--r-- | toolkit/components/parentalcontrols/moz.build | 2 | ||||
-rw-r--r-- | toolkit/components/parentalcontrols/nsParentalControlsServiceCocoa.mm | 79 | ||||
-rw-r--r-- | toolkit/components/startup/moz.build | 6 | ||||
-rw-r--r-- | toolkit/components/startup/nsUserInfoMac.h | 25 | ||||
-rw-r--r-- | toolkit/components/startup/nsUserInfoMac.mm | 84 |
5 files changed, 2 insertions, 194 deletions
diff --git a/toolkit/components/parentalcontrols/moz.build b/toolkit/components/parentalcontrols/moz.build index 577162945b..6c8bd9a8ce 100644 --- a/toolkit/components/parentalcontrols/moz.build +++ b/toolkit/components/parentalcontrols/moz.build @@ -10,8 +10,6 @@ XPIDL_MODULE = 'parentalcontrols' if not CONFIG['MOZ_DISABLE_PARENTAL_CONTROLS']: if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': SOURCES += ['nsParentalControlsServiceWin.cpp'] - elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - UNIFIED_SOURCES += ['nsParentalControlsServiceCocoa.mm'] else: SOURCES += ['nsParentalControlsServiceDefault.cpp'] diff --git a/toolkit/components/parentalcontrols/nsParentalControlsServiceCocoa.mm b/toolkit/components/parentalcontrols/nsParentalControlsServiceCocoa.mm deleted file mode 100644 index 0eb0184001..0000000000 --- a/toolkit/components/parentalcontrols/nsParentalControlsServiceCocoa.mm +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode:nil; c-basic-offset: 2 -*- */ -/* 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 "nsParentalControlsService.h" -#include "nsString.h" -#include "nsIFile.h" - -#import <Cocoa/Cocoa.h> - -NS_IMPL_ISUPPORTS(nsParentalControlsService, nsIParentalControlsService) - -nsParentalControlsService::nsParentalControlsService() : - mEnabled(false) -{ - mEnabled = CFPreferencesAppValueIsForced(CFSTR("restrictWeb"), - CFSTR("com.apple.familycontrols.contentfilter")); -} - -nsParentalControlsService::~nsParentalControlsService() -{ -} - -NS_IMETHODIMP -nsParentalControlsService::GetParentalControlsEnabled(bool *aResult) -{ - *aResult = mEnabled; - return NS_OK; -} - -NS_IMETHODIMP -nsParentalControlsService::GetBlockFileDownloadsEnabled(bool *aResult) -{ - *aResult = false; - return NS_OK; -} - -NS_IMETHODIMP -nsParentalControlsService::GetLoggingEnabled(bool *aResult) -{ - *aResult = false; - return NS_OK; -} - -NS_IMETHODIMP -nsParentalControlsService::Log(int16_t aEntryType, - bool blocked, - nsIURI *aSource, - nsIFile *aTarget) -{ - // silently drop on the floor - return NS_OK; -} - -NS_IMETHODIMP -nsParentalControlsService::RequestURIOverride(nsIURI *aTarget, - nsIInterfaceRequestor *aWindowContext, - bool *_retval) -{ - return NS_ERROR_NOT_AVAILABLE; -} - -NS_IMETHODIMP -nsParentalControlsService::RequestURIOverrides(nsIArray *aTargets, - nsIInterfaceRequestor *aWindowContext, - bool *_retval) -{ - return NS_ERROR_NOT_AVAILABLE; -} - -NS_IMETHODIMP -nsParentalControlsService::IsAllowed(int16_t aAction, - nsIURI *aUri, - bool *_retval) -{ - return NS_ERROR_NOT_AVAILABLE; -} - diff --git a/toolkit/components/startup/moz.build b/toolkit/components/startup/moz.build index b12fe9a534..7ee23d9ce8 100644 --- a/toolkit/components/startup/moz.build +++ b/toolkit/components/startup/moz.build @@ -7,7 +7,7 @@ DIRS += ['public'] EXPORTS.mozilla += ['StartupTimeline.h'] -UNIFIED_SOURCES += [ +SOURCES += [ 'nsAppStartup.cpp', 'StartupTimeline.cpp', ] @@ -16,9 +16,7 @@ if CONFIG['MOZ_USERINFO']: if CONFIG['OS_ARCH'] == 'WINNT': # This file cannot be built in unified mode because of name clashes with Windows headers. SOURCES += ['nsUserInfoWin.cpp'] - elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - UNIFIED_SOURCES += ['nsUserInfoMac.mm'] else: - UNIFIED_SOURCES += ['nsUserInfoUnix.cpp'] + SOURCES += ['nsUserInfoUnix.cpp'] FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/startup/nsUserInfoMac.h b/toolkit/components/startup/nsUserInfoMac.h deleted file mode 100644 index 822e0edd5d..0000000000 --- a/toolkit/components/startup/nsUserInfoMac.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ -#ifndef __nsUserInfoMac_h -#define __nsUserInfoMac_h - -#include "nsIUserInfo.h" -#include "nsReadableUtils.h" - -class nsUserInfo: public nsIUserInfo -{ -public: - nsUserInfo(); - - NS_DECL_ISUPPORTS - NS_DECL_NSIUSERINFO - - nsresult GetPrimaryEmailAddress(nsCString &aEmailAddress); - -protected: - virtual ~nsUserInfo() {} -}; - -#endif /* __nsUserInfo_h */ diff --git a/toolkit/components/startup/nsUserInfoMac.mm b/toolkit/components/startup/nsUserInfoMac.mm deleted file mode 100644 index 1895cf1773..0000000000 --- a/toolkit/components/startup/nsUserInfoMac.mm +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 "nsUserInfoMac.h" -#include "nsObjCExceptions.h" -#include "nsString.h" - -#import <Cocoa/Cocoa.h> -#import <AddressBook/AddressBook.h> - -NS_IMPL_ISUPPORTS(nsUserInfo, nsIUserInfo) - -nsUserInfo::nsUserInfo() {} - -NS_IMETHODIMP -nsUserInfo::GetFullname(char16_t **aFullname) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT - - NS_ConvertUTF8toUTF16 fullName([NSFullUserName() UTF8String]); - *aFullname = ToNewUnicode(fullName); - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT -} - -NS_IMETHODIMP -nsUserInfo::GetUsername(char **aUsername) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT - - nsAutoCString username([NSUserName() UTF8String]); - *aUsername = ToNewCString(username); - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT -} - -nsresult -nsUserInfo::GetPrimaryEmailAddress(nsCString &aEmailAddress) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT - - // Try to get this user's primary email from the system addressbook's "me card" - // (if they've filled it) - ABPerson *me = [[ABAddressBook sharedAddressBook] me]; - ABMultiValue *emailAddresses = [me valueForProperty:kABEmailProperty]; - if ([emailAddresses count] > 0) { - // get the index of the primary email, in case there are more than one - int primaryEmailIndex = [emailAddresses indexForIdentifier:[emailAddresses primaryIdentifier]]; - aEmailAddress.Assign([[emailAddresses valueAtIndex:primaryEmailIndex] UTF8String]); - return NS_OK; - } - - return NS_ERROR_FAILURE; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT -} - -NS_IMETHODIMP -nsUserInfo::GetEmailAddress(char **aEmailAddress) -{ - nsAutoCString email; - if (NS_SUCCEEDED(GetPrimaryEmailAddress(email))) - *aEmailAddress = ToNewCString(email); - return NS_OK; -} - -NS_IMETHODIMP -nsUserInfo::GetDomain(char **aDomain) -{ - nsAutoCString email; - if (NS_SUCCEEDED(GetPrimaryEmailAddress(email))) { - int32_t index = email.FindChar('@'); - if (index != -1) { - // chop off everything before, and including the '@' - *aDomain = ToNewCString(Substring(email, index + 1)); - } - } - return NS_OK; -} |