Chromium Code Reviews| Index: chrome/browser/supervised_user/supervised_user_service.cc |
| diff --git a/chrome/browser/supervised_user/supervised_user_service.cc b/chrome/browser/supervised_user/supervised_user_service.cc |
| index 76c4288a97c1b46f832eaf287e15b51873a69699..21c1b4ce290fc562053c5f8469f30aa3e7330669 100644 |
| --- a/chrome/browser/supervised_user/supervised_user_service.cc |
| +++ b/chrome/browser/supervised_user/supervised_user_service.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/command_line.h" |
| #include "base/files/file_path.h" |
| +#include "base/files/file_util.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/path_service.h" |
| #include "base/prefs/pref_service.h" |
| @@ -620,8 +621,18 @@ void SupervisedUserService::OnSiteListUpdated() { |
| void SupervisedUserService::LoadBlacklist(const base::FilePath& path, |
| const GURL& url) { |
| - // TODO(treib): Don't re-download the blacklist if the local file exists! |
| - if (!url.is_valid()) { |
| + BrowserThread::PostTaskAndReplyWithResult( |
| + BrowserThread::IO, |
|
Bernhard Bauer
2015/04/16 13:58:06
I don't think you want to do this on the IO thread
Marc Treib
2015/04/16 14:04:16
Argh, yeah, I ran into this before (the IO thread
Bernhard Bauer
2015/04/16 14:09:16
Yes, because it will use more than one thread, so
Marc Treib
2015/04/16 14:40:49
Got it, thanks! Done.
|
| + FROM_HERE, |
| + base::Bind(&base::PathExists, path), |
| + base::Bind(&SupervisedUserService::OnBlacklistFileChecked, |
| + weak_ptr_factory_.GetWeakPtr(), path, url)); |
| +} |
| + |
| +void SupervisedUserService::OnBlacklistFileChecked(const base::FilePath& path, |
| + const GURL& url, |
| + bool file_exists) { |
| + if (file_exists) { |
| LoadBlacklistFromFile(path); |
| return; |
| } |