mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1006051 - Implement nsIParentalControlsService on the Mac. r=smichaud
This commit is contained in:
parent
ed80aecb7c
commit
a2ba5f4cd6
@ -31,7 +31,7 @@ LOCAL_INCLUDES += [
|
||||
'../url-classifier',
|
||||
]
|
||||
|
||||
if not CONFIG['MOZ_DISABLE_PARENTAL_CONTROLS'] and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
if not CONFIG['MOZ_DISABLE_PARENTAL_CONTROLS']:
|
||||
LOCAL_INCLUDES += [
|
||||
'../parentalcontrols',
|
||||
]
|
||||
|
@ -11,8 +11,8 @@
|
||||
#include "nsUpdateDriver.h"
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
|
||||
#include "nsParentalControlsServiceWin.h"
|
||||
#if !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
|
||||
#include "nsParentalControlsService.h"
|
||||
#endif
|
||||
|
||||
#include "nsAlertsService.h"
|
||||
@ -44,8 +44,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAppStartup, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUserInfo)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFindService)
|
||||
|
||||
#if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParentalControlsServiceWin)
|
||||
#if !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParentalControlsService)
|
||||
#endif
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAlertsService)
|
||||
@ -94,7 +94,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(NativeOSFileInternalsService)
|
||||
NS_DEFINE_NAMED_CID(NS_TOOLKIT_APPSTARTUP_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_USERINFO_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_ALERTSSERVICE_CID);
|
||||
#if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
|
||||
#if !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
|
||||
NS_DEFINE_NAMED_CID(NS_PARENTALCONTROLSSERVICE_CID);
|
||||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_DOWNLOADMANAGER_CID);
|
||||
@ -120,8 +120,8 @@ static const Module::CIDEntry kToolkitCIDs[] = {
|
||||
{ &kNS_TOOLKIT_APPSTARTUP_CID, false, nullptr, nsAppStartupConstructor },
|
||||
{ &kNS_USERINFO_CID, false, nullptr, nsUserInfoConstructor },
|
||||
{ &kNS_ALERTSSERVICE_CID, false, nullptr, nsAlertsServiceConstructor },
|
||||
#if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
|
||||
{ &kNS_PARENTALCONTROLSSERVICE_CID, false, nullptr, nsParentalControlsServiceWinConstructor },
|
||||
#if !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
|
||||
{ &kNS_PARENTALCONTROLSSERVICE_CID, false, nullptr, nsParentalControlsServiceConstructor },
|
||||
#endif
|
||||
{ &kNS_DOWNLOADMANAGER_CID, false, nullptr, nsDownloadManagerConstructor },
|
||||
{ &kNS_DOWNLOADPLATFORM_CID, false, nullptr, DownloadPlatformConstructor },
|
||||
@ -148,7 +148,7 @@ static const Module::ContractIDEntry kToolkitContracts[] = {
|
||||
{ NS_APPSTARTUP_CONTRACTID, &kNS_TOOLKIT_APPSTARTUP_CID },
|
||||
{ NS_USERINFO_CONTRACTID, &kNS_USERINFO_CID },
|
||||
{ NS_ALERTSERVICE_CONTRACTID, &kNS_ALERTSSERVICE_CID },
|
||||
#if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
|
||||
#if !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
|
||||
{ NS_PARENTALCONTROLSSERVICE_CONTRACTID, &kNS_PARENTALCONTROLSSERVICE_CID },
|
||||
#endif
|
||||
{ NS_DOWNLOADMANAGER_CONTRACTID, &kNS_DOWNLOADMANAGER_CID },
|
||||
|
@ -10,8 +10,18 @@ XPIDL_SOURCES += [
|
||||
|
||||
XPIDL_MODULE = 'parentalcontrols'
|
||||
|
||||
if not CONFIG['MOZ_DISABLE_PARENTAL_CONTROLS'] and CONFIG['OS_ARCH'] == 'WINNT':
|
||||
SOURCES += [
|
||||
'nsParentalControlsServiceWin.cpp',
|
||||
]
|
||||
FINAL_LIBRARY = 'toolkitcomps'
|
||||
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',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'toolkitcomps'
|
||||
|
@ -3,38 +3,40 @@
|
||||
* 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 nsParentalControlsServiceWin_h__
|
||||
#define nsParentalControlsServiceWin_h__
|
||||
#ifndef nsParentalControlsService_h__
|
||||
#define nsParentalControlsService_h__
|
||||
|
||||
#include "nsIParentalControlsService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
// wpcevents.h requires this be elevated
|
||||
#if (WINVER < 0x0600)
|
||||
# undef WINVER
|
||||
# define WINVER 0x0600
|
||||
#endif
|
||||
|
||||
#include <wpcapi.h>
|
||||
#include <wpcevent.h>
|
||||
#endif
|
||||
|
||||
class nsParentalControlsServiceWin : public nsIParentalControlsService
|
||||
class nsParentalControlsService : public nsIParentalControlsService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPARENTALCONTROLSSERVICE
|
||||
|
||||
nsParentalControlsServiceWin();
|
||||
virtual ~nsParentalControlsServiceWin();
|
||||
nsParentalControlsService();
|
||||
virtual ~nsParentalControlsService();
|
||||
|
||||
private:
|
||||
bool mEnabled;
|
||||
#if defined(XP_WIN)
|
||||
REGHANDLE mProvider;
|
||||
IWindowsParentalControls * mPC;
|
||||
|
||||
void LogFileDownload(bool blocked, nsIURI *aSource, nsIFile *aTarget);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* nsParentalControlsServiceWin_h__ */
|
||||
#endif /* nsParentalControlsService_h__ */
|
@ -0,0 +1,67 @@
|
||||
/* -*- 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)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsService::GetLoggingEnabled(bool *aResult)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsService::Log(int16_t aEntryType,
|
||||
bool blocked,
|
||||
nsIURI *aSource,
|
||||
nsIFile *aTarget)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsService::RequestURIOverride(nsIURI *aTarget,
|
||||
nsIInterfaceRequestor *aCocoadowContext,
|
||||
bool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsService::RequestURIOverrides(nsIArray *aTargets,
|
||||
nsIInterfaceRequestor *aCocoadowContext,
|
||||
bool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/* -*- 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"
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsParentalControlsService, nsIParentalControlsService)
|
||||
|
||||
nsParentalControlsService::nsParentalControlsService()
|
||||
{
|
||||
}
|
||||
|
||||
nsParentalControlsService::~nsParentalControlsService()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsService::GetParentalControlsEnabled(bool *aResult)
|
||||
{
|
||||
*aResult = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsService::GetBlockFileDownloadsEnabled(bool *aResult)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsService::GetLoggingEnabled(bool *aResult)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsService::Log(int16_t aEntryType,
|
||||
bool blocked,
|
||||
nsIURI *aSource,
|
||||
nsIFile *aTarget)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsService::RequestURIOverride(nsIURI *aTarget,
|
||||
nsIInterfaceRequestor *aCocoadowContext,
|
||||
bool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsService::RequestURIOverrides(nsIArray *aTargets,
|
||||
nsIInterfaceRequestor *aCocoadowContext,
|
||||
bool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
* 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 "nsParentalControlsServiceWin.h"
|
||||
#include "nsParentalControlsService.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIArray.h"
|
||||
#include "nsIWidget.h"
|
||||
@ -17,7 +17,7 @@
|
||||
static const CLSID CLSID_WinParentalControls = {0xE77CC89B,0x7401,0x4C04,{0x8C,0xED,0x14,0x9D,0xB3,0x5A,0xDD,0x04}};
|
||||
static const IID IID_IWinParentalControls = {0x28B4D88B,0xE072,0x49E6,{0x80,0x4D,0x26,0xED,0xBE,0x21,0xA7,0xB9}};
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsParentalControlsServiceWin, nsIParentalControlsService)
|
||||
NS_IMPL_ISUPPORTS(nsParentalControlsService, nsIParentalControlsService)
|
||||
|
||||
static HINSTANCE gAdvAPIDLLInst = nullptr;
|
||||
|
||||
@ -25,7 +25,7 @@ decltype(EventWrite)* gEventWrite = nullptr;
|
||||
decltype(EventRegister)* gEventRegister = nullptr;
|
||||
decltype(EventUnregister)* gEventUnregister = nullptr;
|
||||
|
||||
nsParentalControlsServiceWin::nsParentalControlsServiceWin() :
|
||||
nsParentalControlsService::nsParentalControlsService() :
|
||||
mEnabled(false)
|
||||
, mProvider(0)
|
||||
, mPC(nullptr)
|
||||
@ -60,7 +60,7 @@ nsParentalControlsServiceWin::nsParentalControlsServiceWin() :
|
||||
}
|
||||
}
|
||||
|
||||
nsParentalControlsServiceWin::~nsParentalControlsServiceWin()
|
||||
nsParentalControlsService::~nsParentalControlsService()
|
||||
{
|
||||
if (mPC)
|
||||
mPC->Release();
|
||||
@ -75,7 +75,7 @@ nsParentalControlsServiceWin::~nsParentalControlsServiceWin()
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsServiceWin::GetParentalControlsEnabled(bool *aResult)
|
||||
nsParentalControlsService::GetParentalControlsEnabled(bool *aResult)
|
||||
{
|
||||
*aResult = false;
|
||||
|
||||
@ -86,7 +86,7 @@ nsParentalControlsServiceWin::GetParentalControlsEnabled(bool *aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsServiceWin::GetBlockFileDownloadsEnabled(bool *aResult)
|
||||
nsParentalControlsService::GetBlockFileDownloadsEnabled(bool *aResult)
|
||||
{
|
||||
*aResult = false;
|
||||
|
||||
@ -105,7 +105,7 @@ nsParentalControlsServiceWin::GetBlockFileDownloadsEnabled(bool *aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsServiceWin::GetLoggingEnabled(bool *aResult)
|
||||
nsParentalControlsService::GetLoggingEnabled(bool *aResult)
|
||||
{
|
||||
*aResult = false;
|
||||
|
||||
@ -126,7 +126,7 @@ nsParentalControlsServiceWin::GetLoggingEnabled(bool *aResult)
|
||||
|
||||
// Post a log event to the system
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsServiceWin::Log(int16_t aEntryType, bool blocked, nsIURI *aSource, nsIFile *aTarget)
|
||||
nsParentalControlsService::Log(int16_t aEntryType, bool blocked, nsIURI *aSource, nsIFile *aTarget)
|
||||
{
|
||||
if (!mEnabled)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
@ -163,7 +163,7 @@ nsParentalControlsServiceWin::Log(int16_t aEntryType, bool blocked, nsIURI *aSou
|
||||
|
||||
// Override a single URI
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsServiceWin::RequestURIOverride(nsIURI *aTarget, nsIInterfaceRequestor *aWindowContext, bool *_retval)
|
||||
nsParentalControlsService::RequestURIOverride(nsIURI *aTarget, nsIInterfaceRequestor *aWindowContext, bool *_retval)
|
||||
{
|
||||
*_retval = false;
|
||||
|
||||
@ -199,7 +199,7 @@ nsParentalControlsServiceWin::RequestURIOverride(nsIURI *aTarget, nsIInterfaceRe
|
||||
|
||||
// Override a web page
|
||||
NS_IMETHODIMP
|
||||
nsParentalControlsServiceWin::RequestURIOverrides(nsIArray *aTargets, nsIInterfaceRequestor *aWindowContext, bool *_retval)
|
||||
nsParentalControlsService::RequestURIOverrides(nsIArray *aTargets, nsIInterfaceRequestor *aWindowContext, bool *_retval)
|
||||
{
|
||||
*_retval = false;
|
||||
|
||||
@ -284,7 +284,7 @@ nsParentalControlsServiceWin::RequestURIOverrides(nsIArray *aTargets, nsIInterfa
|
||||
|
||||
// Sends a file download event to the Vista Event Log
|
||||
void
|
||||
nsParentalControlsServiceWin::LogFileDownload(bool blocked, nsIURI *aSource, nsIFile *aTarget)
|
||||
nsParentalControlsService::LogFileDownload(bool blocked, nsIURI *aSource, nsIFile *aTarget)
|
||||
{
|
||||
nsAutoCString curi;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user