blob: 38672ab1ea774ee9882fff6fdcbf0f9d9f829b6a [file] [log] [blame]
[email protected]cce15bb2014-06-17 13:43:511// Copyright 2014 The Chromium Authors. All rights reserved.
[email protected]0850e842013-01-19 03:44:312// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]cce15bb2014-06-17 13:43:515#ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_
6#define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_
[email protected]0850e842013-01-19 03:44:317
avi664c07b2015-12-26 02:18:318#include <stddef.h>
9
dchengf624e472016-04-12 08:33:1710#include <memory>
Toby Huang016f549b2020-05-04 19:50:4711#include <set>
treib950c6e82014-09-23 13:07:2912#include <string>
[email protected]0850e842013-01-19 03:44:3113#include <vector>
14
[email protected]438f7e12013-08-07 06:59:0015#include "base/callback.h"
[email protected]076ebeda2014-06-06 21:47:2616#include "base/gtest_prod_util.h"
avi664c07b2015-12-26 02:18:3117#include "base/macros.h"
treibab0a39e2014-09-24 14:48:2818#include "base/observer_list.h"
[email protected]f2253ac2014-05-28 08:37:2119#include "base/scoped_observer.h"
[email protected]f9b294362013-06-10 20:22:3120#include "base/strings/string16.h"
avi664c07b2015-12-26 02:18:3121#include "build/build_config.h"
treibf38cc252016-04-07 14:44:1122#include "chrome/browser/net/file_downloader.h"
Robbie McElrath2be691ca2020-08-17 20:14:4823#include "chrome/browser/supervised_user/supervised_user_denylist.h"
[email protected]cce15bb2014-06-17 13:43:5124#include "chrome/browser/supervised_user/supervised_user_url_filter.h"
25#include "chrome/browser/supervised_user/supervised_users.h"
[email protected]12b7af32014-03-13 05:28:2026#include "components/keyed_service/core/keyed_service.h"
brettwb1fc1b82016-02-02 00:19:0827#include "components/prefs/pref_change_registrar.h"
maxbogue455a57e32016-08-14 00:08:3228#include "components/sync/driver/sync_type_preference_provider.h"
Scott Violetc8240b02018-03-08 22:03:5929#include "extensions/buildflags/buildflags.h"
[email protected]c14a6802014-07-11 21:51:1230
brettw00899e62016-11-12 02:10:1731#if BUILDFLAG(ENABLE_EXTENSIONS)
Danan Se5ba3312020-03-05 03:34:5532#include "base/strings/string16.h"
33#include "chrome/browser/ui/supervised_user/parent_permission_dialog.h"
Evan Stade2fad9012019-10-09 18:47:5034#include "extensions/browser/extension_registry.h"
mamire9609642016-06-28 22:17:5435#include "extensions/browser/extension_registry_observer.h"
[email protected]301116c62013-11-26 10:37:4536#include "extensions/browser/management_policy.h"
[email protected]c14a6802014-07-11 21:51:1237#endif
[email protected]0850e842013-01-19 03:44:3138
Collin Baker06abf002020-09-24 19:20:1239#if !defined(OS_ANDROID)
40#include "chrome/browser/ui/browser_list_observer.h"
41#endif // !defined(OS_ANDROID)
42
[email protected]4db65f952014-05-20 15:46:3043class PermissionRequestCreator;
Toby Huang20091252020-04-03 03:27:0644class PrefService;
[email protected]0850e842013-01-19 03:44:3145class Profile;
treibab0a39e2014-09-24 14:48:2846class SupervisedUserServiceObserver;
[email protected]cce15bb2014-06-17 13:43:5147class SupervisedUserSettingsService;
48class SupervisedUserSiteList;
49class SupervisedUserURLFilter;
Robbie McElrath2be691ca2020-08-17 20:14:4850class SupervisedUserAllowlistService;
[email protected]0850e842013-01-19 03:44:3151
treibdaece84f2014-09-05 12:58:1552namespace base {
53class FilePath;
treibf832a992015-03-24 18:09:2454class Version;
treibdaece84f2014-09-05 12:58:1555}
56
Danan Se5ba3312020-03-05 03:34:5557#if BUILDFLAG(ENABLE_EXTENSIONS)
Danan Se5ba3312020-03-05 03:34:5558namespace extensions {
59class Extension;
60}
61#endif
62
[email protected]443e9312013-05-06 06:17:3463namespace user_prefs {
64class PrefRegistrySyncable;
65}
66
Collin Baker06abf002020-09-24 19:20:1267#if !defined(OS_ANDROID)
68class Browser;
69#endif // !defined(OS_ANDROID)
70
[email protected]cce15bb2014-06-17 13:43:5171// This class handles all the information related to a given supervised profile
[email protected]0850e842013-01-19 03:44:3172// (e.g. the installed content packs, the default URL filtering behavior, or
Robbie McElrath2be691ca2020-08-17 20:14:4873// manual allowlist/denylist overrides).
[email protected]cce15bb2014-06-17 13:43:5174class SupervisedUserService : public KeyedService,
brettw00899e62016-11-12 02:10:1775#if BUILDFLAG(ENABLE_EXTENSIONS)
mamire9609642016-06-28 22:17:5476 public extensions::ExtensionRegistryObserver,
[email protected]cce15bb2014-06-17 13:43:5177 public extensions::ManagementPolicy::Provider,
[email protected]c14a6802014-07-11 21:51:1278#endif
maxbogue7e006db2016-10-03 19:48:2879 public syncer::SyncTypePreferenceProvider,
jam1c5a91492016-02-24 20:47:5380#if !defined(OS_ANDROID)
cm.sanchia0d6add2017-12-13 04:59:3381 public BrowserListObserver,
bauerb5f8cda92015-10-07 15:36:4482#endif
bauerbce9a1a82014-12-18 13:34:2483 public SupervisedUserURLFilter::Observer {
[email protected]0850e842013-01-19 03:44:3184 public:
Carlos IL6b784a62018-03-20 00:26:4985 using SuccessCallback = base::OnceCallback<void(bool)>;
[email protected]0850e842013-01-19 03:44:3186
[email protected]f085fdd52014-06-11 18:09:2087 class Delegate {
88 public:
89 virtual ~Delegate() {}
90 // Returns true to indicate that the delegate handled the (de)activation, or
[email protected]cce15bb2014-06-17 13:43:5191 // false to indicate that the SupervisedUserService itself should handle it.
[email protected]f085fdd52014-06-11 18:09:2092 virtual bool SetActive(bool active) = 0;
93 };
94
Toby Huang20091252020-04-03 03:27:0695#if BUILDFLAG(ENABLE_EXTENSIONS)
96 // These enum values represent operations to manage the
Toby Huang016f549b2020-05-04 19:50:4797 // kSupervisedUserApprovedExtensions user pref, which stores parent approved
98 // extension ids.
Toby Huang20091252020-04-03 03:27:0699 enum class ApprovedExtensionChange {
100 // Adds a new approved extension to the pref.
Toby Huang016f549b2020-05-04 19:50:47101 kAdd,
Toby Huang20091252020-04-03 03:27:06102 // Removes extension approval.
103 kRemove
104 };
105#endif // BUILDFLAG(ENABLE_EXTENSIONS)
106
dchengc072fff2014-10-21 11:39:05107 ~SupervisedUserService() override;
[email protected]0850e842013-01-19 03:44:31108
[email protected]37ca3fe02013-07-05 15:32:44109 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
[email protected]0850e842013-01-19 03:44:31110
bauerb5f8cda92015-10-07 15:36:44111 // Initializes this object.
112 void Init();
113
[email protected]f085fdd52014-06-11 18:09:20114 void SetDelegate(Delegate* delegate);
115
mmenkedb2637ff2017-03-30 23:59:42116 // Returns the URL filter for filtering navigations and classifying sites in
117 // the history view. Both this method and the returned filter may only be used
118 // on the UI thread.
119 SupervisedUserURLFilter* GetURLFilter();
[email protected]0850e842013-01-19 03:44:31120
Robbie McElrath2be691ca2020-08-17 20:14:48121 // Returns the allowlist service.
122 SupervisedUserAllowlistService* GetAllowlistService();
bauerb4da36132014-12-26 19:53:13123
Robbie McElrath2be691ca2020-08-17 20:14:48124 const std::vector<scoped_refptr<SupervisedUserSiteList>>& allowlists() const {
125 return allowlists_;
atanasova9572aaf2016-02-26 18:08:26126 }
127
treib8ecc1eb52015-03-04 18:29:06128 // Whether the user can request to get access to blocked URLs or to new
129 // extensions.
[email protected]0369d6ab2013-08-09 01:52:59130 bool AccessRequestsEnabled();
131
treib8ecc1eb52015-03-04 18:29:06132 // Adds an access request for the given URL.
Carlos IL6b784a62018-03-20 00:26:49133 void AddURLAccessRequest(const GURL& url, SuccessCallback callback);
treib8ecc1eb52015-03-04 18:29:06134
mamire9609642016-06-28 22:17:54135 // Get the string used to identify an extension install or update request.
136 // Public for testing.
137 static std::string GetExtensionRequestId(const std::string& extension_id,
138 const base::Version& version);
treib40d3ad92015-10-20 18:15:42139
[email protected]a9c2d642013-05-31 14:37:14140 // Returns the email address of the custodian.
141 std::string GetCustodianEmailAddress() const;
142
Danan Sbef6ca22019-05-09 18:15:54143 // Returns the obfuscated GAIA id of the custodian.
144 std::string GetCustodianObfuscatedGaiaId() const;
145
[email protected]fae057a2013-06-21 22:46:08146 // Returns the name of the custodian, or the email address if the name is
147 // empty.
148 std::string GetCustodianName() const;
149
treib3e7ecf72014-10-24 16:44:07150 // Returns the email address of the second custodian, or the empty string
151 // if there is no second custodian.
152 std::string GetSecondCustodianEmailAddress() const;
153
Danan Sbef6ca22019-05-09 18:15:54154 // Returns the obfuscated GAIA id of the second custodian or the empty
155 // string if there is no second custodian.
156 std::string GetSecondCustodianObfuscatedGaiaId() const;
157
treib3e7ecf72014-10-24 16:44:07158 // Returns the name of the second custodian, or the email address if the name
Danan Sbef6ca22019-05-09 18:15:54159 // is empty, or the empty string if there is no second custodian.
treib3e7ecf72014-10-24 16:44:07160 std::string GetSecondCustodianName() const;
161
treib2170ea02015-10-13 14:55:12162 // Returns a message saying that extensions can only be modified by the
163 // custodian.
164 base::string16 GetExtensionsLockedMessage() const;
165
yilkal190d97c2019-09-06 23:50:03166 bool IsSupervisedUserIframeFilterEnabled() const;
167
Danan S8f1b2962020-09-16 19:09:31168 static std::string GetEduCoexistenceLoginUrl();
169
Danan Se5ba3312020-03-05 03:34:55170 // Returns true if the user is a type of Family Link Child account,
171 // but will not return true for a Legacy Supervised user (or non child users).
172 bool IsChild() const;
173
174 bool IsSupervisedUserExtensionInstallEnabled() const;
175
176 // Returns true if there is a custodian for the child. A child can have
177 // up to 2 custodians, and this returns true if they have at least 1.
178 bool HasACustodian() const;
179
treibab0a39e2014-09-24 14:48:28180 void AddObserver(SupervisedUserServiceObserver* observer);
181 void RemoveObserver(SupervisedUserServiceObserver* observer);
182
treib531fc7312014-12-09 12:49:20183 void AddPermissionRequestCreator(
dchengf624e472016-04-12 08:33:17184 std::unique_ptr<PermissionRequestCreator> creator);
bauerb646019b12014-10-16 16:23:09185
bauerb5f8cda92015-10-07 15:36:44186 // ProfileKeyedService override:
187 void Shutdown() override;
188
[email protected]3a276ff2014-08-12 14:22:09189 // SyncTypePreferenceProvider implementation:
Marc Treibb3bbf1d22019-03-27 15:45:39190 bool IsEncryptEverythingAllowed() const override;
[email protected]3a276ff2014-08-12 14:22:09191
jam1c5a91492016-02-24 20:47:53192#if !defined(OS_ANDROID)
cm.sanchia0d6add2017-12-13 04:59:33193 // BrowserListObserver implementation:
dchengc072fff2014-10-21 11:39:05194 void OnBrowserSetLastActive(Browser* browser) override;
jam1c5a91492016-02-24 20:47:53195#endif // !defined(OS_ANDROID)
[email protected]dfddd022013-07-10 17:29:48196
bauerbce9a1a82014-12-18 13:34:24197 // SupervisedUserURLFilter::Observer implementation:
198 void OnSiteListUpdated() override;
199
Danan Sc1945912019-06-27 02:56:30200#if !defined(OS_ANDROID)
201 bool signout_required_after_supervision_enabled() {
202 return signout_required_after_supervision_enabled_;
203 }
204 void set_signout_required_after_supervision_enabled() {
205 signout_required_after_supervision_enabled_ = true;
206 }
207#endif // !defined(OS_ANDROID)
208
yilkal921048bd2019-10-09 23:51:04209 void SetPrimaryPermissionCreatorForTest(
210 std::unique_ptr<PermissionRequestCreator> permission_creator);
211
Toby Huang6f0321f2019-11-01 18:03:49212#if BUILDFLAG(ENABLE_EXTENSIONS)
Toby Huang016f549b2020-05-04 19:50:47213 // Updates the set of approved extensions to add approval for |extension|.
214 void AddExtensionApproval(const extensions::Extension& extension);
Danan Se5ba3312020-03-05 03:34:55215
Toby Huang016f549b2020-05-04 19:50:47216 // Updates the set of approved extensions to remove approval for |extension|.
Danan Se5ba3312020-03-05 03:34:55217 void RemoveExtensionApproval(const extensions::Extension& extension);
218
Toby Huang016f549b2020-05-04 19:50:47219 // Wraps UpdateApprovedExtension() for testing. Use this to simulate adding or
220 // removing custodian approval for an extension via sync.
Toby Huang20091252020-04-03 03:27:06221 void UpdateApprovedExtensionForTesting(const std::string& extension_id,
Toby Huang20091252020-04-03 03:27:06222 ApprovedExtensionChange type);
Toby Huang114e9b02019-11-23 02:42:13223
224 bool GetSupervisedUserExtensionsMayRequestPermissionsPref() const;
225
226 void SetSupervisedUserExtensionsMayRequestPermissionsPrefForTesting(
227 bool enabled);
Toby Huang7b4816f2020-02-07 23:54:07228
Danan Se5ba3312020-03-05 03:34:55229 bool CanInstallExtensions() const;
230
231 bool IsExtensionAllowed(const extensions::Extension& extension) const;
Toby Huangb5076a2252020-05-16 02:24:15232
233 void RecordExtensionEnablementUmaMetrics(bool enabled) const;
Toby Huang6f0321f2019-11-01 18:03:49234#endif // BUILDFLAG(ENABLE_EXTENSIONS)
235
[email protected]0850e842013-01-19 03:44:31236 private:
[email protected]cce15bb2014-06-17 13:43:51237 friend class SupervisedUserServiceExtensionTestBase;
238 friend class SupervisedUserServiceFactory;
mamire9609642016-06-28 22:17:54239 FRIEND_TEST_ALL_PREFIXES(
240 SupervisedUserServiceExtensionTest,
241 ExtensionManagementPolicyProviderWithoutSUInitiatedInstalls);
242 FRIEND_TEST_ALL_PREFIXES(
243 SupervisedUserServiceExtensionTest,
244 ExtensionManagementPolicyProviderWithSUInitiatedInstalls);
bauerb95a50682015-01-07 17:04:15245
treib8ecc1eb52015-03-04 18:29:06246 using CreatePermissionRequestCallback =
Carlos IL6b784a62018-03-20 00:26:49247 base::RepeatingCallback<void(PermissionRequestCreator*, SuccessCallback)>;
treib8ecc1eb52015-03-04 18:29:06248
[email protected]cce15bb2014-06-17 13:43:51249 // Use |SupervisedUserServiceFactory::GetForProfile(..)| to get
[email protected]3bf45d02013-07-10 00:03:41250 // an instance of this service.
[email protected]cce15bb2014-06-17 13:43:51251 explicit SupervisedUserService(Profile* profile);
[email protected]3bf45d02013-07-10 00:03:41252
[email protected]f085fdd52014-06-11 18:09:20253 void SetActive(bool active);
254
treib3fce4e92014-09-26 16:06:25255 void OnCustodianInfoChanged();
256
brettw00899e62016-11-12 02:10:17257#if BUILDFLAG(ENABLE_EXTENSIONS)
treibbb9a1962015-02-25 13:40:59258 // extensions::ManagementPolicy::Provider implementation:
259 std::string GetDebugPolicyProviderName() const override;
260 bool UserMayLoad(const extensions::Extension* extension,
261 base::string16* error) const override;
mamire9609642016-06-28 22:17:54262 bool MustRemainDisabled(const extensions::Extension* extension,
Minh X. Nguyen45479012017-08-18 21:35:36263 extensions::disable_reason::DisableReason* reason,
mamire9609642016-06-28 22:17:54264 base::string16* error) const override;
265
266 // extensions::ExtensionRegistryObserver overrides:
267 void OnExtensionInstalled(content::BrowserContext* browser_context,
268 const extensions::Extension* extension,
269 bool is_update) override;
[email protected]0850e842013-01-19 03:44:31270
Danan Se5ba3312020-03-05 03:34:55271 void OnExtensionUninstalled(content::BrowserContext* browser_context,
272 const extensions::Extension* extension,
273 extensions::UninstallReason reason) override;
274
mamir192d7882016-06-22 17:10:16275 // An extension can be in one of the following states:
276 //
Toby Huang114e9b02019-11-23 02:42:13277 // BLOCKED: if kSupervisedUserExtensionsMayRequestPermissions is false and the
278 // child user is attempting to install a new extension or an existing
279 // extension is asking for additional permissions.
mamir192d7882016-06-22 17:10:16280 // ALLOWED: Components, Themes, Default extensions ..etc
281 // are generally allowed. Extensions that have been approved by the
282 // custodian are also allowed.
Toby Huang114e9b02019-11-23 02:42:13283 // REQUIRE_APPROVAL: if it is installed by the child user and
284 // hasn't been approved by the custodian yet.
Toby Huangd7caf252019-10-30 01:11:16285 enum class ExtensionState { BLOCKED, ALLOWED, REQUIRE_APPROVAL };
mamir192d7882016-06-22 17:10:16286
Toby Huang114e9b02019-11-23 02:42:13287 // Returns the state of an extension whether being BLOCKED, ALLOWED or
mamire9609642016-06-28 22:17:54288 // REQUIRE_APPROVAL from the Supervised User service's point of view.
mamir192d7882016-06-22 17:10:16289 ExtensionState GetExtensionState(
mamire9609642016-06-28 22:17:54290 const extensions::Extension& extension) const;
mamir192d7882016-06-22 17:10:16291
Toby Huang05ddf272020-03-21 07:33:04292 // Returns whether we should block an extension based on the state of the
293 // "Permissions for sites, apps and extensions" toggle.
294 bool ShouldBlockExtension(const std::string& extension_id) const;
295
Toby Huang016f549b2020-05-04 19:50:47296 // Enables/Disables extensions upon change in approvals. This function is
297 // idempotent.
mamire9609642016-06-28 22:17:54298 void ChangeExtensionStateIfNecessary(const std::string& extension_id);
Toby Huang20091252020-04-03 03:27:06299
Toby Huang016f549b2020-05-04 19:50:47300 // Updates the synced set of approved extension ids.
301 // Use AddExtensionApproval() or RemoveExtensionApproval() for public access.
302 // If |type| is kAdd, then add approval.
303 // If |type| is kRemove, then remove approval.
304 // Triggers a call to RefreshApprovedExtensionsFromPrefs() via a listener.
305 // TODO(crbug/1072857): We don't need the extension version information. It's
306 // only included for backwards compatibility with previous versions of Chrome.
307 // Remove the version information once a sufficient number of users have
308 // migrated away from M83.
Toby Huang20091252020-04-03 03:27:06309 void UpdateApprovedExtension(const std::string& extension_id,
310 const std::string& version,
311 ApprovedExtensionChange type);
312
Toby Huang016f549b2020-05-04 19:50:47313 // Updates the set of approved extensions when the corresponding preference is
Toby Huang20091252020-04-03 03:27:06314 // changed.
Toby Huang016f549b2020-05-04 19:50:47315 void RefreshApprovedExtensionsFromPrefs();
Toby Huang20091252020-04-03 03:27:06316
317 // Extensions helper to SetActive().
318 void SetExtensionsActive();
Toby Huang6f0321f2019-11-01 18:03:49319#endif // BUILDFLAG(ENABLE_EXTENSIONS)
[email protected]c14a6802014-07-11 21:51:12320
Toby Huang20091252020-04-03 03:27:06321 // Returns the SupervisedUserSettingsService associated with |profile_|.
[email protected]cce15bb2014-06-17 13:43:51322 SupervisedUserSettingsService* GetSettingsService();
[email protected]e861bba2013-06-17 15:20:54323
Toby Huang20091252020-04-03 03:27:06324 // Returns the PrefService associated with |profile_|.
325 PrefService* GetPrefService();
326
bauerbd3a36cc42014-10-01 13:05:49327 size_t FindEnabledPermissionRequestCreator(size_t start);
treib8ecc1eb52015-03-04 18:29:06328 void AddPermissionRequestInternal(
329 const CreatePermissionRequestCallback& create_request,
Carlos IL6b784a62018-03-20 00:26:49330 SuccessCallback callback,
treib8ecc1eb52015-03-04 18:29:06331 size_t index);
332 void OnPermissionRequestIssued(
333 const CreatePermissionRequestCallback& create_request,
Carlos IL6b784a62018-03-20 00:26:49334 SuccessCallback callback,
treib8ecc1eb52015-03-04 18:29:06335 size_t index,
336 bool success);
bauerbd3a36cc42014-10-01 13:05:49337
[email protected]cce15bb2014-06-17 13:43:51338 void OnSupervisedUserIdChanged();
[email protected]f085fdd52014-06-11 18:09:20339
[email protected]0850e842013-01-19 03:44:31340 void OnDefaultFilteringBehaviorChanged();
341
treib9cc1b112016-01-08 10:08:01342 void OnSafeSitesSettingChanged();
343
yilkal87e6cc82020-08-11 17:54:44344 void UpdateAsyncUrlChecker();
345
bauerb95a50682015-01-07 17:04:15346 void OnSiteListsChanged(
347 const std::vector<scoped_refptr<SupervisedUserSiteList>>& site_lists);
[email protected]0850e842013-01-19 03:44:31348
Robbie McElrath2be691ca2020-08-17 20:14:48349 // Asynchronously loads a denylist from a binary file at |path| and applies
treib2fd187392015-04-16 17:19:38350 // it to the URL filters. If no file exists at |path| yet, downloads a file
351 // from |url| and stores it at |path| first.
Robbie McElrath2be691ca2020-08-17 20:14:48352 void LoadDenylist(const base::FilePath& path, const GURL& url);
treibf136dfb2014-09-25 17:37:47353
Robbie McElrath2be691ca2020-08-17 20:14:48354 void OnDenylistFileChecked(const base::FilePath& path,
355 const GURL& url,
356 bool file_exists);
treib2fd187392015-04-16 17:19:38357
Robbie McElrath2be691ca2020-08-17 20:14:48358 // Asynchronously loads a denylist from a binary file at |path| and applies
treib2fd187392015-04-16 17:19:38359 // it to the URL filters.
Robbie McElrath2be691ca2020-08-17 20:14:48360 void LoadDenylistFromFile(const base::FilePath& path);
treibf136dfb2014-09-25 17:37:47361
Robbie McElrath2be691ca2020-08-17 20:14:48362 void OnDenylistDownloadDone(const base::FilePath& path,
363 FileDownloader::Result result);
treib4edbded2014-09-05 08:43:55364
Robbie McElrath2be691ca2020-08-17 20:14:48365 void OnDenylistLoaded();
bauerbce9a1a82014-12-18 13:34:24366
Robbie McElrath2be691ca2020-08-17 20:14:48367 void UpdateDenylist();
treib9cc1b112016-01-08 10:08:01368
[email protected]5e022292013-02-06 16:42:17369 // Updates the manual overrides for hosts in the URL filters when the
370 // corresponding preference is changed.
371 void UpdateManualHosts();
[email protected]0850e842013-01-19 03:44:31372
[email protected]5e022292013-02-06 16:42:17373 // Updates the manual overrides for URLs in the URL filters when the
374 // corresponding preference is changed.
375 void UpdateManualURLs();
[email protected]0850e842013-01-19 03:44:31376
[email protected]12b7af32014-03-13 05:28:20377 // Owns us via the KeyedService mechanism.
[email protected]0850e842013-01-19 03:44:31378 Profile* profile_;
379
[email protected]f085fdd52014-06-11 18:09:20380 bool active_;
381
382 Delegate* delegate_;
383
[email protected]0850e842013-01-19 03:44:31384 PrefChangeRegistrar pref_change_registrar_;
385
[email protected]dfddd022013-07-10 17:29:48386 bool is_profile_active_;
[email protected]a243d644c2013-06-20 18:37:55387
[email protected]3a276ff2014-08-12 14:22:09388 // True only when |Init()| method has been called.
389 bool did_init_;
390
[email protected]3bf45d02013-07-10 00:03:41391 // True only when |Shutdown()| method has been called.
392 bool did_shutdown_;
393
mmenkedb2637ff2017-03-30 23:59:42394 SupervisedUserURLFilter url_filter_;
treib9cc1b112016-01-08 10:08:01395
Toby Huang016f549b2020-05-04 19:50:47396 // Store a set of extension ids approved by the custodian.
mamire9609642016-06-28 22:17:54397 // It is only relevant for SU-initiated installs.
Toby Huang016f549b2020-05-04 19:50:47398 std::set<std::string> approved_extensions_set_;
mamire9609642016-06-28 22:17:54399
Robbie McElrath2be691ca2020-08-17 20:14:48400 enum class DenylistLoadState {
treib9cc1b112016-01-08 10:08:01401 NOT_LOADED,
402 LOAD_STARTED,
403 LOADED
Robbie McElrath2be691ca2020-08-17 20:14:48404 } denylist_state_;
treib9cc1b112016-01-08 10:08:01405
Robbie McElrath2be691ca2020-08-17 20:14:48406 SupervisedUserDenylist denylist_;
407 std::unique_ptr<FileDownloader> denylist_downloader_;
[email protected]8052b242013-11-15 16:40:55408
Robbie McElrath2be691ca2020-08-17 20:14:48409 std::unique_ptr<SupervisedUserAllowlistService> allowlist_service_;
bauerb4da36132014-12-26 19:53:13410
Robbie McElrath2be691ca2020-08-17 20:14:48411 std::vector<scoped_refptr<SupervisedUserSiteList>> allowlists_;
atanasova9572aaf2016-02-26 18:08:26412
[email protected]4db65f952014-05-20 15:46:30413 // Used to create permission requests.
leon.han4ea301f2017-03-28 03:36:31414 std::vector<std::unique_ptr<PermissionRequestCreator>> permissions_creators_;
[email protected]4db65f952014-05-20 15:46:30415
brettw00899e62016-11-12 02:10:17416#if BUILDFLAG(ENABLE_EXTENSIONS)
mamire9609642016-06-28 22:17:54417 ScopedObserver<extensions::ExtensionRegistry,
418 extensions::ExtensionRegistryObserver>
Evan Stade2fad9012019-10-09 18:47:50419 registry_observer_{this};
mamire9609642016-06-28 22:17:54420#endif
421
Trent Apteda250ec3ab2018-08-19 08:52:19422 base::ObserverList<SupervisedUserServiceObserver>::Unchecked observer_list_;
treibab0a39e2014-09-24 14:48:28423
Danan Sc1945912019-06-27 02:56:30424#if !defined(OS_ANDROID)
425 bool signout_required_after_supervision_enabled_ = false;
426#endif
427
Jeremy Roman495db682019-07-12 16:03:24428 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_{this};
leon.han4ea301f2017-03-28 03:36:31429
430 DISALLOW_COPY_AND_ASSIGN(SupervisedUserService);
[email protected]0850e842013-01-19 03:44:31431};
432
[email protected]cce15bb2014-06-17 13:43:51433#endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_