| 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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "content/public/browser/user_metrics.h" | 49 #include "content/public/browser/user_metrics.h" |
| 50 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
| 51 | 51 |
| 52 #if defined(OS_CHROMEOS) | 52 #if defined(OS_CHROMEOS) |
| 53 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 53 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 54 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 54 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 55 #include "components/user_manager/user_manager.h" | 55 #include "components/user_manager/user_manager.h" |
| 56 #endif | 56 #endif |
| 57 | 57 |
| 58 #if defined(ENABLE_EXTENSIONS) | 58 #if defined(ENABLE_EXTENSIONS) |
| 59 #include "extensions/browser/extension_registry.h" | 59 #include "chrome/browser/extensions/extension_service.h" |
| 60 #include "extensions/browser/extension_system.h" | 60 #include "extensions/browser/extension_system.h" |
| 61 #endif | 61 #endif |
| 62 | 62 |
| 63 #if defined(ENABLE_THEMES) | 63 #if defined(ENABLE_THEMES) |
| 64 #include "chrome/browser/themes/theme_service.h" | 64 #include "chrome/browser/themes/theme_service.h" |
| 65 #include "chrome/browser/themes/theme_service_factory.h" | 65 #include "chrome/browser/themes/theme_service_factory.h" |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 using base::DictionaryValue; | 68 using base::DictionaryValue; |
| 69 using base::UserMetricsAction; | 69 using base::UserMetricsAction; |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 extensions::ExtensionSystem* extension_system = | 533 extensions::ExtensionSystem* extension_system = |
| 534 extensions::ExtensionSystem::Get(profile_); | 534 extensions::ExtensionSystem::Get(profile_); |
| 535 extensions::ManagementPolicy* management_policy = | 535 extensions::ManagementPolicy* management_policy = |
| 536 extension_system->management_policy(); | 536 extension_system->management_policy(); |
| 537 | 537 |
| 538 if (management_policy) { | 538 if (management_policy) { |
| 539 if (active_) | 539 if (active_) |
| 540 management_policy->RegisterProvider(this); | 540 management_policy->RegisterProvider(this); |
| 541 else | 541 else |
| 542 management_policy->UnregisterProvider(this); | 542 management_policy->UnregisterProvider(this); |
| 543 |
| 544 // Re-check the policy to make sure any new settings get applied. |
| 545 extension_system->extension_service()->CheckManagementPolicy(); |
| 543 } | 546 } |
| 544 } | 547 } |
| 545 #endif // defined(ENABLE_EXTENSIONS) | 548 #endif // defined(ENABLE_EXTENSIONS) |
| 546 | 549 |
| 547 SupervisedUserSettingsService* SupervisedUserService::GetSettingsService() { | 550 SupervisedUserSettingsService* SupervisedUserService::GetSettingsService() { |
| 548 return SupervisedUserSettingsServiceFactory::GetForProfile(profile_); | 551 return SupervisedUserSettingsServiceFactory::GetForProfile(profile_); |
| 549 } | 552 } |
| 550 | 553 |
| 551 size_t SupervisedUserService::FindEnabledPermissionRequestCreator( | 554 size_t SupervisedUserService::FindEnabledPermissionRequestCreator( |
| 552 size_t start) { | 555 size_t start) { |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 LoadBlacklist(GetBlacklistPath(), GURL(kBlacklistURL)); | 805 LoadBlacklist(GetBlacklistPath(), GURL(kBlacklistURL)); |
| 804 } | 806 } |
| 805 if (profile_->IsChild() && | 807 if (profile_->IsChild() && delegate_ && |
| 806 supervised_users::IsSafeSitesOnlineCheckEnabled()) { | 808 supervised_users::IsSafeSitesOnlineCheckEnabled()) { |
| 807 url_filter_context_.InitAsyncURLChecker(profile_->GetRequestContext()); | 809 url_filter_context_.InitAsyncURLChecker(profile_->GetRequestContext()); |
| 808 } | 810 } |
| 809 | 811 |
| 810 #if !defined(OS_ANDROID) | 812 #if !defined(OS_ANDROID) |
| 811 // TODO(bauerb): Get rid of the platform-specific #ifdef here. | 813 // TODO(bauerb): Get rid of the platform-specific #ifdef here. |
| 812 // http://crbug.com/313377 | 814 // http://crbug.com/313377 |
| 813 BrowserList::AddObserver(this); | 815 BrowserList::AddObserver(this); |
| 814 #endif | 816 #endif |
| 815 } else { | 817 } else { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 // The active user can be NULL in unit tests. | 948 // The active user can be NULL in unit tests. |
| 947 if (user_manager::UserManager::Get()->GetActiveUser()) { | 949 if (user_manager::UserManager::Get()->GetActiveUser()) { |
| 948 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( | 950 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( |
| 949 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); | 951 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); |
| 950 } | 952 } |
| 951 return std::string(); | 953 return std::string(); |
| 952 #else | 954 #else |
| 953 return profile_->GetPrefs()->GetString(prefs::kProfileName); | 955 return profile_->GetPrefs()->GetString(prefs::kProfileName); |
| 954 #endif | 956 #endif |
| 955 } | 957 } |
| OLD | NEW |