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

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

Issue 1078713002: Supervised users: Re-check ManagementPolicy when ProfileIsSupervised changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review 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 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 "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/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "content/public/browser/user_metrics.h" 47 #include "content/public/browser/user_metrics.h"
48 #include "ui/base/l10n/l10n_util.h" 48 #include "ui/base/l10n/l10n_util.h"
49 49
50 #if defined(OS_CHROMEOS) 50 #if defined(OS_CHROMEOS)
51 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 51 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
52 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" 52 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h"
53 #include "components/user_manager/user_manager.h" 53 #include "components/user_manager/user_manager.h"
54 #endif 54 #endif
55 55
56 #if defined(ENABLE_EXTENSIONS) 56 #if defined(ENABLE_EXTENSIONS)
57 #include "extensions/browser/extension_registry.h" 57 #include "chrome/browser/extensions/extension_service.h"
58 #include "extensions/browser/extension_system.h" 58 #include "extensions/browser/extension_system.h"
59 #endif 59 #endif
60 60
61 #if defined(ENABLE_THEMES) 61 #if defined(ENABLE_THEMES)
62 #include "chrome/browser/themes/theme_service.h" 62 #include "chrome/browser/themes/theme_service.h"
63 #include "chrome/browser/themes/theme_service_factory.h" 63 #include "chrome/browser/themes/theme_service_factory.h"
64 #endif 64 #endif
65 65
66 using base::DictionaryValue; 66 using base::DictionaryValue;
67 using base::UserMetricsAction; 67 using base::UserMetricsAction;
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 extensions::ExtensionSystem* extension_system = 534 extensions::ExtensionSystem* extension_system =
535 extensions::ExtensionSystem::Get(profile_); 535 extensions::ExtensionSystem::Get(profile_);
536 extensions::ManagementPolicy* management_policy = 536 extensions::ManagementPolicy* management_policy =
537 extension_system->management_policy(); 537 extension_system->management_policy();
538 538
539 if (management_policy) { 539 if (management_policy) {
540 if (active_) 540 if (active_)
541 management_policy->RegisterProvider(this); 541 management_policy->RegisterProvider(this);
542 else 542 else
543 management_policy->UnregisterProvider(this); 543 management_policy->UnregisterProvider(this);
544
545 // Re-check the policy to make sure any new settings get applied.
546 extension_system->extension_service()->CheckManagementPolicy();
544 } 547 }
545 } 548 }
546 #endif // defined(ENABLE_EXTENSIONS) 549 #endif // defined(ENABLE_EXTENSIONS)
547 550
548 SupervisedUserSettingsService* SupervisedUserService::GetSettingsService() { 551 SupervisedUserSettingsService* SupervisedUserService::GetSettingsService() {
549 return SupervisedUserSettingsServiceFactory::GetForProfile(profile_); 552 return SupervisedUserSettingsServiceFactory::GetForProfile(profile_);
550 } 553 }
551 554
552 size_t SupervisedUserService::FindEnabledPermissionRequestCreator( 555 size_t SupervisedUserService::FindEnabledPermissionRequestCreator(
553 size_t start) { 556 size_t start) {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 757
755 SetupSync(); 758 SetupSync();
756 } 759 }
757 } 760 }
758 761
759 // Now activate/deactivate anything not handled by the delegate yet. 762 // Now activate/deactivate anything not handled by the delegate yet.
760 763
761 #if defined(ENABLE_THEMES) 764 #if defined(ENABLE_THEMES)
762 // Re-set the default theme to turn the SU theme on/off. 765 // Re-set the default theme to turn the SU theme on/off.
763 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_); 766 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_);
764 if (theme_service->UsingDefaultTheme() || theme_service->UsingSystemTheme()) { 767 if (theme_service->UsingDefaultTheme() || theme_service->UsingSystemTheme())
765 ThemeServiceFactory::GetForProfile(profile_)->UseDefaultTheme(); 768 theme_service->UseDefaultTheme();
766 }
767 #endif 769 #endif
768 770
769 ProfileSyncService* sync_service = 771 ProfileSyncService* sync_service =
770 ProfileSyncServiceFactory::GetForProfile(profile_); 772 ProfileSyncServiceFactory::GetForProfile(profile_);
771 sync_service->SetEncryptEverythingAllowed(!active_); 773 sync_service->SetEncryptEverythingAllowed(!active_);
772 774
773 GetSettingsService()->SetActive(active_); 775 GetSettingsService()->SetActive(active_);
774 776
775 #if defined(ENABLE_EXTENSIONS) 777 #if defined(ENABLE_EXTENSIONS)
776 SetExtensionsActive(); 778 SetExtensionsActive();
(...skipping 14 matching lines...) Expand all
791 pref_change_registrar_.Add(pref, 793 pref_change_registrar_.Add(pref,
792 base::Bind(&SupervisedUserService::OnCustodianInfoChanged, 794 base::Bind(&SupervisedUserService::OnCustodianInfoChanged,
793 base::Unretained(this))); 795 base::Unretained(this)));
794 } 796 }
795 797
796 // Initialize the filter. 798 // Initialize the filter.
797 OnDefaultFilteringBehaviorChanged(); 799 OnDefaultFilteringBehaviorChanged();
798 whitelist_service_->Init(); 800 whitelist_service_->Init();
799 UpdateManualHosts(); 801 UpdateManualHosts();
800 UpdateManualURLs(); 802 UpdateManualURLs();
801 if (profile_->IsChild() && 803 if (profile_->IsChild() && delegate_ &&
802 supervised_users::IsSafeSitesBlacklistEnabled()) { 804 supervised_users::IsSafeSitesBlacklistEnabled()) {
803 base::FilePath blacklist_path = delegate_->GetBlacklistPath(); 805 base::FilePath blacklist_path = delegate_->GetBlacklistPath();
804 if (!blacklist_path.empty()) 806 if (!blacklist_path.empty())
805 LoadBlacklist(blacklist_path, delegate_->GetBlacklistURL()); 807 LoadBlacklist(blacklist_path, delegate_->GetBlacklistURL());
806 } 808 }
807 if (profile_->IsChild() && 809 if (profile_->IsChild() && delegate_ &&
808 supervised_users::IsSafeSitesOnlineCheckEnabled()) { 810 supervised_users::IsSafeSitesOnlineCheckEnabled()) {
809 const std::string& cx = delegate_->GetSafeSitesCx(); 811 const std::string& cx = delegate_->GetSafeSitesCx();
810 if (!cx.empty()) { 812 if (!cx.empty()) {
811 url_filter_context_.InitAsyncURLChecker( 813 url_filter_context_.InitAsyncURLChecker(
812 profile_->GetRequestContext(), cx); 814 profile_->GetRequestContext(), cx);
813 } 815 }
814 } 816 }
815 817
816 #if !defined(OS_ANDROID) 818 #if !defined(OS_ANDROID)
817 // TODO(bauerb): Get rid of the platform-specific #ifdef here. 819 // TODO(bauerb): Get rid of the platform-specific #ifdef here.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 // The active user can be NULL in unit tests. 954 // The active user can be NULL in unit tests.
953 if (user_manager::UserManager::Get()->GetActiveUser()) { 955 if (user_manager::UserManager::Get()->GetActiveUser()) {
954 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( 956 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName(
955 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); 957 user_manager::UserManager::Get()->GetActiveUser()->GetUserID()));
956 } 958 }
957 return std::string(); 959 return std::string();
958 #else 960 #else
959 return profile_->GetPrefs()->GetString(prefs::kProfileName); 961 return profile_->GetPrefs()->GetString(prefs::kProfileName);
960 #endif 962 #endif
961 } 963 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698