Bug 1942239 - Add option to explicitly enable incremental origin initialization in...
[gecko.git] / toolkit / components / parentalcontrols / nsParentalControlsServiceAndroid.cpp
blobcdcb7edb3284d02d1022b74fe091826dc3b0c7f3
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 "nsParentalControlsService.h"
7 #include "nsString.h"
8 #include "nsIFile.h"
10 NS_IMPL_ISUPPORTS(nsParentalControlsService, nsIParentalControlsService)
12 nsParentalControlsService::nsParentalControlsService() : mEnabled(false) {}
14 nsParentalControlsService::~nsParentalControlsService() {}
16 NS_IMETHODIMP
17 nsParentalControlsService::GetParentalControlsEnabled(bool* aResult) {
18 *aResult = mEnabled;
19 return NS_OK;
22 NS_IMETHODIMP
23 nsParentalControlsService::GetBlockFileDownloadsEnabled(bool* aResult) {
24 // NOTE: isAllowed returns the opposite intention, so we need to flip it
25 bool res;
26 IsAllowed(nsIParentalControlsService::DOWNLOAD, NULL, &res);
27 *aResult = !res;
29 return NS_OK;
32 NS_IMETHODIMP
33 nsParentalControlsService::GetLoggingEnabled(bool* aResult) {
34 // Android doesn't currently have any method of logging restricted actions.
35 *aResult = false;
36 return NS_OK;
39 NS_IMETHODIMP
40 nsParentalControlsService::Log(int16_t aEntryType, bool aBlocked,
41 nsIURI* aSource, nsIFile* aTarget) {
42 return NS_ERROR_NOT_AVAILABLE;
45 NS_IMETHODIMP
46 nsParentalControlsService::IsAllowed(int16_t aAction, nsIURI* aUri,
47 bool* _retval) {
48 nsresult rv = NS_OK;
49 *_retval = true;
51 if (!mEnabled) {
52 return rv;
55 return NS_ERROR_NOT_AVAILABLE;