OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ |
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #if defined(ENABLE_EXTENSIONS) | 29 #if defined(ENABLE_EXTENSIONS) |
30 #include "extensions/browser/extension_registry_observer.h" | 30 #include "extensions/browser/extension_registry_observer.h" |
31 #include "extensions/browser/management_policy.h" | 31 #include "extensions/browser/management_policy.h" |
32 #endif | 32 #endif |
33 | 33 |
34 class Browser; | 34 class Browser; |
35 class GoogleServiceAuthError; | 35 class GoogleServiceAuthError; |
36 class PermissionRequestCreator; | 36 class PermissionRequestCreator; |
37 class Profile; | 37 class Profile; |
| 38 class SupervisedUserBlacklistDownloader; |
38 class SupervisedUserRegistrationUtility; | 39 class SupervisedUserRegistrationUtility; |
39 class SupervisedUserServiceObserver; | 40 class SupervisedUserServiceObserver; |
40 class SupervisedUserSettingsService; | 41 class SupervisedUserSettingsService; |
41 class SupervisedUserSiteList; | 42 class SupervisedUserSiteList; |
42 class SupervisedUserURLFilter; | 43 class SupervisedUserURLFilter; |
43 | 44 |
44 namespace base { | 45 namespace base { |
45 class FilePath; | 46 class FilePath; |
46 } | 47 } |
47 | 48 |
(...skipping 29 matching lines...) Expand all Loading... |
77 | 78 |
78 class Delegate { | 79 class Delegate { |
79 public: | 80 public: |
80 virtual ~Delegate() {} | 81 virtual ~Delegate() {} |
81 // Returns true to indicate that the delegate handled the (de)activation, or | 82 // Returns true to indicate that the delegate handled the (de)activation, or |
82 // false to indicate that the SupervisedUserService itself should handle it. | 83 // false to indicate that the SupervisedUserService itself should handle it. |
83 virtual bool SetActive(bool active) = 0; | 84 virtual bool SetActive(bool active) = 0; |
84 // Returns the path to a blacklist file to load, or an empty path to | 85 // Returns the path to a blacklist file to load, or an empty path to |
85 // indicate "none". | 86 // indicate "none". |
86 virtual base::FilePath GetBlacklistPath() const = 0; | 87 virtual base::FilePath GetBlacklistPath() const = 0; |
| 88 // Returns the URL from which to download a blacklist if no local one exists |
| 89 // yet. The blacklist file will be stored at |GetBlacklistPath()|. |
| 90 virtual GURL GetBlacklistURL() const = 0; |
87 }; | 91 }; |
88 | 92 |
89 virtual ~SupervisedUserService(); | 93 virtual ~SupervisedUserService(); |
90 | 94 |
91 // ProfileKeyedService override: | 95 // ProfileKeyedService override: |
92 virtual void Shutdown() OVERRIDE; | 96 virtual void Shutdown() OVERRIDE; |
93 | 97 |
94 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 98 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
95 | 99 |
96 void SetDelegate(Delegate* delegate); | 100 void SetDelegate(Delegate* delegate); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 #endif | 278 #endif |
275 | 279 |
276 SupervisedUserSettingsService* GetSettingsService(); | 280 SupervisedUserSettingsService* GetSettingsService(); |
277 | 281 |
278 void OnSupervisedUserIdChanged(); | 282 void OnSupervisedUserIdChanged(); |
279 | 283 |
280 void OnDefaultFilteringBehaviorChanged(); | 284 void OnDefaultFilteringBehaviorChanged(); |
281 | 285 |
282 void UpdateSiteLists(); | 286 void UpdateSiteLists(); |
283 | 287 |
| 288 // Asynchronously downloads a static blacklist file from |url|, stores it at |
| 289 // |path|, loads it, and applies it to the URL filters. If |url| is not valid |
| 290 // (e.g. empty), directly tries to load from |path|. |
| 291 void LoadBlacklist(const base::FilePath& path, const GURL& url); |
| 292 |
284 // Asynchronously loads a static blacklist from a binary file at |path| and | 293 // Asynchronously loads a static blacklist from a binary file at |path| and |
285 // applies it to the URL filters. | 294 // applies it to the URL filters. |
286 void LoadBlacklist(const base::FilePath& path); | 295 void LoadBlacklistFromFile(const base::FilePath& path); |
| 296 |
| 297 void OnBlacklistDownloadDone(const base::FilePath& path, bool success); |
287 | 298 |
288 // Updates the manual overrides for hosts in the URL filters when the | 299 // Updates the manual overrides for hosts in the URL filters when the |
289 // corresponding preference is changed. | 300 // corresponding preference is changed. |
290 void UpdateManualHosts(); | 301 void UpdateManualHosts(); |
291 | 302 |
292 // Updates the manual overrides for URLs in the URL filters when the | 303 // Updates the manual overrides for URLs in the URL filters when the |
293 // corresponding preference is changed. | 304 // corresponding preference is changed. |
294 void UpdateManualURLs(); | 305 void UpdateManualURLs(); |
295 | 306 |
296 // Returns the human readable name of the supervised user. | 307 // Returns the human readable name of the supervised user. |
(...skipping 23 matching lines...) Expand all Loading... |
320 // Sets a profile in elevated state for testing if set to true. | 331 // Sets a profile in elevated state for testing if set to true. |
321 bool elevated_for_testing_; | 332 bool elevated_for_testing_; |
322 | 333 |
323 // True only when |Init()| method has been called. | 334 // True only when |Init()| method has been called. |
324 bool did_init_; | 335 bool did_init_; |
325 | 336 |
326 // True only when |Shutdown()| method has been called. | 337 // True only when |Shutdown()| method has been called. |
327 bool did_shutdown_; | 338 bool did_shutdown_; |
328 | 339 |
329 URLFilterContext url_filter_context_; | 340 URLFilterContext url_filter_context_; |
| 341 scoped_ptr<SupervisedUserBlacklistDownloader> blacklist_downloader_; |
330 | 342 |
331 // Used to create permission requests. | 343 // Used to create permission requests. |
332 scoped_ptr<PermissionRequestCreator> permissions_creator_; | 344 scoped_ptr<PermissionRequestCreator> permissions_creator_; |
333 | 345 |
334 ObserverList<SupervisedUserServiceObserver> observer_list_; | 346 ObserverList<SupervisedUserServiceObserver> observer_list_; |
335 | 347 |
336 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_; | 348 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_; |
337 }; | 349 }; |
338 | 350 |
339 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ | 351 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ |
OLD | NEW |