blob: f1cb977b9514410ff50c6f777d10af2b23a85a7b [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"
Aga Wronska289815c72020-01-28 21:35:2323#include "chrome/browser/supervised_user/supervised_user_blacklist.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]514fcf22013-08-13 06:37:2426#include "chrome/browser/ui/browser_list_observer.h"
[email protected]12b7af32014-03-13 05:28:2027#include "components/keyed_service/core/keyed_service.h"
brettwb1fc1b82016-02-02 00:19:0828#include "components/prefs/pref_change_registrar.h"
maxbogue455a57e32016-08-14 00:08:3229#include "components/sync/driver/sync_type_preference_provider.h"
Scott Violetc8240b02018-03-08 22:03:5930#include "extensions/buildflags/buildflags.h"
[email protected]c14a6802014-07-11 21:51:1231
brettw00899e62016-11-12 02:10:1732#if BUILDFLAG(ENABLE_EXTENSIONS)
Danan Se5ba3312020-03-05 03:34:5533#include "base/strings/string16.h"
34#include "chrome/browser/ui/supervised_user/parent_permission_dialog.h"
Evan Stade2fad9012019-10-09 18:47:5035#include "extensions/browser/extension_registry.h"
mamire9609642016-06-28 22:17:5436#include "extensions/browser/extension_registry_observer.h"
[email protected]301116c62013-11-26 10:37:4537#include "extensions/browser/management_policy.h"
[email protected]c14a6802014-07-11 21:51:1238#endif
[email protected]0850e842013-01-19 03:44:3139
[email protected]509ad1a92013-03-19 21:41:0640class Browser;
[email protected]4db65f952014-05-20 15:46:3041class PermissionRequestCreator;
Toby Huang20091252020-04-03 03:27:0642class PrefService;
[email protected]0850e842013-01-19 03:44:3143class Profile;
treibab0a39e2014-09-24 14:48:2844class SupervisedUserServiceObserver;
[email protected]cce15bb2014-06-17 13:43:5145class SupervisedUserSettingsService;
46class SupervisedUserSiteList;
47class SupervisedUserURLFilter;
bauerb4da36132014-12-26 19:53:1348class SupervisedUserWhitelistService;
[email protected]0850e842013-01-19 03:44:3149
treibdaece84f2014-09-05 12:58:1550namespace base {
51class FilePath;
treibf832a992015-03-24 18:09:2452class Version;
treibdaece84f2014-09-05 12:58:1553}
54
Danan Se5ba3312020-03-05 03:34:5555#if BUILDFLAG(ENABLE_EXTENSIONS)
Danan Se5ba3312020-03-05 03:34:5556namespace extensions {
57class Extension;
58}
59#endif
60
[email protected]443e9312013-05-06 06:17:3461namespace user_prefs {
62class PrefRegistrySyncable;
63}
64
[email protected]cce15bb2014-06-17 13:43:5165// This class handles all the information related to a given supervised profile
[email protected]0850e842013-01-19 03:44:3166// (e.g. the installed content packs, the default URL filtering behavior, or
67// manual whitelist/blacklist overrides).
[email protected]cce15bb2014-06-17 13:43:5168class SupervisedUserService : public KeyedService,
brettw00899e62016-11-12 02:10:1769#if BUILDFLAG(ENABLE_EXTENSIONS)
mamire9609642016-06-28 22:17:5470 public extensions::ExtensionRegistryObserver,
[email protected]cce15bb2014-06-17 13:43:5171 public extensions::ManagementPolicy::Provider,
[email protected]c14a6802014-07-11 21:51:1272#endif
maxbogue7e006db2016-10-03 19:48:2873 public syncer::SyncTypePreferenceProvider,
jam1c5a91492016-02-24 20:47:5374#if !defined(OS_ANDROID)
cm.sanchia0d6add2017-12-13 04:59:3375 public BrowserListObserver,
bauerb5f8cda92015-10-07 15:36:4476#endif
bauerbce9a1a82014-12-18 13:34:2477 public SupervisedUserURLFilter::Observer {
[email protected]0850e842013-01-19 03:44:3178 public:
Carlos IL6b784a62018-03-20 00:26:4979 using SuccessCallback = base::OnceCallback<void(bool)>;
[email protected]0850e842013-01-19 03:44:3180
[email protected]f085fdd52014-06-11 18:09:2081 class Delegate {
82 public:
83 virtual ~Delegate() {}
84 // Returns true to indicate that the delegate handled the (de)activation, or
[email protected]cce15bb2014-06-17 13:43:5185 // false to indicate that the SupervisedUserService itself should handle it.
[email protected]f085fdd52014-06-11 18:09:2086 virtual bool SetActive(bool active) = 0;
87 };
88
Toby Huang20091252020-04-03 03:27:0689#if BUILDFLAG(ENABLE_EXTENSIONS)
90 // These enum values represent operations to manage the
Toby Huang016f549b2020-05-04 19:50:4791 // kSupervisedUserApprovedExtensions user pref, which stores parent approved
92 // extension ids.
Toby Huang20091252020-04-03 03:27:0693 enum class ApprovedExtensionChange {
94 // Adds a new approved extension to the pref.
Toby Huang016f549b2020-05-04 19:50:4795 kAdd,
Toby Huang20091252020-04-03 03:27:0696 // Removes extension approval.
97 kRemove
98 };
99#endif // BUILDFLAG(ENABLE_EXTENSIONS)
100
dchengc072fff2014-10-21 11:39:05101 ~SupervisedUserService() override;
[email protected]0850e842013-01-19 03:44:31102
[email protected]37ca3fe02013-07-05 15:32:44103 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
[email protected]0850e842013-01-19 03:44:31104
bauerb5f8cda92015-10-07 15:36:44105 // Initializes this object.
106 void Init();
107
[email protected]f085fdd52014-06-11 18:09:20108 void SetDelegate(Delegate* delegate);
109
mmenkedb2637ff2017-03-30 23:59:42110 // Returns the URL filter for filtering navigations and classifying sites in
111 // the history view. Both this method and the returned filter may only be used
112 // on the UI thread.
113 SupervisedUserURLFilter* GetURLFilter();
[email protected]0850e842013-01-19 03:44:31114
bauerb4da36132014-12-26 19:53:13115 // Returns the whitelist service.
116 SupervisedUserWhitelistService* GetWhitelistService();
117
atanasova9572aaf2016-02-26 18:08:26118 const std::vector<scoped_refptr<SupervisedUserSiteList>>& whitelists() const {
119 return whitelists_;
120 }
121
treib8ecc1eb52015-03-04 18:29:06122 // Whether the user can request to get access to blocked URLs or to new
123 // extensions.
[email protected]0369d6ab2013-08-09 01:52:59124 bool AccessRequestsEnabled();
125
treib8ecc1eb52015-03-04 18:29:06126 // Adds an access request for the given URL.
Carlos IL6b784a62018-03-20 00:26:49127 void AddURLAccessRequest(const GURL& url, SuccessCallback callback);
treib8ecc1eb52015-03-04 18:29:06128
mamire9609642016-06-28 22:17:54129 // Get the string used to identify an extension install or update request.
130 // Public for testing.
131 static std::string GetExtensionRequestId(const std::string& extension_id,
132 const base::Version& version);
treib40d3ad92015-10-20 18:15:42133
[email protected]a9c2d642013-05-31 14:37:14134 // Returns the email address of the custodian.
135 std::string GetCustodianEmailAddress() const;
136
Danan Sbef6ca22019-05-09 18:15:54137 // Returns the obfuscated GAIA id of the custodian.
138 std::string GetCustodianObfuscatedGaiaId() const;
139
[email protected]fae057a2013-06-21 22:46:08140 // Returns the name of the custodian, or the email address if the name is
141 // empty.
142 std::string GetCustodianName() const;
143
treib3e7ecf72014-10-24 16:44:07144 // Returns the email address of the second custodian, or the empty string
145 // if there is no second custodian.
146 std::string GetSecondCustodianEmailAddress() const;
147
Danan Sbef6ca22019-05-09 18:15:54148 // Returns the obfuscated GAIA id of the second custodian or the empty
149 // string if there is no second custodian.
150 std::string GetSecondCustodianObfuscatedGaiaId() const;
151
treib3e7ecf72014-10-24 16:44:07152 // Returns the name of the second custodian, or the email address if the name
Danan Sbef6ca22019-05-09 18:15:54153 // is empty, or the empty string if there is no second custodian.
treib3e7ecf72014-10-24 16:44:07154 std::string GetSecondCustodianName() const;
155
treib2170ea02015-10-13 14:55:12156 // Returns a message saying that extensions can only be modified by the
157 // custodian.
158 base::string16 GetExtensionsLockedMessage() const;
159
yilkal190d97c2019-09-06 23:50:03160 bool IsSupervisedUserIframeFilterEnabled() const;
161
Danan Se5ba3312020-03-05 03:34:55162 // Returns true if the user is a type of Family Link Child account,
163 // but will not return true for a Legacy Supervised user (or non child users).
164 bool IsChild() const;
165
166 bool IsSupervisedUserExtensionInstallEnabled() const;
167
168 // Returns true if there is a custodian for the child. A child can have
169 // up to 2 custodians, and this returns true if they have at least 1.
170 bool HasACustodian() const;
171
treibab0a39e2014-09-24 14:48:28172 void AddObserver(SupervisedUserServiceObserver* observer);
173 void RemoveObserver(SupervisedUserServiceObserver* observer);
174
treib531fc7312014-12-09 12:49:20175 void AddPermissionRequestCreator(
dchengf624e472016-04-12 08:33:17176 std::unique_ptr<PermissionRequestCreator> creator);
bauerb646019b12014-10-16 16:23:09177
bauerb5f8cda92015-10-07 15:36:44178 // ProfileKeyedService override:
179 void Shutdown() override;
180
[email protected]3a276ff2014-08-12 14:22:09181 // SyncTypePreferenceProvider implementation:
Marc Treibb3bbf1d22019-03-27 15:45:39182 bool IsEncryptEverythingAllowed() const override;
[email protected]3a276ff2014-08-12 14:22:09183
jam1c5a91492016-02-24 20:47:53184#if !defined(OS_ANDROID)
cm.sanchia0d6add2017-12-13 04:59:33185 // BrowserListObserver implementation:
dchengc072fff2014-10-21 11:39:05186 void OnBrowserSetLastActive(Browser* browser) override;
jam1c5a91492016-02-24 20:47:53187#endif // !defined(OS_ANDROID)
[email protected]dfddd022013-07-10 17:29:48188
bauerbce9a1a82014-12-18 13:34:24189 // SupervisedUserURLFilter::Observer implementation:
190 void OnSiteListUpdated() override;
191
Danan Sc1945912019-06-27 02:56:30192#if !defined(OS_ANDROID)
193 bool signout_required_after_supervision_enabled() {
194 return signout_required_after_supervision_enabled_;
195 }
196 void set_signout_required_after_supervision_enabled() {
197 signout_required_after_supervision_enabled_ = true;
198 }
199#endif // !defined(OS_ANDROID)
200
yilkal921048bd2019-10-09 23:51:04201 void SetPrimaryPermissionCreatorForTest(
202 std::unique_ptr<PermissionRequestCreator> permission_creator);
203
Toby Huang6f0321f2019-11-01 18:03:49204#if BUILDFLAG(ENABLE_EXTENSIONS)
Toby Huang016f549b2020-05-04 19:50:47205 // Updates the set of approved extensions to add approval for |extension|.
206 void AddExtensionApproval(const extensions::Extension& extension);
Danan Se5ba3312020-03-05 03:34:55207
Toby Huang016f549b2020-05-04 19:50:47208 // Updates the set of approved extensions to remove approval for |extension|.
Danan Se5ba3312020-03-05 03:34:55209 void RemoveExtensionApproval(const extensions::Extension& extension);
210
Toby Huang016f549b2020-05-04 19:50:47211 // Wraps UpdateApprovedExtension() for testing. Use this to simulate adding or
212 // removing custodian approval for an extension via sync.
Toby Huang20091252020-04-03 03:27:06213 void UpdateApprovedExtensionForTesting(const std::string& extension_id,
Toby Huang20091252020-04-03 03:27:06214 ApprovedExtensionChange type);
Toby Huang114e9b02019-11-23 02:42:13215
216 bool GetSupervisedUserExtensionsMayRequestPermissionsPref() const;
217
218 void SetSupervisedUserExtensionsMayRequestPermissionsPrefForTesting(
219 bool enabled);
Toby Huang7b4816f2020-02-07 23:54:07220
Danan Se5ba3312020-03-05 03:34:55221 bool CanInstallExtensions() const;
222
223 bool IsExtensionAllowed(const extensions::Extension& extension) const;
Toby Huangb5076a2252020-05-16 02:24:15224
225 void RecordExtensionEnablementUmaMetrics(bool enabled) const;
Toby Huang6f0321f2019-11-01 18:03:49226#endif // BUILDFLAG(ENABLE_EXTENSIONS)
227
[email protected]0850e842013-01-19 03:44:31228 private:
[email protected]cce15bb2014-06-17 13:43:51229 friend class SupervisedUserServiceExtensionTestBase;
230 friend class SupervisedUserServiceFactory;
mamire9609642016-06-28 22:17:54231 FRIEND_TEST_ALL_PREFIXES(
232 SupervisedUserServiceExtensionTest,
233 ExtensionManagementPolicyProviderWithoutSUInitiatedInstalls);
234 FRIEND_TEST_ALL_PREFIXES(
235 SupervisedUserServiceExtensionTest,
236 ExtensionManagementPolicyProviderWithSUInitiatedInstalls);
bauerb95a50682015-01-07 17:04:15237
treib8ecc1eb52015-03-04 18:29:06238 using CreatePermissionRequestCallback =
Carlos IL6b784a62018-03-20 00:26:49239 base::RepeatingCallback<void(PermissionRequestCreator*, SuccessCallback)>;
treib8ecc1eb52015-03-04 18:29:06240
[email protected]cce15bb2014-06-17 13:43:51241 // Use |SupervisedUserServiceFactory::GetForProfile(..)| to get
[email protected]3bf45d02013-07-10 00:03:41242 // an instance of this service.
[email protected]cce15bb2014-06-17 13:43:51243 explicit SupervisedUserService(Profile* profile);
[email protected]3bf45d02013-07-10 00:03:41244
[email protected]f085fdd52014-06-11 18:09:20245 void SetActive(bool active);
246
treib3fce4e92014-09-26 16:06:25247 void OnCustodianInfoChanged();
248
brettw00899e62016-11-12 02:10:17249#if BUILDFLAG(ENABLE_EXTENSIONS)
treibbb9a1962015-02-25 13:40:59250 // extensions::ManagementPolicy::Provider implementation:
251 std::string GetDebugPolicyProviderName() const override;
252 bool UserMayLoad(const extensions::Extension* extension,
253 base::string16* error) const override;
mamire9609642016-06-28 22:17:54254 bool MustRemainDisabled(const extensions::Extension* extension,
Minh X. Nguyen45479012017-08-18 21:35:36255 extensions::disable_reason::DisableReason* reason,
mamire9609642016-06-28 22:17:54256 base::string16* error) const override;
257
258 // extensions::ExtensionRegistryObserver overrides:
259 void OnExtensionInstalled(content::BrowserContext* browser_context,
260 const extensions::Extension* extension,
261 bool is_update) override;
[email protected]0850e842013-01-19 03:44:31262
Danan Se5ba3312020-03-05 03:34:55263 void OnExtensionUninstalled(content::BrowserContext* browser_context,
264 const extensions::Extension* extension,
265 extensions::UninstallReason reason) override;
266
mamir192d7882016-06-22 17:10:16267 // An extension can be in one of the following states:
268 //
Toby Huang114e9b02019-11-23 02:42:13269 // BLOCKED: if kSupervisedUserExtensionsMayRequestPermissions is false and the
270 // child user is attempting to install a new extension or an existing
271 // extension is asking for additional permissions.
mamir192d7882016-06-22 17:10:16272 // ALLOWED: Components, Themes, Default extensions ..etc
273 // are generally allowed. Extensions that have been approved by the
274 // custodian are also allowed.
Toby Huang114e9b02019-11-23 02:42:13275 // REQUIRE_APPROVAL: if it is installed by the child user and
276 // hasn't been approved by the custodian yet.
Toby Huangd7caf252019-10-30 01:11:16277 enum class ExtensionState { BLOCKED, ALLOWED, REQUIRE_APPROVAL };
mamir192d7882016-06-22 17:10:16278
Toby Huang114e9b02019-11-23 02:42:13279 // Returns the state of an extension whether being BLOCKED, ALLOWED or
mamire9609642016-06-28 22:17:54280 // REQUIRE_APPROVAL from the Supervised User service's point of view.
mamir192d7882016-06-22 17:10:16281 ExtensionState GetExtensionState(
mamire9609642016-06-28 22:17:54282 const extensions::Extension& extension) const;
mamir192d7882016-06-22 17:10:16283
Toby Huang05ddf272020-03-21 07:33:04284 // Returns whether we should block an extension based on the state of the
285 // "Permissions for sites, apps and extensions" toggle.
286 bool ShouldBlockExtension(const std::string& extension_id) const;
287
Toby Huang016f549b2020-05-04 19:50:47288 // Enables/Disables extensions upon change in approvals. This function is
289 // idempotent.
mamire9609642016-06-28 22:17:54290 void ChangeExtensionStateIfNecessary(const std::string& extension_id);
Toby Huang20091252020-04-03 03:27:06291
Toby Huang016f549b2020-05-04 19:50:47292 // Updates the synced set of approved extension ids.
293 // Use AddExtensionApproval() or RemoveExtensionApproval() for public access.
294 // If |type| is kAdd, then add approval.
295 // If |type| is kRemove, then remove approval.
296 // Triggers a call to RefreshApprovedExtensionsFromPrefs() via a listener.
297 // TODO(crbug/1072857): We don't need the extension version information. It's
298 // only included for backwards compatibility with previous versions of Chrome.
299 // Remove the version information once a sufficient number of users have
300 // migrated away from M83.
Toby Huang20091252020-04-03 03:27:06301 void UpdateApprovedExtension(const std::string& extension_id,
302 const std::string& version,
303 ApprovedExtensionChange type);
304
Toby Huang016f549b2020-05-04 19:50:47305 // Updates the set of approved extensions when the corresponding preference is
Toby Huang20091252020-04-03 03:27:06306 // changed.
Toby Huang016f549b2020-05-04 19:50:47307 void RefreshApprovedExtensionsFromPrefs();
Toby Huang20091252020-04-03 03:27:06308
309 // Extensions helper to SetActive().
310 void SetExtensionsActive();
Toby Huang6f0321f2019-11-01 18:03:49311#endif // BUILDFLAG(ENABLE_EXTENSIONS)
[email protected]c14a6802014-07-11 21:51:12312
Toby Huang20091252020-04-03 03:27:06313 // Returns the SupervisedUserSettingsService associated with |profile_|.
[email protected]cce15bb2014-06-17 13:43:51314 SupervisedUserSettingsService* GetSettingsService();
[email protected]e861bba2013-06-17 15:20:54315
Toby Huang20091252020-04-03 03:27:06316 // Returns the PrefService associated with |profile_|.
317 PrefService* GetPrefService();
318
bauerbd3a36cc42014-10-01 13:05:49319 size_t FindEnabledPermissionRequestCreator(size_t start);
treib8ecc1eb52015-03-04 18:29:06320 void AddPermissionRequestInternal(
321 const CreatePermissionRequestCallback& create_request,
Carlos IL6b784a62018-03-20 00:26:49322 SuccessCallback callback,
treib8ecc1eb52015-03-04 18:29:06323 size_t index);
324 void OnPermissionRequestIssued(
325 const CreatePermissionRequestCallback& create_request,
Carlos IL6b784a62018-03-20 00:26:49326 SuccessCallback callback,
treib8ecc1eb52015-03-04 18:29:06327 size_t index,
328 bool success);
bauerbd3a36cc42014-10-01 13:05:49329
[email protected]cce15bb2014-06-17 13:43:51330 void OnSupervisedUserIdChanged();
[email protected]f085fdd52014-06-11 18:09:20331
[email protected]0850e842013-01-19 03:44:31332 void OnDefaultFilteringBehaviorChanged();
333
treib9cc1b112016-01-08 10:08:01334 void OnSafeSitesSettingChanged();
335
yilkal87e6cc82020-08-11 17:54:44336 void UpdateAsyncUrlChecker();
337
bauerb95a50682015-01-07 17:04:15338 void OnSiteListsChanged(
339 const std::vector<scoped_refptr<SupervisedUserSiteList>>& site_lists);
[email protected]0850e842013-01-19 03:44:31340
treib2fd187392015-04-16 17:19:38341 // Asynchronously loads a blacklist from a binary file at |path| and applies
342 // it to the URL filters. If no file exists at |path| yet, downloads a file
343 // from |url| and stores it at |path| first.
treibf136dfb2014-09-25 17:37:47344 void LoadBlacklist(const base::FilePath& path, const GURL& url);
345
treib2fd187392015-04-16 17:19:38346 void OnBlacklistFileChecked(const base::FilePath& path,
347 const GURL& url,
348 bool file_exists);
349
350 // Asynchronously loads a blacklist from a binary file at |path| and applies
351 // it to the URL filters.
treibf136dfb2014-09-25 17:37:47352 void LoadBlacklistFromFile(const base::FilePath& path);
353
treibf38cc252016-04-07 14:44:11354 void OnBlacklistDownloadDone(const base::FilePath& path,
355 FileDownloader::Result result);
treib4edbded2014-09-05 08:43:55356
bauerbce9a1a82014-12-18 13:34:24357 void OnBlacklistLoaded();
358
treib9cc1b112016-01-08 10:08:01359 void UpdateBlacklist();
360
[email protected]5e022292013-02-06 16:42:17361 // Updates the manual overrides for hosts in the URL filters when the
362 // corresponding preference is changed.
363 void UpdateManualHosts();
[email protected]0850e842013-01-19 03:44:31364
[email protected]5e022292013-02-06 16:42:17365 // Updates the manual overrides for URLs in the URL filters when the
366 // corresponding preference is changed.
367 void UpdateManualURLs();
[email protected]0850e842013-01-19 03:44:31368
[email protected]12b7af32014-03-13 05:28:20369 // Owns us via the KeyedService mechanism.
[email protected]0850e842013-01-19 03:44:31370 Profile* profile_;
371
[email protected]f085fdd52014-06-11 18:09:20372 bool active_;
373
374 Delegate* delegate_;
375
[email protected]0850e842013-01-19 03:44:31376 PrefChangeRegistrar pref_change_registrar_;
377
[email protected]dfddd022013-07-10 17:29:48378 bool is_profile_active_;
[email protected]a243d644c2013-06-20 18:37:55379
[email protected]3a276ff2014-08-12 14:22:09380 // True only when |Init()| method has been called.
381 bool did_init_;
382
[email protected]3bf45d02013-07-10 00:03:41383 // True only when |Shutdown()| method has been called.
384 bool did_shutdown_;
385
mmenkedb2637ff2017-03-30 23:59:42386 SupervisedUserURLFilter url_filter_;
treib9cc1b112016-01-08 10:08:01387
Toby Huang016f549b2020-05-04 19:50:47388 // Store a set of extension ids approved by the custodian.
mamire9609642016-06-28 22:17:54389 // It is only relevant for SU-initiated installs.
Toby Huang016f549b2020-05-04 19:50:47390 std::set<std::string> approved_extensions_set_;
mamire9609642016-06-28 22:17:54391
treib9cc1b112016-01-08 10:08:01392 enum class BlacklistLoadState {
393 NOT_LOADED,
394 LOAD_STARTED,
395 LOADED
396 } blacklist_state_;
397
398 SupervisedUserBlacklist blacklist_;
dchengf624e472016-04-12 08:33:17399 std::unique_ptr<FileDownloader> blacklist_downloader_;
[email protected]8052b242013-11-15 16:40:55400
dchengf624e472016-04-12 08:33:17401 std::unique_ptr<SupervisedUserWhitelistService> whitelist_service_;
bauerb4da36132014-12-26 19:53:13402
atanasova9572aaf2016-02-26 18:08:26403 std::vector<scoped_refptr<SupervisedUserSiteList>> whitelists_;
404
[email protected]4db65f952014-05-20 15:46:30405 // Used to create permission requests.
leon.han4ea301f2017-03-28 03:36:31406 std::vector<std::unique_ptr<PermissionRequestCreator>> permissions_creators_;
[email protected]4db65f952014-05-20 15:46:30407
brettw00899e62016-11-12 02:10:17408#if BUILDFLAG(ENABLE_EXTENSIONS)
mamire9609642016-06-28 22:17:54409 ScopedObserver<extensions::ExtensionRegistry,
410 extensions::ExtensionRegistryObserver>
Evan Stade2fad9012019-10-09 18:47:50411 registry_observer_{this};
mamire9609642016-06-28 22:17:54412#endif
413
Trent Apteda250ec3ab2018-08-19 08:52:19414 base::ObserverList<SupervisedUserServiceObserver>::Unchecked observer_list_;
treibab0a39e2014-09-24 14:48:28415
Danan Sc1945912019-06-27 02:56:30416#if !defined(OS_ANDROID)
417 bool signout_required_after_supervision_enabled_ = false;
418#endif
419
Jeremy Roman495db682019-07-12 16:03:24420 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_{this};
leon.han4ea301f2017-03-28 03:36:31421
422 DISALLOW_COPY_AND_ASSIGN(SupervisedUserService);
[email protected]0850e842013-01-19 03:44:31423};
424
[email protected]cce15bb2014-06-17 13:43:51425#endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_