1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/supervised_user/core/common/features.h"
#include <string>
#include "base/check.h"
#include "base/check_op.h"
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "build/android_buildflags.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
namespace supervised_user {
// Enables local parent approvals for the blocked website on the Family Link
// user's device.
BASE_FEATURE(kLocalWebApprovals,
"LocalWebApprovals",
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
base::FEATURE_ENABLED_BY_DEFAULT);
#else
base::FEATURE_DISABLED_BY_DEFAULT);
#endif
// TODO(crbug.com/391799078): Support local web approval for subframes on
// Desktop.
BASE_FEATURE(kAllowSubframeLocalWebApprovals,
"AllowSubframeLocalWebApprovals",
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
base::FEATURE_ENABLED_BY_DEFAULT);
#else
base::FEATURE_DISABLED_BY_DEFAULT);
#endif
#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
BUILDFLAG(IS_WIN)
const int kLocalWebApprovalBottomSheetLoadTimeoutDefaultValueMs = 5000;
const base::FeatureParam<int> kLocalWebApprovalBottomSheetLoadTimeoutMs{
&kLocalWebApprovals, /*name=*/"LocalWebApprovalBottomSheetLoadTimeoutMs",
kLocalWebApprovalBottomSheetLoadTimeoutDefaultValueMs};
#endif // BUILDFLAG(IS_IOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
// BUILDFLAG(IS_WIN)
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
BASE_FEATURE(kEnableLocalWebApprovalErrorDialog,
"EnableLocalWebApprovalErrorDialog",
base::FEATURE_ENABLED_BY_DEFAULT);
#endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
BASE_FEATURE(kLocalWebApprovalsWidgetSupportsUrlPayload,
"PacpWidgetSupportsUrlPayload",
base::FEATURE_ENABLED_BY_DEFAULT);
BASE_FEATURE(kSupervisedUserBlockInterstitialV3,
"SupervisedUserBlockInterstitialV3",
base::FEATURE_DISABLED_BY_DEFAULT);
bool IsGoogleBrandedBuild() {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return true;
#else
return false;
#endif
}
bool IsBlockInterstitialV3Enabled() {
return base::FeatureList::IsEnabled(kSupervisedUserBlockInterstitialV3);
}
bool IsLocalWebApprovalsEnabled() {
// TODO(crbug.com/1272462, b/261729051):
// Move this logic to SupervisedUserService, once it's migrated to
// components, and de-release the intended usage of
// WebsiteParentApproval::IsLocalApprovalSupported for Android.
#if BUILDFLAG(IS_ANDROID)
return base::FeatureList::IsEnabled(kLocalWebApprovals) &&
IsGoogleBrandedBuild();
#else
return base::FeatureList::IsEnabled(kLocalWebApprovals);
#endif
}
bool IsLocalWebApprovalsEnabledForSubframes() {
return base::FeatureList::IsEnabled(kAllowSubframeLocalWebApprovals);
}
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
BASE_FEATURE(kCustomProfileStringsForSupervisedUsers,
"CustomProfileStringsForSupervisedUsers",
base::FEATURE_ENABLED_BY_DEFAULT);
BASE_FEATURE(kShowKiteForSupervisedUsers,
"ShowKiteForSupervisedUsers",
base::FEATURE_ENABLED_BY_DEFAULT);
#endif
BASE_FEATURE(kForceSafeSearchForUnauthenticatedSupervisedUsers,
"ForceSafeSearchForUnauthenticatedSupervisedUsers",
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
base::FEATURE_ENABLED_BY_DEFAULT);
#else
base::FEATURE_DISABLED_BY_DEFAULT);
#endif
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
BASE_FEATURE(kEnableSupervisedUserVersionSignOutDialog,
"EnableSupervisedUserVersionSignOutDialog",
base::FEATURE_ENABLED_BY_DEFAULT);
#endif
// TODO: crbug.com/378636321 - Clean up the
// kUncredentialedFilteringFallbackForSupervisedUsers and
// kWaitUntilAccessTokenAvailableForClassifyUrl flags, by inlining the
// platform #defines.
BASE_FEATURE(kUncredentialedFilteringFallbackForSupervisedUsers,
"UncredentialedFilteringFallbackForSupervisedUsers",
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
base::FEATURE_ENABLED_BY_DEFAULT);
#else
base::FEATURE_DISABLED_BY_DEFAULT);
#endif
BASE_FEATURE(kWaitUntilAccessTokenAvailableForClassifyUrl,
"WaitUntilAccessTokenAvailableForClassifyUrl",
#if BUILDFLAG(IS_ANDROID)
// Android enforces at the OS level that supervised users must have
// valid sign in credentials (and triggers a reauth if not). We can
// therefore wait for a valid access token to be available before
// calling ClassifyUrl, to avoid window conditions where the access
// token is not yet available (eg. during startup).
base::FEATURE_ENABLED_BY_DEFAULT
#else
// Other platforms don't enforce this, and we therefore cannot
// wait for access tokens in Chrome.
base::FEATURE_DISABLED_BY_DEFAULT
#endif
);
BASE_FEATURE(kAlignSafeSitesValueWithBrowserDefault,
"AlignSafeSitesValueWithBrowserDefault",
base::FEATURE_ENABLED_BY_DEFAULT);
BASE_FEATURE(kDecoupleSafeSitesFromMainSwitch,
"DecoupleSafeSitesFromMainSwitch",
base::FEATURE_ENABLED_BY_DEFAULT);
} // namespace supervised_user
|