blob: 6bc35710d465cdb9d77628100dd01b7adc3b09f8 [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
treib950c6e82014-09-23 13:07:2910#include <map>
dchengf624e472016-04-12 08:33:1711#include <memory>
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"
atanasovaac676032016-04-05 16:31:0523#include "chrome/browser/supervised_user/experimental/safe_search_url_reporter.h"
treib4edbded2014-09-05 08:43:5524#include "chrome/browser/supervised_user/experimental/supervised_user_blacklist.h"
[email protected]cce15bb2014-06-17 13:43:5125#include "chrome/browser/supervised_user/supervised_user_url_filter.h"
26#include "chrome/browser/supervised_user/supervised_users.h"
[email protected]514fcf22013-08-13 06:37:2427#include "chrome/browser/ui/browser_list_observer.h"
[email protected]12b7af32014-03-13 05:28:2028#include "components/keyed_service/core/keyed_service.h"
brettwb1fc1b82016-02-02 00:19:0829#include "components/prefs/pref_change_registrar.h"
maxbogue455a57e32016-08-14 00:08:3230#include "components/sync/driver/sync_service_observer.h"
31#include "components/sync/driver/sync_type_preference_provider.h"
brettw00899e62016-11-12 02:10:1732#include "extensions/features/features.h"
maxbogue8e4fb452015-02-11 20:26:0933#include "net/url_request/url_request_context_getter.h"
[email protected]c14a6802014-07-11 21:51:1234
brettw00899e62016-11-12 02:10:1735#if BUILDFLAG(ENABLE_EXTENSIONS)
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]acfcfbb2013-05-13 18:01:2741class GoogleServiceAuthError;
[email protected]4db65f952014-05-20 15:46:3042class PermissionRequestCreator;
[email protected]0850e842013-01-19 03:44:3143class Profile;
[email protected]cce15bb2014-06-17 13:43:5144class SupervisedUserRegistrationUtility;
treibab0a39e2014-09-24 14:48:2845class SupervisedUserServiceObserver;
[email protected]cce15bb2014-06-17 13:43:5146class SupervisedUserSettingsService;
47class SupervisedUserSiteList;
48class SupervisedUserURLFilter;
bauerb4da36132014-12-26 19:53:1349class SupervisedUserWhitelistService;
[email protected]0850e842013-01-19 03:44:3150
treibdaece84f2014-09-05 12:58:1551namespace base {
52class FilePath;
treibf832a992015-03-24 18:09:2453class Version;
treibdaece84f2014-09-05 12:58:1554}
55
treib565a0192014-12-04 13:17:3156namespace content {
57class WebContents;
58}
59
[email protected]f2253ac2014-05-28 08:37:2160namespace extensions {
61class ExtensionRegistry;
62}
63
maxbogue7e006db2016-10-03 19:48:2864namespace syncer {
tommyclif3a1551e2016-06-21 18:11:2365class SyncSetupInProgressHandle;
66}
67
[email protected]443e9312013-05-06 06:17:3468namespace user_prefs {
69class PrefRegistrySyncable;
70}
71
[email protected]cce15bb2014-06-17 13:43:5172// This class handles all the information related to a given supervised profile
[email protected]0850e842013-01-19 03:44:3173// (e.g. the installed content packs, the default URL filtering behavior, or
74// manual whitelist/blacklist overrides).
[email protected]cce15bb2014-06-17 13:43:5175class SupervisedUserService : public KeyedService,
brettw00899e62016-11-12 02:10:1776#if BUILDFLAG(ENABLE_EXTENSIONS)
mamire9609642016-06-28 22:17:5477 public extensions::ExtensionRegistryObserver,
[email protected]cce15bb2014-06-17 13:43:5178 public extensions::ManagementPolicy::Provider,
[email protected]c14a6802014-07-11 21:51:1279#endif
maxbogue7e006db2016-10-03 19:48:2880 public syncer::SyncTypePreferenceProvider,
jam1c5a91492016-02-24 20:47:5381#if !defined(OS_ANDROID)
maxbogue7e006db2016-10-03 19:48:2882 public syncer::SyncServiceObserver,
bauerbce9a1a82014-12-18 13:34:2483 public chrome::BrowserListObserver,
bauerb5f8cda92015-10-07 15:36:4484#endif
bauerbce9a1a82014-12-18 13:34:2485 public SupervisedUserURLFilter::Observer {
[email protected]0850e842013-01-19 03:44:3186 public:
treib8ecc1eb52015-03-04 18:29:0687 using NavigationBlockedCallback = base::Callback<void(content::WebContents*)>;
88 using AuthErrorCallback = base::Callback<void(const GoogleServiceAuthError&)>;
89 using SuccessCallback = base::Callback<void(bool)>;
[email protected]0850e842013-01-19 03:44:3190
[email protected]f085fdd52014-06-11 18:09:2091 class Delegate {
92 public:
93 virtual ~Delegate() {}
94 // Returns true to indicate that the delegate handled the (de)activation, or
[email protected]cce15bb2014-06-17 13:43:5195 // false to indicate that the SupervisedUserService itself should handle it.
[email protected]f085fdd52014-06-11 18:09:2096 virtual bool SetActive(bool active) = 0;
[email protected]f085fdd52014-06-11 18:09:2097 };
98
dchengc072fff2014-10-21 11:39:0599 ~SupervisedUserService() override;
[email protected]0850e842013-01-19 03:44:31100
[email protected]37ca3fe02013-07-05 15:32:44101 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
[email protected]0850e842013-01-19 03:44:31102
bauerb5f8cda92015-10-07 15:36:44103 // Initializes this object.
104 void Init();
105
[email protected]f085fdd52014-06-11 18:09:20106 void SetDelegate(Delegate* delegate);
107
mmenkedb2637ff2017-03-30 23:59:42108 // Returns the URL filter for filtering navigations and classifying sites in
109 // the history view. Both this method and the returned filter may only be used
110 // on the UI thread.
111 SupervisedUserURLFilter* GetURLFilter();
[email protected]0850e842013-01-19 03:44:31112
bauerb4da36132014-12-26 19:53:13113 // Returns the whitelist service.
114 SupervisedUserWhitelistService* GetWhitelistService();
115
atanasova9572aaf2016-02-26 18:08:26116 const std::vector<scoped_refptr<SupervisedUserSiteList>>& whitelists() const {
117 return whitelists_;
118 }
119
treib8ecc1eb52015-03-04 18:29:06120 // Whether the user can request to get access to blocked URLs or to new
121 // extensions.
[email protected]0369d6ab2013-08-09 01:52:59122 bool AccessRequestsEnabled();
123
treib8ecc1eb52015-03-04 18:29:06124 // Adds an access request for the given URL.
125 void AddURLAccessRequest(const GURL& url, const SuccessCallback& callback);
126
atanasovaac676032016-04-05 16:31:05127 // Reports |url| to the SafeSearch API, because the user thinks this is an
128 // inappropriate URL.
129 void ReportURL(const GURL& url, const SuccessCallback& callback);
130
mamire9609642016-06-28 22:17:54131 // Adds an install request for the given WebStore item (App/Extension).
132 void AddExtensionInstallRequest(const std::string& extension_id,
133 const base::Version& version,
134 const SuccessCallback& callback);
135
136 // Same as above, but without a callback, just logging errors on failure.
137 void AddExtensionInstallRequest(const std::string& extension_id,
138 const base::Version& version);
139
treib8ecc1eb52015-03-04 18:29:06140 // Adds an update request for the given WebStore item (App/Extension).
141 void AddExtensionUpdateRequest(const std::string& extension_id,
treibf832a992015-03-24 18:09:24142 const base::Version& version,
treib8ecc1eb52015-03-04 18:29:06143 const SuccessCallback& callback);
[email protected]e861bba2013-06-17 15:20:54144
treib40d3ad92015-10-20 18:15:42145 // Same as above, but without a callback, just logging errors on failure.
146 void AddExtensionUpdateRequest(const std::string& extension_id,
147 const base::Version& version);
148
mamire9609642016-06-28 22:17:54149 // Get the string used to identify an extension install or update request.
150 // Public for testing.
151 static std::string GetExtensionRequestId(const std::string& extension_id,
152 const base::Version& version);
treib40d3ad92015-10-20 18:15:42153
[email protected]a9c2d642013-05-31 14:37:14154 // Returns the email address of the custodian.
155 std::string GetCustodianEmailAddress() const;
156
[email protected]fae057a2013-06-21 22:46:08157 // Returns the name of the custodian, or the email address if the name is
158 // empty.
159 std::string GetCustodianName() const;
160
treib3e7ecf72014-10-24 16:44:07161 // Returns the email address of the second custodian, or the empty string
162 // if there is no second custodian.
163 std::string GetSecondCustodianEmailAddress() const;
164
165 // Returns the name of the second custodian, or the email address if the name
166 // is empty, or the empty string is there is no second custodian.
167 std::string GetSecondCustodianName() const;
168
treib2170ea02015-10-13 14:55:12169 // Returns a message saying that extensions can only be modified by the
170 // custodian.
171 base::string16 GetExtensionsLockedMessage() const;
172
jam1c5a91492016-02-24 20:47:53173#if !defined(OS_ANDROID)
[email protected]a243d644c2013-06-20 18:37:55174 // Initializes this profile for syncing, using the provided |refresh_token| to
175 // mint access tokens for Sync.
176 void InitSync(const std::string& refresh_token);
[email protected]acfcfbb2013-05-13 18:01:27177
[email protected]cce15bb2014-06-17 13:43:51178 // Convenience method that registers this supervised user using
[email protected]458d59442013-08-01 14:19:32179 // |registration_utility| and initializes sync with the returned token.
180 // The |callback| will be called when registration is complete,
[email protected]3a276ff2014-08-12 14:22:09181 // whether it succeeded or not -- unless registration was cancelled manually,
[email protected]458d59442013-08-01 14:19:32182 // in which case the callback will be ignored.
[email protected]cce15bb2014-06-17 13:43:51183 void RegisterAndInitSync(
184 SupervisedUserRegistrationUtility* registration_utility,
185 Profile* custodian_profile,
186 const std::string& supervised_user_id,
187 const AuthErrorCallback& callback);
thestig1b76f1a2015-09-30 22:52:38188#endif
[email protected]acfcfbb2013-05-13 18:01:27189
[email protected]438f7e12013-08-07 06:59:00190 void AddNavigationBlockedCallback(const NavigationBlockedCallback& callback);
191 void DidBlockNavigation(content::WebContents* web_contents);
192
treibab0a39e2014-09-24 14:48:28193 void AddObserver(SupervisedUserServiceObserver* observer);
194 void RemoveObserver(SupervisedUserServiceObserver* observer);
195
treib531fc7312014-12-09 12:49:20196 void AddPermissionRequestCreator(
dchengf624e472016-04-12 08:33:17197 std::unique_ptr<PermissionRequestCreator> creator);
bauerb646019b12014-10-16 16:23:09198
dchengf624e472016-04-12 08:33:17199 void SetSafeSearchURLReporter(
200 std::unique_ptr<SafeSearchURLReporter> reporter);
atanasovaac676032016-04-05 16:31:05201
bauerbb519f8252016-05-13 09:16:39202 // Returns true if the syncer::SESSIONS type should be included in Sync.
203 // Public for testing.
204 bool IncludesSyncSessionsType() const;
205
bauerb5f8cda92015-10-07 15:36:44206 // ProfileKeyedService override:
207 void Shutdown() override;
208
[email protected]3a276ff2014-08-12 14:22:09209 // SyncTypePreferenceProvider implementation:
dchengc072fff2014-10-21 11:39:05210 syncer::ModelTypeSet GetPreferredDataTypes() const override;
[email protected]3a276ff2014-08-12 14:22:09211
jam1c5a91492016-02-24 20:47:53212#if !defined(OS_ANDROID)
maxbogue7e006db2016-10-03 19:48:28213 // syncer::SyncServiceObserver implementation:
holte4ef35702017-02-03 03:30:10214 void OnStateChanged(syncer::SyncService* sync) override;
[email protected]0850e842013-01-19 03:44:31215
[email protected]dfddd022013-07-10 17:29:48216 // chrome::BrowserListObserver implementation:
dchengc072fff2014-10-21 11:39:05217 void OnBrowserSetLastActive(Browser* browser) override;
jam1c5a91492016-02-24 20:47:53218#endif // !defined(OS_ANDROID)
[email protected]dfddd022013-07-10 17:29:48219
bauerbce9a1a82014-12-18 13:34:24220 // SupervisedUserURLFilter::Observer implementation:
221 void OnSiteListUpdated() override;
222
[email protected]0850e842013-01-19 03:44:31223 private:
[email protected]cce15bb2014-06-17 13:43:51224 friend class SupervisedUserServiceExtensionTestBase;
225 friend class SupervisedUserServiceFactory;
pvalenzuelac2ca4582014-10-14 19:24:57226 FRIEND_TEST_ALL_PREFIXES(SingleClientSupervisedUserSettingsSyncTest, Sanity);
[email protected]cce15bb2014-06-17 13:43:51227 FRIEND_TEST_ALL_PREFIXES(SupervisedUserServiceTest, ClearOmitOnRegistration);
mamire9609642016-06-28 22:17:54228 FRIEND_TEST_ALL_PREFIXES(
229 SupervisedUserServiceExtensionTest,
230 ExtensionManagementPolicyProviderWithoutSUInitiatedInstalls);
231 FRIEND_TEST_ALL_PREFIXES(
232 SupervisedUserServiceExtensionTest,
233 ExtensionManagementPolicyProviderWithSUInitiatedInstalls);
bauerb95a50682015-01-07 17:04:15234
treib8ecc1eb52015-03-04 18:29:06235 using CreatePermissionRequestCallback =
236 base::Callback<void(PermissionRequestCreator*, const SuccessCallback&)>;
237
[email protected]cce15bb2014-06-17 13:43:51238 // Use |SupervisedUserServiceFactory::GetForProfile(..)| to get
[email protected]3bf45d02013-07-10 00:03:41239 // an instance of this service.
[email protected]cce15bb2014-06-17 13:43:51240 explicit SupervisedUserService(Profile* profile);
[email protected]3bf45d02013-07-10 00:03:41241
[email protected]f085fdd52014-06-11 18:09:20242 void SetActive(bool active);
243
jam1c5a91492016-02-24 20:47:53244#if !defined(OS_ANDROID)
[email protected]0085863a2013-12-06 21:19:03245 void OnCustodianProfileDownloaded(const base::string16& full_name);
[email protected]200729f82013-06-22 07:05:55246
[email protected]cce15bb2014-06-17 13:43:51247 void OnSupervisedUserRegistered(const AuthErrorCallback& callback,
248 Profile* custodian_profile,
249 const GoogleServiceAuthError& auth_error,
250 const std::string& token);
[email protected]acfcfbb2013-05-13 18:01:27251
[email protected]a243d644c2013-06-20 18:37:55252 void SetupSync();
[email protected]6e08b9a62014-07-08 00:32:48253 void StartSetupSync();
254 void FinishSetupSyncWhenReady();
255 void FinishSetupSync();
bauerb5f8cda92015-10-07 15:36:44256#endif
[email protected]a243d644c2013-06-20 18:37:55257
[email protected]cce15bb2014-06-17 13:43:51258 bool ProfileIsSupervised() const;
[email protected]e000daf2013-07-31 16:50:58259
treib3fce4e92014-09-26 16:06:25260 void OnCustodianInfoChanged();
261
brettw00899e62016-11-12 02:10:17262#if BUILDFLAG(ENABLE_EXTENSIONS)
treibbb9a1962015-02-25 13:40:59263 // extensions::ManagementPolicy::Provider implementation:
264 std::string GetDebugPolicyProviderName() const override;
265 bool UserMayLoad(const extensions::Extension* extension,
266 base::string16* error) const override;
treib755c12d2015-03-30 08:46:25267 bool UserMayModifySettings(const extensions::Extension* extension,
268 base::string16* error) const override;
treibbb9a1962015-02-25 13:40:59269 bool MustRemainInstalled(const extensions::Extension* extension,
270 base::string16* error) const override;
mamire9609642016-06-28 22:17:54271 bool MustRemainDisabled(const extensions::Extension* extension,
272 extensions::Extension::DisableReason* reason,
273 base::string16* error) const override;
274
275 // extensions::ExtensionRegistryObserver overrides:
276 void OnExtensionInstalled(content::BrowserContext* browser_context,
277 const extensions::Extension* extension,
278 bool is_update) override;
[email protected]0850e842013-01-19 03:44:31279
mamir192d7882016-06-22 17:10:16280 // An extension can be in one of the following states:
281 //
282 // FORCED: if it is installed by the custodian.
mamire9609642016-06-28 22:17:54283 // REQUIRE_APPROVAL: if it is installed by the supervised user and
284 // hasn't been approved by the custodian yet.
mamir192d7882016-06-22 17:10:16285 // ALLOWED: Components, Themes, Default extensions ..etc
286 // are generally allowed. Extensions that have been approved by the
287 // custodian are also allowed.
288 // BLOCKED: if it is not ALLOWED or FORCED
289 // and supervised users initiated installs are disabled.
mamire9609642016-06-28 22:17:54290 enum class ExtensionState { FORCED, BLOCKED, ALLOWED, REQUIRE_APPROVAL };
mamir192d7882016-06-22 17:10:16291
mamire9609642016-06-28 22:17:54292 // Returns the state of an extension whether being FORCED, BLOCKED, ALLOWED or
293 // REQUIRE_APPROVAL from the Supervised User service's point of view.
mamir192d7882016-06-22 17:10:16294 ExtensionState GetExtensionState(
mamire9609642016-06-28 22:17:54295 const extensions::Extension& extension) const;
mamir192d7882016-06-22 17:10:16296
[email protected]c14a6802014-07-11 21:51:12297 // Extensions helper to SetActive().
298 void SetExtensionsActive();
mamire9609642016-06-28 22:17:54299
300 // Enables/Disables extensions upon change in approved version of the
301 // extension_id.
302 void ChangeExtensionStateIfNecessary(const std::string& extension_id);
303
304 // Updates the map of approved extensions when the corresponding preference
305 // is changed.
306 void UpdateApprovedExtensions();
[email protected]c14a6802014-07-11 21:51:12307#endif
308
[email protected]cce15bb2014-06-17 13:43:51309 SupervisedUserSettingsService* GetSettingsService();
[email protected]e861bba2013-06-17 15:20:54310
bauerbd3a36cc42014-10-01 13:05:49311 size_t FindEnabledPermissionRequestCreator(size_t start);
treib8ecc1eb52015-03-04 18:29:06312 void AddPermissionRequestInternal(
313 const CreatePermissionRequestCallback& create_request,
314 const SuccessCallback& callback,
315 size_t index);
316 void OnPermissionRequestIssued(
317 const CreatePermissionRequestCallback& create_request,
318 const SuccessCallback& callback,
319 size_t index,
320 bool success);
bauerbd3a36cc42014-10-01 13:05:49321
[email protected]cce15bb2014-06-17 13:43:51322 void OnSupervisedUserIdChanged();
[email protected]f085fdd52014-06-11 18:09:20323
[email protected]0850e842013-01-19 03:44:31324 void OnDefaultFilteringBehaviorChanged();
325
treib9cc1b112016-01-08 10:08:01326 void OnSafeSitesSettingChanged();
327
bauerb95a50682015-01-07 17:04:15328 void OnSiteListsChanged(
329 const std::vector<scoped_refptr<SupervisedUserSiteList>>& site_lists);
[email protected]0850e842013-01-19 03:44:31330
treib2fd187392015-04-16 17:19:38331 // Asynchronously loads a blacklist from a binary file at |path| and applies
332 // it to the URL filters. If no file exists at |path| yet, downloads a file
333 // from |url| and stores it at |path| first.
treibf136dfb2014-09-25 17:37:47334 void LoadBlacklist(const base::FilePath& path, const GURL& url);
335
treib2fd187392015-04-16 17:19:38336 void OnBlacklistFileChecked(const base::FilePath& path,
337 const GURL& url,
338 bool file_exists);
339
340 // Asynchronously loads a blacklist from a binary file at |path| and applies
341 // it to the URL filters.
treibf136dfb2014-09-25 17:37:47342 void LoadBlacklistFromFile(const base::FilePath& path);
343
treibf38cc252016-04-07 14:44:11344 void OnBlacklistDownloadDone(const base::FilePath& path,
345 FileDownloader::Result result);
treib4edbded2014-09-05 08:43:55346
bauerbce9a1a82014-12-18 13:34:24347 void OnBlacklistLoaded();
348
treib9cc1b112016-01-08 10:08:01349 void UpdateBlacklist();
350
[email protected]5e022292013-02-06 16:42:17351 // Updates the manual overrides for hosts in the URL filters when the
352 // corresponding preference is changed.
353 void UpdateManualHosts();
[email protected]0850e842013-01-19 03:44:31354
[email protected]5e022292013-02-06 16:42:17355 // Updates the manual overrides for URLs in the URL filters when the
356 // corresponding preference is changed.
357 void UpdateManualURLs();
[email protected]0850e842013-01-19 03:44:31358
[email protected]0b4c6b22014-08-04 09:46:31359 // Returns the human readable name of the supervised user.
360 std::string GetSupervisedUserName() const;
361
fhorschig1f351f02014-09-30 12:30:22362 // Subscribes to the SupervisedUserPrefStore, refreshes
363 // |includes_sync_sessions_type_| and triggers reconfiguring the
364 // ProfileSyncService.
bauerbb519f8252016-05-13 09:16:39365 void OnForceSessionSyncChanged();
fhorschig1f351f02014-09-30 12:30:22366
367 // The option a custodian sets to either record or prevent recording the
368 // supervised user's history. Set by |FetchNewSessionSyncState()| and
369 // defaults to true.
370 bool includes_sync_sessions_type_;
371
[email protected]12b7af32014-03-13 05:28:20372 // Owns us via the KeyedService mechanism.
[email protected]0850e842013-01-19 03:44:31373 Profile* profile_;
374
[email protected]f085fdd52014-06-11 18:09:20375 bool active_;
376
377 Delegate* delegate_;
378
[email protected]0850e842013-01-19 03:44:31379 PrefChangeRegistrar pref_change_registrar_;
380
[email protected]a243d644c2013-06-20 18:37:55381 // True iff we're waiting for the Sync service to be initialized.
382 bool waiting_for_sync_initialization_;
[email protected]dfddd022013-07-10 17:29:48383 bool is_profile_active_;
[email protected]a243d644c2013-06-20 18:37:55384
[email protected]438f7e12013-08-07 06:59:00385 std::vector<NavigationBlockedCallback> navigation_blocked_callbacks_;
386
[email protected]3a276ff2014-08-12 14:22:09387 // True only when |Init()| method has been called.
388 bool did_init_;
389
[email protected]3bf45d02013-07-10 00:03:41390 // True only when |Shutdown()| method has been called.
391 bool did_shutdown_;
392
mmenkedb2637ff2017-03-30 23:59:42393 SupervisedUserURLFilter url_filter_;
treib9cc1b112016-01-08 10:08:01394
mamire9609642016-06-28 22:17:54395 // Stores a map from extension_id -> approved version by the custodian.
396 // It is only relevant for SU-initiated installs.
397 std::map<std::string, base::Version> approved_extensions_map_;
398
treib9cc1b112016-01-08 10:08:01399 enum class BlacklistLoadState {
400 NOT_LOADED,
401 LOAD_STARTED,
402 LOADED
403 } blacklist_state_;
404
405 SupervisedUserBlacklist blacklist_;
dchengf624e472016-04-12 08:33:17406 std::unique_ptr<FileDownloader> blacklist_downloader_;
[email protected]8052b242013-11-15 16:40:55407
dchengf624e472016-04-12 08:33:17408 std::unique_ptr<SupervisedUserWhitelistService> whitelist_service_;
bauerb4da36132014-12-26 19:53:13409
atanasova9572aaf2016-02-26 18:08:26410 std::vector<scoped_refptr<SupervisedUserSiteList>> whitelists_;
411
[email protected]4db65f952014-05-20 15:46:30412 // Used to create permission requests.
leon.han4ea301f2017-03-28 03:36:31413 std::vector<std::unique_ptr<PermissionRequestCreator>> permissions_creators_;
[email protected]4db65f952014-05-20 15:46:30414
atanasovaac676032016-04-05 16:31:05415 // Used to report inappropriate URLs to SafeSarch API.
dchengf624e472016-04-12 08:33:17416 std::unique_ptr<SafeSearchURLReporter> url_reporter_;
atanasovaac676032016-04-05 16:31:05417
brettw00899e62016-11-12 02:10:17418#if BUILDFLAG(ENABLE_EXTENSIONS)
mamire9609642016-06-28 22:17:54419 ScopedObserver<extensions::ExtensionRegistry,
420 extensions::ExtensionRegistryObserver>
421 registry_observer_;
422#endif
423
brettwd195c952015-06-02 17:31:12424 base::ObserverList<SupervisedUserServiceObserver> observer_list_;
treibab0a39e2014-09-24 14:48:28425
tommyclif3a1551e2016-06-21 18:11:23426 // Prevents Sync from running until configuration is complete.
maxbogue7e006db2016-10-03 19:48:28427 std::unique_ptr<syncer::SyncSetupInProgressHandle> sync_blocker_;
tommyclif3a1551e2016-06-21 18:11:23428
[email protected]cce15bb2014-06-17 13:43:51429 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_;
leon.han4ea301f2017-03-28 03:36:31430
431 DISALLOW_COPY_AND_ASSIGN(SupervisedUserService);
[email protected]0850e842013-01-19 03:44:31432};
433
[email protected]cce15bb2014-06-17 13:43:51434#endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_