[email protected] | 6ff1c33 | 2023-03-08 10:01:47 | [diff] [blame] | 1 | |
| 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 Wronska | e482265 | 2023-05-22 16:45:23 | [diff] [blame] | 9 | #include <string> |
| 10 | |
Duong Dac | 4e482b02 | 2024-10-04 11:04:51 | [diff] [blame] | 11 | #include "components/supervised_user/core/browser/supervised_user_utils.h" |
[email protected] | 6ff1c33 | 2023-03-08 10:01:47 | [diff] [blame] | 12 | #include "content/public/browser/web_contents.h" |
| 13 | #include "url/gurl.h" |
| 14 | |
Duong Dac | fc89f37 | 2024-08-19 04:20:57 | [diff] [blame] | 15 | namespace content { |
| 16 | class NavigationHandle; |
| 17 | } // namespace content |
| 18 | |
Duong Dac | e474915 | 2023-05-04 19:10:12 | [diff] [blame] | 19 | class ProfileSelections; |
Aga Wronska | e482265 | 2023-05-22 16:45:23 | [diff] [blame] | 20 | class Profile; |
Duong Dac | e474915 | 2023-05-04 19:10:12 | [diff] [blame] | 21 | |
[email protected] | 6ff1c33 | 2023-03-08 10:01:47 | [diff] [blame] | 22 | namespace supervised_user { |
| 23 | |
Duong Dac | e474915 | 2023-05-04 19:10:12 | [diff] [blame] | 24 | // Returns true if both the extensions are enabled and the provided url is a |
| 25 | // Webstore or Download url. |
[email protected] | 6ff1c33 | 2023-03-08 10:01:47 | [diff] [blame] | 26 | bool IsSupportedChromeExtensionURL(const GURL& effective_url); |
| 27 | |
Nohemi Fernandez | 0ff0640 | 2024-08-06 10:07:18 | [diff] [blame] | 28 | // 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. |
| 32 | bool SupervisedUserCanSkipExtensionParentApprovals(const Profile* profile); |
| 33 | |
Liza Bipin | c8f3830 | 2024-08-02 08:39:55 | [diff] [blame] | 34 | // Returns true if the extensions permissions parental control is enabled |
| 35 | // for supervised users. |
| 36 | // Returns false if the user is not supervised. |
| 37 | bool AreExtensionsPermissionsEnabled(Profile* profile); |
| 38 | |
[email protected] | 6ff1c33 | 2023-03-08 10:01:47 | [diff] [blame] | 39 | // Returns true if the parent allowlist should be skipped. |
| 40 | bool ShouldContentSkipParentAllowlistFiltering(content::WebContents* contents); |
| 41 | |
Duong Dac | e474915 | 2023-05-04 19:10:12 | [diff] [blame] | 42 | // Returns how supervised_user factories that are needed in Guest profile |
| 43 | // should be created. |
| 44 | ProfileSelections BuildProfileSelectionsForRegularAndGuest(); |
| 45 | |
Aga Wronska | e482265 | 2023-05-22 16:45:23 | [diff] [blame] | 46 | // Returns given name of the primary account associated with the profile. |
| 47 | std::string GetAccountGivenName(Profile& profile); |
| 48 | |
[email protected] | 503e292 | 2023-06-23 13:38:37 | [diff] [blame] | 49 | // 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. |
| 53 | void AssertChildStatusOfTheUser(Profile* profile, bool is_child); |
| 54 | |
Duong Dac | fc89f37 | 2024-08-19 04:20:57 | [diff] [blame] | 55 | #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 Dac | 4e482b02 | 2024-10-04 11:04:51 | [diff] [blame] | 58 | std::string CreateReauthenticationInterstitialForBlockedSites( |
Duong Dac | fc89f37 | 2024-08-19 04:20:57 | [diff] [blame] | 59 | content::NavigationHandle& navigation_handle, |
Duong Dac | 4e482b02 | 2024-10-04 11:04:51 | [diff] [blame] | 60 | FilteringBehaviorReason block_reason); |
| 61 | |
| 62 | std::string CreateReauthenticationInterstitialForYouTube( |
| 63 | content::NavigationHandle& navigation_handle); |
Duong Dac | fc89f37 | 2024-08-19 04:20:57 | [diff] [blame] | 64 | #endif |
| 65 | |
[email protected] | 6ff1c33 | 2023-03-08 10:01:47 | [diff] [blame] | 66 | } // namespace supervised_user |
| 67 | |
| 68 | #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_BROWSER_UTILS_H_ |