| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_MANAGED_MODE_MANAGED_USER_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ |
| 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ | 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/prefs/pref_change_registrar.h" | 11 #include "base/prefs/pref_change_registrar.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "chrome/browser/extensions/management_policy.h" | 13 #include "chrome/browser/extensions/management_policy.h" |
| 14 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" | 14 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" |
| 15 #include "chrome/browser/profiles/profile_keyed_service.h" | 15 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 16 #include "chrome/browser/ui/webui/managed_user_passphrase_dialog.h" | 16 #include "chrome/browser/ui/webui/managed_user_passphrase_dialog.h" |
| 17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 20 | 20 |
| 21 class Browser; | 21 class Browser; |
| 22 class ManagedModeURLFilter; | 22 class ManagedModeURLFilter; |
| 23 class ManagedModeSiteList; | 23 class ManagedModeSiteList; |
| 24 class Profile; |
| 25 |
| 26 namespace user_prefs { |
| 24 class PrefRegistrySyncable; | 27 class PrefRegistrySyncable; |
| 25 class Profile; | 28 } |
| 26 | 29 |
| 27 // This class handles all the information related to a given managed profile | 30 // This class handles all the information related to a given managed profile |
| 28 // (e.g. the installed content packs, the default URL filtering behavior, or | 31 // (e.g. the installed content packs, the default URL filtering behavior, or |
| 29 // manual whitelist/blacklist overrides). | 32 // manual whitelist/blacklist overrides). |
| 30 class ManagedUserService : public ProfileKeyedService, | 33 class ManagedUserService : public ProfileKeyedService, |
| 31 public extensions::ManagementPolicy::Provider, | 34 public extensions::ManagementPolicy::Provider, |
| 32 public content::NotificationObserver { | 35 public content::NotificationObserver { |
| 33 public: | 36 public: |
| 34 typedef std::vector<string16> CategoryList; | 37 typedef std::vector<string16> CategoryList; |
| 35 | 38 |
| 36 enum ManualBehavior { | 39 enum ManualBehavior { |
| 37 MANUAL_NONE = 0, | 40 MANUAL_NONE = 0, |
| 38 MANUAL_ALLOW, | 41 MANUAL_ALLOW, |
| 39 MANUAL_BLOCK | 42 MANUAL_BLOCK |
| 40 }; | 43 }; |
| 41 | 44 |
| 42 explicit ManagedUserService(Profile* profile); | 45 explicit ManagedUserService(Profile* profile); |
| 43 virtual ~ManagedUserService(); | 46 virtual ~ManagedUserService(); |
| 44 | 47 |
| 45 bool ProfileIsManaged() const; | 48 bool ProfileIsManaged() const; |
| 46 | 49 |
| 47 // Returns the elevation state for specific WebContents. | 50 // Returns the elevation state for specific WebContents. |
| 48 bool IsElevatedForWebContents(const content::WebContents* web_contents) const; | 51 bool IsElevatedForWebContents(const content::WebContents* web_contents) const; |
| 49 | 52 |
| 50 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 53 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
| 51 | 54 |
| 52 // Returns the URL filter for the IO thread, for filtering network requests | 55 // Returns the URL filter for the IO thread, for filtering network requests |
| 53 // (in ManagedModeResourceThrottle). | 56 // (in ManagedModeResourceThrottle). |
| 54 scoped_refptr<const ManagedModeURLFilter> GetURLFilterForIOThread(); | 57 scoped_refptr<const ManagedModeURLFilter> GetURLFilterForIOThread(); |
| 55 | 58 |
| 56 // Returns the URL filter for the UI thread, for filtering navigations and | 59 // Returns the URL filter for the UI thread, for filtering navigations and |
| 57 // classifying sites in the history view. | 60 // classifying sites in the history view. |
| 58 ManagedModeURLFilter* GetURLFilterForUIThread(); | 61 ManagedModeURLFilter* GetURLFilterForUIThread(); |
| 59 | 62 |
| 60 // Returns the URL's category, obtained from the installed content packs. | 63 // Returns the URL's category, obtained from the installed content packs. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 PrefChangeRegistrar pref_change_registrar_; | 197 PrefChangeRegistrar pref_change_registrar_; |
| 195 | 198 |
| 196 // Stores the extension ids of the extensions which currently can be modified | 199 // Stores the extension ids of the extensions which currently can be modified |
| 197 // by the managed user. | 200 // by the managed user. |
| 198 std::set<std::string> elevated_for_extensions_; | 201 std::set<std::string> elevated_for_extensions_; |
| 199 | 202 |
| 200 URLFilterContext url_filter_context_; | 203 URLFilterContext url_filter_context_; |
| 201 }; | 204 }; |
| 202 | 205 |
| 203 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ | 206 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ |
| OLD | NEW |