Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7353)

Unified Diff: chrome/browser/supervised_user/supervised_user_service.cc

Issue 1086393002: Supervised user blacklist: Don't download the blacklist file on every startup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698