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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_service.cc

Issue 2564043002: Supervised Users: Create ResourceThrottle only if filtering is enabled (Closed)
Patch Set: update SearchTest Created 4 years 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 unified diff | Download patch
OLDNEW
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
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
444 void SupervisedUserService::URLFilterContext::SetDefaultFilteringBehavior( 451 void SupervisedUserService::URLFilterContext::SetDefaultFilteringBehavior(
445 SupervisedUserURLFilter::FilteringBehavior behavior) { 452 SupervisedUserURLFilter::FilteringBehavior behavior) {
446 ui_url_filter_->SetDefaultFilteringBehavior(behavior); 453 ui_url_filter_->SetDefaultFilteringBehavior(behavior);
447 BrowserThread::PostTask( 454 BrowserThread::PostTask(
448 BrowserThread::IO, 455 BrowserThread::IO,
449 FROM_HERE, 456 FROM_HERE,
450 base::Bind(&SupervisedUserURLFilter::SetDefaultFilteringBehavior, 457 base::Bind(&SupervisedUserURLFilter::SetDefaultFilteringBehavior,
451 io_url_filter_, behavior)); 458 io_url_filter_, behavior));
452 } 459 }
453 460
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 672
666 #if !defined(OS_ANDROID) 673 #if !defined(OS_ANDROID)
667 if (waiting_for_sync_initialization_) 674 if (waiting_for_sync_initialization_)
668 ProfileSyncServiceFactory::GetForProfile(profile_)->RemoveObserver(this); 675 ProfileSyncServiceFactory::GetForProfile(profile_)->RemoveObserver(this);
669 676
670 // TODO(bauerb): Get rid of the platform-specific #ifdef here. 677 // TODO(bauerb): Get rid of the platform-specific #ifdef here.
671 // http://crbug.com/313377 678 // http://crbug.com/313377
672 BrowserList::RemoveObserver(this); 679 BrowserList::RemoveObserver(this);
673 #endif 680 #endif
674 } 681 }
682
683 url_filter_context_.SetEnabled(active_);
675 } 684 }
676 685
677 #if !defined(OS_ANDROID) 686 #if !defined(OS_ANDROID)
678 void SupervisedUserService::OnCustodianProfileDownloaded( 687 void SupervisedUserService::OnCustodianProfileDownloaded(
679 const base::string16& full_name) { 688 const base::string16& full_name) {
680 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianName, 689 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianName,
681 base::UTF16ToUTF8(full_name)); 690 base::UTF16ToUTF8(full_name));
682 } 691 }
683 692
684 void SupervisedUserService::OnSupervisedUserRegistered( 693 void SupervisedUserService::OnSupervisedUserRegistered(
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); 1289 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile"));
1281 1290
1282 is_profile_active_ = profile_became_active; 1291 is_profile_active_ = profile_became_active;
1283 } 1292 }
1284 #endif // !defined(OS_ANDROID) 1293 #endif // !defined(OS_ANDROID)
1285 1294
1286 void SupervisedUserService::OnSiteListUpdated() { 1295 void SupervisedUserService::OnSiteListUpdated() {
1287 for (SupervisedUserServiceObserver& observer : observer_list_) 1296 for (SupervisedUserServiceObserver& observer : observer_list_)
1288 observer.OnURLFilterChanged(); 1297 observer.OnURLFilterChanged();
1289 } 1298 }
OLDNEW
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_service.h ('k') | chrome/browser/supervised_user/supervised_user_url_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698