| 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 bool file_exists) { | 628 bool file_exists) { |
| 629 if (file_exists) { | 629 if (file_exists) { |
| 630 LoadBlacklistFromFile(path); | 630 LoadBlacklistFromFile(path); |
| 631 return; | 631 return; |
| 632 } | 632 } |
| 633 | 633 |
| 634 DCHECK(!blacklist_downloader_); | 634 DCHECK(!blacklist_downloader_); |
| 635 blacklist_downloader_.reset(new FileDownloader( | 635 blacklist_downloader_.reset(new FileDownloader( |
| 636 url, | 636 url, |
| 637 path, | 637 path, |
| 638 false, |
| 638 profile_->GetRequestContext(), | 639 profile_->GetRequestContext(), |
| 639 base::Bind(&SupervisedUserService::OnBlacklistDownloadDone, | 640 base::Bind(&SupervisedUserService::OnBlacklistDownloadDone, |
| 640 base::Unretained(this), path))); | 641 base::Unretained(this), path))); |
| 641 } | 642 } |
| 642 | 643 |
| 643 void SupervisedUserService::LoadBlacklistFromFile(const base::FilePath& path) { | 644 void SupervisedUserService::LoadBlacklistFromFile(const base::FilePath& path) { |
| 644 // This object is guaranteed to outlive the URLFilterContext, so we can bind a | 645 // This object is guaranteed to outlive the URLFilterContext, so we can bind a |
| 645 // raw pointer to it in the callback. | 646 // raw pointer to it in the callback. |
| 646 url_filter_context_.LoadBlacklist( | 647 url_filter_context_.LoadBlacklist( |
| 647 path, base::Bind(&SupervisedUserService::OnBlacklistLoaded, | 648 path, base::Bind(&SupervisedUserService::OnBlacklistLoaded, |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 // The active user can be NULL in unit tests. | 955 // The active user can be NULL in unit tests. |
| 955 if (user_manager::UserManager::Get()->GetActiveUser()) { | 956 if (user_manager::UserManager::Get()->GetActiveUser()) { |
| 956 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( | 957 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( |
| 957 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); | 958 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); |
| 958 } | 959 } |
| 959 return std::string(); | 960 return std::string(); |
| 960 #else | 961 #else |
| 961 return profile_->GetPrefs()->GetString(prefs::kProfileName); | 962 return profile_->GetPrefs()->GetString(prefs::kProfileName); |
| 962 #endif | 963 #endif |
| 963 } | 964 } |
| OLD | NEW |