blob: 6857124a045da469f1fd579636f5d07754735db2 [file] [log] [blame]
[email protected]6ff1c332023-03-08 10:01:471
2// Copyright 2023 The Chromium Authors
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5
6#ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_BROWSER_UTILS_H_
7#define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_BROWSER_UTILS_H_
8
Aga Wronskae4822652023-05-22 16:45:239#include <string>
10
Duong Dac4e482b022024-10-04 11:04:5111#include "components/supervised_user/core/browser/supervised_user_utils.h"
[email protected]6ff1c332023-03-08 10:01:4712#include "content/public/browser/web_contents.h"
13#include "url/gurl.h"
14
Duong Dacfc89f372024-08-19 04:20:5715namespace content {
16class NavigationHandle;
17} // namespace content
18
Duong Dace4749152023-05-04 19:10:1219class ProfileSelections;
Aga Wronskae4822652023-05-22 16:45:2320class Profile;
Duong Dace4749152023-05-04 19:10:1221
[email protected]6ff1c332023-03-08 10:01:4722namespace supervised_user {
23
Duong Dace4749152023-05-04 19:10:1224// Returns true if both the extensions are enabled and the provided url is a
25// Webstore or Download url.
[email protected]6ff1c332023-03-08 10:01:4726bool IsSupportedChromeExtensionURL(const GURL& effective_url);
27
Nohemi Fernandez0ff06402024-08-06 10:07:1828// Returns true if the extension handling mode for skipping parent approval is
29// enabled and the parent has authorized installing extensions without their
30// approval.
31// Returns false if the user is not supervised.
32bool SupervisedUserCanSkipExtensionParentApprovals(const Profile* profile);
33
Liza Bipinc8f38302024-08-02 08:39:5534// Returns true if the extensions permissions parental control is enabled
35// for supervised users.
36// Returns false if the user is not supervised.
37bool AreExtensionsPermissionsEnabled(Profile* profile);
38
[email protected]6ff1c332023-03-08 10:01:4739// Returns true if the parent allowlist should be skipped.
40bool ShouldContentSkipParentAllowlistFiltering(content::WebContents* contents);
41
Duong Dace4749152023-05-04 19:10:1242// Returns how supervised_user factories that are needed in Guest profile
43// should be created.
44ProfileSelections BuildProfileSelectionsForRegularAndGuest();
45
Aga Wronskae4822652023-05-22 16:45:2346// Returns given name of the primary account associated with the profile.
47std::string GetAccountGivenName(Profile& profile);
48
[email protected]503e2922023-06-23 13:38:3749// Asserts that `is_child` matches the child status of the primary user.
50// Terminates user session in case of status mismatch in order to prevent
51// supervision incidents. Relevant on Chrome OS platform that has the concept
52// of the user.
53void AssertChildStatusOfTheUser(Profile* profile, bool is_child);
54
Duong Dacfc89f372024-08-19 04:20:5755#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
56// Returns the html content of the reauthentication interstitial for blocked
57// sites. This interstitial is associated with the given NavigationHandle.
Duong Dac4e482b022024-10-04 11:04:5158std::string CreateReauthenticationInterstitialForBlockedSites(
Duong Dacfc89f372024-08-19 04:20:5759 content::NavigationHandle& navigation_handle,
Duong Dac4e482b022024-10-04 11:04:5160 FilteringBehaviorReason block_reason);
61
62std::string CreateReauthenticationInterstitialForYouTube(
63 content::NavigationHandle& navigation_handle);
Duong Dacfc89f372024-08-19 04:20:5764#endif
65
[email protected]6ff1c332023-03-08 10:01:4766} // namespace supervised_user
67
68#endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_BROWSER_UTILS_H_