| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 SupervisedUserURLFilter* | 434 SupervisedUserURLFilter* |
| 435 SupervisedUserService::URLFilterContext::ui_url_filter() const { | 435 SupervisedUserService::URLFilterContext::ui_url_filter() const { |
| 436 return ui_url_filter_.get(); | 436 return ui_url_filter_.get(); |
| 437 } | 437 } |
| 438 | 438 |
| 439 SupervisedUserURLFilter* | 439 SupervisedUserURLFilter* |
| 440 SupervisedUserService::URLFilterContext::io_url_filter() const { | 440 SupervisedUserService::URLFilterContext::io_url_filter() const { |
| 441 return io_url_filter_.get(); | 441 return io_url_filter_.get(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 void SupervisedUserService::URLFilterContext::SetEnabled(bool enabled) { | |
| 445 ui_url_filter_->SetEnabled(enabled); | |
| 446 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | |
| 447 base::Bind(&SupervisedUserURLFilter::SetEnabled, | |
| 448 io_url_filter_, enabled)); | |
| 449 } | |
| 450 | |
| 451 void SupervisedUserService::URLFilterContext::SetDefaultFilteringBehavior( | 444 void SupervisedUserService::URLFilterContext::SetDefaultFilteringBehavior( |
| 452 SupervisedUserURLFilter::FilteringBehavior behavior) { | 445 SupervisedUserURLFilter::FilteringBehavior behavior) { |
| 453 ui_url_filter_->SetDefaultFilteringBehavior(behavior); | 446 ui_url_filter_->SetDefaultFilteringBehavior(behavior); |
| 454 BrowserThread::PostTask( | 447 BrowserThread::PostTask( |
| 455 BrowserThread::IO, | 448 BrowserThread::IO, |
| 456 FROM_HERE, | 449 FROM_HERE, |
| 457 base::Bind(&SupervisedUserURLFilter::SetDefaultFilteringBehavior, | 450 base::Bind(&SupervisedUserURLFilter::SetDefaultFilteringBehavior, |
| 458 io_url_filter_, behavior)); | 451 io_url_filter_, behavior)); |
| 459 } | 452 } |
| 460 | 453 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 | 665 |
| 673 #if !defined(OS_ANDROID) | 666 #if !defined(OS_ANDROID) |
| 674 if (waiting_for_sync_initialization_) | 667 if (waiting_for_sync_initialization_) |
| 675 ProfileSyncServiceFactory::GetForProfile(profile_)->RemoveObserver(this); | 668 ProfileSyncServiceFactory::GetForProfile(profile_)->RemoveObserver(this); |
| 676 | 669 |
| 677 // TODO(bauerb): Get rid of the platform-specific #ifdef here. | 670 // TODO(bauerb): Get rid of the platform-specific #ifdef here. |
| 678 // http://crbug.com/313377 | 671 // http://crbug.com/313377 |
| 679 BrowserList::RemoveObserver(this); | 672 BrowserList::RemoveObserver(this); |
| 680 #endif | 673 #endif |
| 681 } | 674 } |
| 682 | |
| 683 url_filter_context_.SetEnabled(active_); | |
| 684 } | 675 } |
| 685 | 676 |
| 686 #if !defined(OS_ANDROID) | 677 #if !defined(OS_ANDROID) |
| 687 void SupervisedUserService::OnCustodianProfileDownloaded( | 678 void SupervisedUserService::OnCustodianProfileDownloaded( |
| 688 const base::string16& full_name) { | 679 const base::string16& full_name) { |
| 689 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianName, | 680 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianName, |
| 690 base::UTF16ToUTF8(full_name)); | 681 base::UTF16ToUTF8(full_name)); |
| 691 } | 682 } |
| 692 | 683 |
| 693 void SupervisedUserService::OnSupervisedUserRegistered( | 684 void SupervisedUserService::OnSupervisedUserRegistered( |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1289 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); | 1280 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); |
| 1290 | 1281 |
| 1291 is_profile_active_ = profile_became_active; | 1282 is_profile_active_ = profile_became_active; |
| 1292 } | 1283 } |
| 1293 #endif // !defined(OS_ANDROID) | 1284 #endif // !defined(OS_ANDROID) |
| 1294 | 1285 |
| 1295 void SupervisedUserService::OnSiteListUpdated() { | 1286 void SupervisedUserService::OnSiteListUpdated() { |
| 1296 for (SupervisedUserServiceObserver& observer : observer_list_) | 1287 for (SupervisedUserServiceObserver& observer : observer_list_) |
| 1297 observer.OnURLFilterChanged(); | 1288 observer.OnURLFilterChanged(); |
| 1298 } | 1289 } |
| OLD | NEW |