Chromium Code Reviews| Index: chrome/browser/managed_mode/managed_mode.h |
| diff --git a/chrome/browser/managed_mode/managed_mode.h b/chrome/browser/managed_mode/managed_mode.h |
| index 1c8eba9228e4711ab37c2a9c968e7ab78f9b5817..33c003f80cee06dcab974f29de9d9e52c7988840 100644 |
| --- a/chrome/browser/managed_mode/managed_mode.h |
| +++ b/chrome/browser/managed_mode/managed_mode.h |
| @@ -28,6 +28,10 @@ class PrefServiceSimple; |
| class PrefServiceSyncable; |
| class Profile; |
| +namespace policy{ |
| +class URLBlacklist; |
| +} |
| + |
| // Managed mode allows one person to manage the Chrome experience for another |
| // person by pre-configuring and then locking a managed User profile. |
| // The ManagedMode class provides methods to check whether the browser is in |
| @@ -38,6 +42,7 @@ class ManagedMode : public chrome::BrowserListObserver, |
| public content::NotificationObserver { |
| public: |
| typedef base::Callback<void(bool)> EnterCallback; |
| + typedef base::ListValue URLPatternList; |
| static void RegisterPrefs(PrefServiceSimple* prefs); |
| static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
| @@ -62,6 +67,31 @@ class ManagedMode : public chrome::BrowserListObserver, |
| // This method should only be called on the UI thread. |
| static const ManagedModeURLFilter* GetURLFilterForUIThread(); |
| + // The functions that handle manual whitelists use |url_pattern| or lists |
| + // of "url patterns". An "url pattern" is a pattern in the format used by the |
| + // URLBlacklist filter. A description of the format used can be found here: |
|
Bernhard Bauer
2013/01/07 12:34:19
Nit: policy::URLBacklist is the fully qualified cl
Sergiu
2013/01/07 16:25:05
Done.
|
| + // http://dev.chromium.org/administrators/url-blacklist-filter-format |
| + |
| + // Checks if the |url_pattern| is in the manual whitelist. |
| + static bool IsInManualList(const bool isWhitelist, |
|
Pam (message me for reviews)
2013/01/07 13:00:16
Style nit: is_whitelist (also below)
Comment nit:
Sergiu
2013/01/07 16:25:05
Done.
|
| + const std::string& url_pattern); |
| + |
| + // Appends |list| to the manual white/black list (according to |isWhitelist|) |
| + // both in URL filter and in preferences. |
| + static void AddToManualList(const bool isWhitelist, |
| + const URLPatternList& list); |
| + |
| + // Removes |list| from the manual white/black list (according to |
| + // |isWhitelist|) both in URL filter and in preferences. |
| + static void RemoveFromManualList(const bool isWhitelist, |
| + const URLPatternList& list); |
| + |
| + // Updates the whitelist and the blacklist from the prefs. |
| + static void UpdateWhitelist(); |
|
Pam (message me for reviews)
2013/01/07 13:00:16
If this updates both the white- and blacklists, it
Sergiu
2013/01/07 16:25:05
Done, renamed to UpdateManualLists to fit with the
|
| + |
| + // Returns the profile blacklist. |
| + static scoped_ptr<URLPatternList> GetBlacklist(); |
| + |
| // ExtensionManagementPolicy::Provider implementation: |
| virtual std::string GetDebugPolicyProviderName() const OVERRIDE; |
| virtual bool UserMayLoad(const extensions::Extension* extension, |
| @@ -132,7 +162,24 @@ class ManagedMode : public chrome::BrowserListObserver, |
| void OnDefaultFilteringBehaviorChanged(); |
| - void UpdateWhitelist(); |
| + void UpdateWhitelistImpl(); |
| + |
| + // Returns a copy of the manual whitelist which is stored in each profile. |
| + scoped_ptr<URLPatternList> GetWhitelist(); |
| + |
| + void RemoveFromManualListImpl(const bool isWhitelist, |
| + const URLPatternList& whitelist); |
| + |
| + // Adds the |url_pattern| to the manual lists in the URL filter. This is used |
| + // by AddToManualListImpl(). |
| + static void AddURLPatternToManualList(const bool isWhitelist, |
|
Bernhard Bauer
2013/01/07 12:34:19
Can you move this method to an anonymous namespace
Sergiu
2013/01/07 16:25:05
It shouldn't have been static at all, made it just
|
| + const std::string& url_pattern); |
| + |
| + void AddToManualListImpl(const bool isWhitelist, |
| + const URLPatternList& whitelist); |
| + |
| + bool IsInManualListImpl(const bool isWhitelist, |
| + const std::string& url_pattern); |
| content::NotificationRegistrar registrar_; |
| scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; |