Commit daece84f authored by treib's avatar treib Committed by Commit bot

Supervised users: Allow the delegate to specify a blacklist to load.

Folloup to https://codereview.chromium.org/537993002/

BUG=410824

Review URL: https://codereview.chromium.org/545173002

Cr-Commit-Position: refs/heads/master@{#293508}
parent c4bfe0a2
......@@ -5,6 +5,7 @@
#include "chrome/browser/supervised_user/supervised_user_service.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string_number_conversions.h"
......@@ -714,6 +715,11 @@ void SupervisedUserService::SetActive(bool active) {
UpdateSiteLists();
UpdateManualHosts();
UpdateManualURLs();
if (delegate_) {
base::FilePath blacklist_path = delegate_->GetBlacklistPath();
if (!blacklist_path.empty())
LoadBlacklist(blacklist_path);
}
#if !defined(OS_ANDROID)
// TODO(bauerb): Get rid of the platform-specific #ifdef here.
......
......@@ -37,6 +37,10 @@ class SupervisedUserSettingsService;
class SupervisedUserSiteList;
class SupervisedUserURLFilter;
namespace base {
class FilePath;
}
namespace extensions {
class ExtensionRegistry;
}
......@@ -73,6 +77,9 @@ class SupervisedUserService : public KeyedService,
// Returns true to indicate that the delegate handled the (de)activation, or
// false to indicate that the SupervisedUserService itself should handle it.
virtual bool SetActive(bool active) = 0;
// Returns the path to a blacklist file to load, or an empty path to
// indicate "none".
virtual base::FilePath GetBlacklistPath() const = 0;
};
virtual ~SupervisedUserService();
......
......@@ -212,9 +212,9 @@ GURL SupervisedUserURLFilter::Normalize(const GURL& url) {
// static
bool SupervisedUserURLFilter::HasFilteredScheme(const GURL& url) {
for (size_t i = 0; i < arraysize(kFilteredSchemes); ++i) {
if (url.scheme() == kFilteredSchemes[i])
return true;
}
if (url.scheme() == kFilteredSchemes[i])
return true;
}
return false;
}
......@@ -355,8 +355,7 @@ void SupervisedUserURLFilter::LoadWhitelists(
base::Bind(&SupervisedUserURLFilter::SetContents, this));
}
void SupervisedUserURLFilter::SetBlacklist(
SupervisedUserBlacklist* blacklist) {
void SupervisedUserURLFilter::SetBlacklist(SupervisedUserBlacklist* blacklist) {
blacklist_ = blacklist;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment