OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/supervised_user/supervised_user_service.h" | 5 #include "chrome/browser/supervised_user/supervised_user_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 } | 616 } |
617 | 617 |
618 void SupervisedUserService::OnSiteListUpdated() { | 618 void SupervisedUserService::OnSiteListUpdated() { |
619 FOR_EACH_OBSERVER( | 619 FOR_EACH_OBSERVER( |
620 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged()); | 620 SupervisedUserServiceObserver, observer_list_, OnURLFilterChanged()); |
621 } | 621 } |
622 | 622 |
623 void SupervisedUserService::LoadBlacklist(const base::FilePath& path, | 623 void SupervisedUserService::LoadBlacklist(const base::FilePath& path, |
624 const GURL& url) { | 624 const GURL& url) { |
625 base::PostTaskAndReplyWithResult( | 625 base::PostTaskAndReplyWithResult( |
626 BrowserThread::GetBlockingPool(), | 626 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
| 627 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN).get(), |
627 FROM_HERE, | 628 FROM_HERE, |
628 base::Bind(&base::PathExists, path), | 629 base::Bind(&base::PathExists, path), |
629 base::Bind(&SupervisedUserService::OnBlacklistFileChecked, | 630 base::Bind(&SupervisedUserService::OnBlacklistFileChecked, |
630 weak_ptr_factory_.GetWeakPtr(), path, url)); | 631 weak_ptr_factory_.GetWeakPtr(), path, url)); |
631 } | 632 } |
632 | 633 |
633 void SupervisedUserService::OnBlacklistFileChecked(const base::FilePath& path, | 634 void SupervisedUserService::OnBlacklistFileChecked(const base::FilePath& path, |
634 const GURL& url, | 635 const GURL& url, |
635 bool file_exists) { | 636 bool file_exists) { |
636 if (file_exists) { | 637 if (file_exists) { |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 // The active user can be NULL in unit tests. | 961 // The active user can be NULL in unit tests. |
961 if (user_manager::UserManager::Get()->GetActiveUser()) { | 962 if (user_manager::UserManager::Get()->GetActiveUser()) { |
962 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( | 963 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( |
963 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); | 964 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); |
964 } | 965 } |
965 return std::string(); | 966 return std::string(); |
966 #else | 967 #else |
967 return profile_->GetPrefs()->GetString(prefs::kProfileName); | 968 return profile_->GetPrefs()->GetString(prefs::kProfileName); |
968 #endif | 969 #endif |
969 } | 970 } |
OLD | NEW |