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

Unified Diff: chrome/browser/supervised_user/supervised_user_service.cc

Issue 335833003: Rename "managed (mode|user)" to "supervised user" (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments (+ a few other cleanups) Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/supervised_user/supervised_user_service.cc
diff --git a/chrome/browser/managed_mode/managed_user_service.cc b/chrome/browser/supervised_user/supervised_user_service.cc
similarity index 73%
rename from chrome/browser/managed_mode/managed_user_service.cc
rename to chrome/browser/supervised_user/supervised_user_service.cc
index dab571a86a8d6c6022bda7553edebaa457c042d7..aacae9d1820457a4251affca74af97180455e78e 100644
--- a/chrome/browser/managed_mode/managed_user_service.cc
+++ b/chrome/browser/supervised_user/supervised_user_service.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/managed_mode/managed_user_service.h"
+#include "chrome/browser/supervised_user/supervised_user_service.h"
#include "base/command_line.h"
#include "base/memory/ref_counted.h"
@@ -11,25 +11,25 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/managed_mode/custodian_profile_downloader_service.h"
-#include "chrome/browser/managed_mode/custodian_profile_downloader_service_factory.h"
-#include "chrome/browser/managed_mode/managed_mode_site_list.h"
-#include "chrome/browser/managed_mode/managed_user_constants.h"
-#include "chrome/browser/managed_mode/managed_user_registration_utility.h"
-#include "chrome/browser/managed_mode/managed_user_settings_service.h"
-#include "chrome/browser/managed_mode/managed_user_settings_service_factory.h"
-#include "chrome/browser/managed_mode/managed_user_shared_settings_service_factory.h"
-#include "chrome/browser/managed_mode/managed_user_sync_service.h"
-#include "chrome/browser/managed_mode/managed_user_sync_service_factory.h"
-#include "chrome/browser/managed_mode/permission_request_creator_apiary.h"
-#include "chrome/browser/managed_mode/permission_request_creator_sync.h"
-#include "chrome/browser/managed_mode/supervised_user_pref_mapping_service.h"
-#include "chrome/browser/managed_mode/supervised_user_pref_mapping_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
+#include "chrome/browser/supervised_user/custodian_profile_downloader_service.h"
+#include "chrome/browser/supervised_user/custodian_profile_downloader_service_factory.h"
+#include "chrome/browser/supervised_user/permission_request_creator_apiary.h"
+#include "chrome/browser/supervised_user/permission_request_creator_sync.h"
+#include "chrome/browser/supervised_user/supervised_user_constants.h"
+#include "chrome/browser/supervised_user/supervised_user_pref_mapping_service.h"
+#include "chrome/browser/supervised_user/supervised_user_pref_mapping_service_factory.h"
+#include "chrome/browser/supervised_user/supervised_user_registration_utility.h"
+#include "chrome/browser/supervised_user/supervised_user_settings_service.h"
+#include "chrome/browser/supervised_user/supervised_user_settings_service_factory.h"
+#include "chrome/browser/supervised_user/supervised_user_shared_settings_service_factory.h"
+#include "chrome/browser/supervised_user/supervised_user_site_list.h"
+#include "chrome/browser/supervised_user/supervised_user_sync_service.h"
+#include "chrome/browser/supervised_user/supervised_user_sync_service_factory.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/browser.h"
@@ -65,38 +65,38 @@ using base::DictionaryValue;
using base::UserMetricsAction;
using content::BrowserThread;
-ManagedUserService::URLFilterContext::URLFilterContext()
- : ui_url_filter_(new ManagedModeURLFilter),
- io_url_filter_(new ManagedModeURLFilter) {}
-ManagedUserService::URLFilterContext::~URLFilterContext() {}
+SupervisedUserService::URLFilterContext::URLFilterContext()
+ : ui_url_filter_(new SupervisedUserURLFilter),
+ io_url_filter_(new SupervisedUserURLFilter) {}
+SupervisedUserService::URLFilterContext::~URLFilterContext() {}
-ManagedModeURLFilter*
-ManagedUserService::URLFilterContext::ui_url_filter() const {
+SupervisedUserURLFilter*
+SupervisedUserService::URLFilterContext::ui_url_filter() const {
return ui_url_filter_.get();
}
-ManagedModeURLFilter*
-ManagedUserService::URLFilterContext::io_url_filter() const {
+SupervisedUserURLFilter*
+SupervisedUserService::URLFilterContext::io_url_filter() const {
return io_url_filter_.get();
}
-void ManagedUserService::URLFilterContext::SetDefaultFilteringBehavior(
- ManagedModeURLFilter::FilteringBehavior behavior) {
+void SupervisedUserService::URLFilterContext::SetDefaultFilteringBehavior(
+ SupervisedUserURLFilter::FilteringBehavior behavior) {
ui_url_filter_->SetDefaultFilteringBehavior(behavior);
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- base::Bind(&ManagedModeURLFilter::SetDefaultFilteringBehavior,
+ base::Bind(&SupervisedUserURLFilter::SetDefaultFilteringBehavior,
io_url_filter_.get(), behavior));
}
-void ManagedUserService::URLFilterContext::LoadWhitelists(
- ScopedVector<ManagedModeSiteList> site_lists) {
- // ManagedModeURLFilter::LoadWhitelists takes ownership of |site_lists|,
+void SupervisedUserService::URLFilterContext::LoadWhitelists(
+ ScopedVector<SupervisedUserSiteList> site_lists) {
+ // SupervisedUserURLFilter::LoadWhitelists takes ownership of |site_lists|,
// so we make an additional copy of it.
/// TODO(bauerb): This is kinda ugly.
- ScopedVector<ManagedModeSiteList> site_lists_copy;
- for (ScopedVector<ManagedModeSiteList>::iterator it = site_lists.begin();
+ ScopedVector<SupervisedUserSiteList> site_lists_copy;
+ for (ScopedVector<SupervisedUserSiteList>::iterator it = site_lists.begin();
it != site_lists.end(); ++it) {
site_lists_copy.push_back((*it)->Clone());
}
@@ -104,31 +104,31 @@ void ManagedUserService::URLFilterContext::LoadWhitelists(
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- base::Bind(&ManagedModeURLFilter::LoadWhitelists,
+ base::Bind(&SupervisedUserURLFilter::LoadWhitelists,
io_url_filter_, base::Passed(&site_lists_copy)));
}
-void ManagedUserService::URLFilterContext::SetManualHosts(
+void SupervisedUserService::URLFilterContext::SetManualHosts(
scoped_ptr<std::map<std::string, bool> > host_map) {
ui_url_filter_->SetManualHosts(host_map.get());
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- base::Bind(&ManagedModeURLFilter::SetManualHosts,
+ base::Bind(&SupervisedUserURLFilter::SetManualHosts,
io_url_filter_, base::Owned(host_map.release())));
}
-void ManagedUserService::URLFilterContext::SetManualURLs(
+void SupervisedUserService::URLFilterContext::SetManualURLs(
scoped_ptr<std::map<GURL, bool> > url_map) {
ui_url_filter_->SetManualURLs(url_map.get());
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- base::Bind(&ManagedModeURLFilter::SetManualURLs,
+ base::Bind(&SupervisedUserURLFilter::SetManualURLs,
io_url_filter_, base::Owned(url_map.release())));
}
-ManagedUserService::ManagedUserService(Profile* profile)
+SupervisedUserService::SupervisedUserService(Profile* profile)
: profile_(profile),
active_(false),
delegate_(NULL),
@@ -141,24 +141,24 @@ ManagedUserService::ManagedUserService(Profile* profile)
weak_ptr_factory_(this) {
}
-ManagedUserService::~ManagedUserService() {
+SupervisedUserService::~SupervisedUserService() {
DCHECK(did_shutdown_);
}
-void ManagedUserService::Shutdown() {
+void SupervisedUserService::Shutdown() {
did_shutdown_ = true;
- if (ProfileIsManaged()) {
+ if (ProfileIsSupervised()) {
content::RecordAction(UserMetricsAction("ManagedUsers_QuitBrowser"));
}
SetActive(false);
}
-bool ManagedUserService::ProfileIsManaged() const {
+bool SupervisedUserService::ProfileIsSupervised() const {
return profile_->IsSupervised();
}
// static
-void ManagedUserService::RegisterProfilePrefs(
+void SupervisedUserService::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterDictionaryPref(
prefs::kSupervisedUserManualHosts,
@@ -168,7 +168,7 @@ void ManagedUserService::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
registry->RegisterIntegerPref(
prefs::kDefaultSupervisedUserFilteringBehavior,
- ManagedModeURLFilter::ALLOW,
+ SupervisedUserURLFilter::ALLOW,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
registry->RegisterStringPref(
prefs::kSupervisedUserCustodianEmail, std::string(),
@@ -181,24 +181,24 @@ void ManagedUserService::RegisterProfilePrefs(
}
// static
-void ManagedUserService::MigrateUserPrefs(PrefService* prefs) {
+void SupervisedUserService::MigrateUserPrefs(PrefService* prefs) {
if (!prefs->HasPrefPath(prefs::kProfileIsSupervised))
return;
- bool is_managed = prefs->GetBoolean(prefs::kProfileIsSupervised);
+ bool is_supervised = prefs->GetBoolean(prefs::kProfileIsSupervised);
prefs->ClearPref(prefs::kProfileIsSupervised);
- if (!is_managed)
+ if (!is_supervised)
return;
- std::string managed_user_id = prefs->GetString(prefs::kSupervisedUserId);
- if (!managed_user_id.empty())
+ std::string supervised_user_id = prefs->GetString(prefs::kSupervisedUserId);
+ if (!supervised_user_id.empty())
return;
prefs->SetString(prefs::kSupervisedUserId, "Dummy ID");
}
-void ManagedUserService::SetDelegate(Delegate* delegate) {
+void SupervisedUserService::SetDelegate(Delegate* delegate) {
if (delegate_ == delegate)
return;
// If the delegate changed, deactivate first to give the old delegate a chance
@@ -207,12 +207,12 @@ void ManagedUserService::SetDelegate(Delegate* delegate) {
delegate_ = delegate;
}
-scoped_refptr<const ManagedModeURLFilter>
-ManagedUserService::GetURLFilterForIOThread() {
+scoped_refptr<const SupervisedUserURLFilter>
+SupervisedUserService::GetURLFilterForIOThread() {
return url_filter_context_.io_url_filter();
}
-ManagedModeURLFilter* ManagedUserService::GetURLFilterForUIThread() {
+SupervisedUserURLFilter* SupervisedUserService::GetURLFilterForUIThread() {
return url_filter_context_.ui_url_filter();
}
@@ -221,8 +221,8 @@ ManagedModeURLFilter* ManagedUserService::GetURLFilterForUIThread() {
#define CATEGORY_NOT_ON_LIST -1;
#define CATEGORY_OTHER 0;
-int ManagedUserService::GetCategory(const GURL& url) {
- std::vector<ManagedModeSiteList::Site*> sites;
+int SupervisedUserService::GetCategory(const GURL& url) {
+ std::vector<SupervisedUserSiteList::Site*> sites;
GetURLFilterForUIThread()->GetSites(url, &sites);
if (sites.empty())
return CATEGORY_NOT_ON_LIST;
@@ -231,11 +231,11 @@ int ManagedUserService::GetCategory(const GURL& url) {
}
// static
-void ManagedUserService::GetCategoryNames(CategoryList* list) {
- ManagedModeSiteList::GetCategoryNames(list);
+void SupervisedUserService::GetCategoryNames(CategoryList* list) {
+ SupervisedUserSiteList::GetCategoryNames(list);
}
-std::string ManagedUserService::GetCustodianEmailAddress() const {
+std::string SupervisedUserService::GetCustodianEmailAddress() const {
#if defined(OS_CHROMEOS)
return chromeos::UserManager::Get()->GetSupervisedUserManager()->
GetManagerDisplayEmail(
@@ -245,7 +245,7 @@ std::string ManagedUserService::GetCustodianEmailAddress() const {
#endif
}
-std::string ManagedUserService::GetCustodianName() const {
+std::string SupervisedUserService::GetCustodianName() const {
#if defined(OS_CHROMEOS)
return base::UTF16ToUTF8(chromeos::UserManager::Get()->
GetSupervisedUserManager()->GetManagerDisplayName(
@@ -257,12 +257,12 @@ std::string ManagedUserService::GetCustodianName() const {
#endif
}
-void ManagedUserService::AddNavigationBlockedCallback(
+void SupervisedUserService::AddNavigationBlockedCallback(
const NavigationBlockedCallback& callback) {
navigation_blocked_callbacks_.push_back(callback);
}
-void ManagedUserService::DidBlockNavigation(
+void SupervisedUserService::DidBlockNavigation(
content::WebContents* web_contents) {
for (std::vector<NavigationBlockedCallback>::iterator it =
navigation_blocked_callbacks_.begin();
@@ -271,18 +271,18 @@ void ManagedUserService::DidBlockNavigation(
}
}
-std::string ManagedUserService::GetDebugPolicyProviderName() const {
+std::string SupervisedUserService::GetDebugPolicyProviderName() const {
// Save the string space in official builds.
#ifdef NDEBUG
NOTREACHED();
return std::string();
#else
- return "Managed User Service";
+ return "Supervised User Service";
#endif
}
-bool ManagedUserService::UserMayLoad(const extensions::Extension* extension,
- base::string16* error) const {
+bool SupervisedUserService::UserMayLoad(const extensions::Extension* extension,
+ base::string16* error) const {
base::string16 tmp_error;
if (ExtensionManagementPolicyImpl(extension, &tmp_error))
return true;
@@ -318,13 +318,13 @@ bool ManagedUserService::UserMayLoad(const extensions::Extension* extension,
return false;
}
-bool ManagedUserService::UserMayModifySettings(
+bool SupervisedUserService::UserMayModifySettings(
const extensions::Extension* extension,
base::string16* error) const {
return ExtensionManagementPolicyImpl(extension, error);
}
-void ManagedUserService::OnStateChanged() {
+void SupervisedUserService::OnStateChanged() {
ProfileSyncService* service =
ProfileSyncServiceFactory::GetForProfile(profile_);
if (waiting_for_sync_initialization_ && service->sync_initialized()) {
@@ -339,14 +339,14 @@ void ManagedUserService::OnStateChanged() {
<< "Credentials rejected";
}
-void ManagedUserService::OnExtensionLoaded(
+void SupervisedUserService::OnExtensionLoaded(
content::BrowserContext* browser_context,
const extensions::Extension* extension) {
if (!extensions::ManagedModeInfo::GetContentPackSiteList(extension).empty()) {
UpdateSiteLists();
}
}
-void ManagedUserService::OnExtensionUnloaded(
+void SupervisedUserService::OnExtensionUnloaded(
content::BrowserContext* browser_context,
const extensions::Extension* extension,
extensions::UnloadedExtensionInfo::Reason reason) {
@@ -355,7 +355,7 @@ void ManagedUserService::OnExtensionUnloaded(
}
}
-void ManagedUserService::SetupSync() {
+void SupervisedUserService::SetupSync() {
ProfileSyncService* service =
ProfileSyncServiceFactory::GetForProfile(profile_);
DCHECK(service->sync_initialized());
@@ -370,11 +370,11 @@ void ManagedUserService::SetupSync() {
service->SetSyncSetupCompleted();
}
-bool ManagedUserService::ExtensionManagementPolicyImpl(
+bool SupervisedUserService::ExtensionManagementPolicyImpl(
const extensions::Extension* extension,
base::string16* error) const {
// |extension| can be NULL in unit_tests.
- if (!ProfileIsManaged() || (extension && extension->is_theme()))
+ if (!ProfileIsSupervised() || (extension && extension->is_theme()))
return true;
if (elevated_for_testing_)
@@ -385,8 +385,9 @@ bool ManagedUserService::ExtensionManagementPolicyImpl(
return false;
}
-ScopedVector<ManagedModeSiteList> ManagedUserService::GetActiveSiteLists() {
- ScopedVector<ManagedModeSiteList> site_lists;
+ScopedVector<SupervisedUserSiteList>
+SupervisedUserService::GetActiveSiteLists() {
+ ScopedVector<SupervisedUserSiteList> site_lists;
ExtensionService* extension_service =
extensions::ExtensionSystem::Get(profile_)->extension_service();
// Can be NULL in unit tests.
@@ -403,39 +404,39 @@ ScopedVector<ManagedModeSiteList> ManagedUserService::GetActiveSiteLists() {
extensions::ExtensionResource site_list =
extensions::ManagedModeInfo::GetContentPackSiteList(extension);
if (!site_list.empty()) {
- site_lists.push_back(new ManagedModeSiteList(extension->id(),
- site_list.GetFilePath()));
+ site_lists.push_back(new SupervisedUserSiteList(extension->id(),
+ site_list.GetFilePath()));
}
}
return site_lists.Pass();
}
-ManagedUserSettingsService* ManagedUserService::GetSettingsService() {
- return ManagedUserSettingsServiceFactory::GetForProfile(profile_);
+SupervisedUserSettingsService* SupervisedUserService::GetSettingsService() {
+ return SupervisedUserSettingsServiceFactory::GetForProfile(profile_);
}
-void ManagedUserService::OnManagedUserIdChanged() {
- std::string managed_user_id =
+void SupervisedUserService::OnSupervisedUserIdChanged() {
+ std::string supervised_user_id =
profile_->GetPrefs()->GetString(prefs::kSupervisedUserId);
- SetActive(!managed_user_id.empty());
+ SetActive(!supervised_user_id.empty());
}
-void ManagedUserService::OnDefaultFilteringBehaviorChanged() {
- DCHECK(ProfileIsManaged());
+void SupervisedUserService::OnDefaultFilteringBehaviorChanged() {
+ DCHECK(ProfileIsSupervised());
int behavior_value = profile_->GetPrefs()->GetInteger(
prefs::kDefaultSupervisedUserFilteringBehavior);
- ManagedModeURLFilter::FilteringBehavior behavior =
- ManagedModeURLFilter::BehaviorFromInt(behavior_value);
+ SupervisedUserURLFilter::FilteringBehavior behavior =
+ SupervisedUserURLFilter::BehaviorFromInt(behavior_value);
url_filter_context_.SetDefaultFilteringBehavior(behavior);
}
-void ManagedUserService::UpdateSiteLists() {
+void SupervisedUserService::UpdateSiteLists() {
url_filter_context_.LoadWhitelists(GetActiveSiteLists());
}
-bool ManagedUserService::AccessRequestsEnabled() {
+bool SupervisedUserService::AccessRequestsEnabled() {
if (waiting_for_permissions_)
return false;
@@ -448,16 +449,16 @@ bool ManagedUserService::AccessRequestsEnabled() {
state == GoogleServiceAuthError::SERVICE_UNAVAILABLE);
}
-void ManagedUserService::OnPermissionRequestIssued() {
+void SupervisedUserService::OnPermissionRequestIssued() {
waiting_for_permissions_ = false;
// TODO(akuegel): Figure out how to show the result of issuing the permission
// request in the UI. Currently, we assume the permission request was created
// successfully.
}
-void ManagedUserService::AddAccessRequest(const GURL& url) {
+void SupervisedUserService::AddAccessRequest(const GURL& url) {
// Normalize the URL.
- GURL normalized_url = ManagedModeURLFilter::Normalize(url);
+ GURL normalized_url = SupervisedUserURLFilter::Normalize(url);
// Escape the URL.
std::string output(net::EscapeQueryParamValue(normalized_url.spec(), true));
@@ -465,11 +466,12 @@ void ManagedUserService::AddAccessRequest(const GURL& url) {
waiting_for_permissions_ = true;
permissions_creator_->CreatePermissionRequest(
output,
- base::Bind(&ManagedUserService::OnPermissionRequestIssued,
+ base::Bind(&SupervisedUserService::OnPermissionRequestIssued,
weak_ptr_factory_.GetWeakPtr()));
}
-ManagedUserService::ManualBehavior ManagedUserService::GetManualBehaviorForHost(
+SupervisedUserService::ManualBehavior
+SupervisedUserService::GetManualBehaviorForHost(
const std::string& hostname) {
const base::DictionaryValue* dict =
profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUserManualHosts);
@@ -480,11 +482,12 @@ ManagedUserService::ManualBehavior ManagedUserService::GetManualBehaviorForHost(
return allow ? MANUAL_ALLOW : MANUAL_BLOCK;
}
-ManagedUserService::ManualBehavior ManagedUserService::GetManualBehaviorForURL(
+SupervisedUserService::ManualBehavior
+SupervisedUserService::GetManualBehaviorForURL(
const GURL& url) {
const base::DictionaryValue* dict =
profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUserManualURLs);
- GURL normalized_url = ManagedModeURLFilter::Normalize(url);
+ GURL normalized_url = SupervisedUserURLFilter::Normalize(url);
bool allow = false;
if (!dict->GetBooleanWithoutPathExpansion(normalized_url.spec(), &allow))
return MANUAL_NONE;
@@ -492,8 +495,9 @@ ManagedUserService::ManualBehavior ManagedUserService::GetManualBehaviorForURL(
return allow ? MANUAL_ALLOW : MANUAL_BLOCK;
}
-void ManagedUserService::GetManualExceptionsForHost(const std::string& host,
- std::vector<GURL>* urls) {
+void SupervisedUserService::GetManualExceptionsForHost(
+ const std::string& host,
+ std::vector<GURL>* urls) {
const base::DictionaryValue* dict =
profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUserManualURLs);
for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) {
@@ -503,7 +507,7 @@ void ManagedUserService::GetManualExceptionsForHost(const std::string& host,
}
}
-void ManagedUserService::InitSync(const std::string& refresh_token) {
+void SupervisedUserService::InitSync(const std::string& refresh_token) {
ProfileSyncService* service =
ProfileSyncServiceFactory::GetForProfile(profile_);
// Tell the sync service that setup is in progress so we don't start syncing
@@ -512,7 +516,7 @@ void ManagedUserService::InitSync(const std::string& refresh_token) {
ProfileOAuth2TokenService* token_service =
ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
- token_service->UpdateCredentials(managed_users::kManagedUserPseudoEmail,
+ token_service->UpdateCredentials(supervised_users::kSupervisedUserPseudoEmail,
refresh_token);
// Continue in SetupSync() once the Sync backend has been initialized.
@@ -524,19 +528,19 @@ void ManagedUserService::InitSync(const std::string& refresh_token) {
}
}
-void ManagedUserService::Init() {
+void SupervisedUserService::Init() {
DCHECK(GetSettingsService()->IsReady());
pref_change_registrar_.Init(profile_->GetPrefs());
pref_change_registrar_.Add(
prefs::kSupervisedUserId,
- base::Bind(&ManagedUserService::OnManagedUserIdChanged,
+ base::Bind(&SupervisedUserService::OnSupervisedUserIdChanged,
base::Unretained(this)));
- SetActive(ProfileIsManaged());
+ SetActive(ProfileIsSupervised());
}
-void ManagedUserService::SetActive(bool active) {
+void SupervisedUserService::SetActive(bool active) {
if (active_ == active)
return;
active_ = active;
@@ -555,7 +559,8 @@ void ManagedUserService::SetActive(bool active) {
ProfileOAuth2TokenService* token_service =
ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
- token_service->LoadCredentials(managed_users::kManagedUserPseudoEmail);
+ token_service->LoadCredentials(
+ supervised_users::kSupervisedUserPseudoEmail);
}
}
@@ -569,7 +574,7 @@ void ManagedUserService::SetActive(bool active) {
}
#endif
- ManagedUserSettingsService* settings_service = GetSettingsService();
+ SupervisedUserSettingsService* settings_service = GetSettingsService();
settings_service->SetActive(active_);
extensions::ExtensionSystem* extension_system =
@@ -586,7 +591,7 @@ void ManagedUserService::SetActive(bool active) {
PrefService* pref_service = profile_->GetPrefs();
permissions_creator_.reset(new PermissionRequestCreatorSync(
settings_service,
- ManagedUserSharedSettingsServiceFactory::GetForBrowserContext(
+ SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext(
profile_),
pref_service->GetString(prefs::kProfileName),
pref_service->GetString(prefs::kSupervisedUserId)));
@@ -600,13 +605,13 @@ void ManagedUserService::SetActive(bool active) {
pref_change_registrar_.Add(
prefs::kDefaultSupervisedUserFilteringBehavior,
- base::Bind(&ManagedUserService::OnDefaultFilteringBehaviorChanged,
+ base::Bind(&SupervisedUserService::OnDefaultFilteringBehaviorChanged,
base::Unretained(this)));
pref_change_registrar_.Add(prefs::kSupervisedUserManualHosts,
- base::Bind(&ManagedUserService::UpdateManualHosts,
+ base::Bind(&SupervisedUserService::UpdateManualHosts,
base::Unretained(this)));
pref_change_registrar_.Add(prefs::kSupervisedUserManualURLs,
- base::Bind(&ManagedUserService::UpdateManualURLs,
+ base::Bind(&SupervisedUserService::UpdateManualURLs,
base::Unretained(this)));
// Initialize the filter.
@@ -647,23 +652,23 @@ void ManagedUserService::SetActive(bool active) {
}
}
-void ManagedUserService::RegisterAndInitSync(
- ManagedUserRegistrationUtility* registration_utility,
+void SupervisedUserService::RegisterAndInitSync(
+ SupervisedUserRegistrationUtility* registration_utility,
Profile* custodian_profile,
- const std::string& managed_user_id,
+ const std::string& supervised_user_id,
const AuthErrorCallback& callback) {
- DCHECK(ProfileIsManaged());
+ DCHECK(ProfileIsSupervised());
DCHECK(!custodian_profile->IsSupervised());
base::string16 name = base::UTF8ToUTF16(
profile_->GetPrefs()->GetString(prefs::kProfileName));
int avatar_index = profile_->GetPrefs()->GetInteger(
prefs::kProfileAvatarIndex);
- ManagedUserRegistrationInfo info(name, avatar_index);
+ SupervisedUserRegistrationInfo info(name, avatar_index);
registration_utility->Register(
- managed_user_id,
+ supervised_user_id,
info,
- base::Bind(&ManagedUserService::OnManagedUserRegistered,
+ base::Bind(&SupervisedUserService::OnSupervisedUserRegistered,
weak_ptr_factory_.GetWeakPtr(), callback, custodian_profile));
// Fetch the custodian's profile information, to store the name.
@@ -673,17 +678,17 @@ void ManagedUserService::RegisterAndInitSync(
CustodianProfileDownloaderServiceFactory::GetForProfile(
custodian_profile);
profile_downloader_service->DownloadProfile(
- base::Bind(&ManagedUserService::OnCustodianProfileDownloaded,
+ base::Bind(&SupervisedUserService::OnCustodianProfileDownloaded,
weak_ptr_factory_.GetWeakPtr()));
}
-void ManagedUserService::OnCustodianProfileDownloaded(
+void SupervisedUserService::OnCustodianProfileDownloaded(
const base::string16& full_name) {
profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianName,
base::UTF16ToUTF8(full_name));
}
-void ManagedUserService::OnManagedUserRegistered(
+void SupervisedUserService::OnSupervisedUserRegistered(
const AuthErrorCallback& callback,
Profile* custodian_profile,
const GoogleServiceAuthError& auth_error,
@@ -695,7 +700,7 @@ void ManagedUserService::OnManagedUserRegistered(
profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianEmail,
signin->GetAuthenticatedUsername());
- // The managed-user profile is now ready for use.
+ // The supervised user profile is now ready for use.
ProfileManager* profile_manager = g_browser_process->profile_manager();
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
size_t index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
@@ -707,7 +712,7 @@ void ManagedUserService::OnManagedUserRegistered(
callback.Run(auth_error);
}
-void ManagedUserService::UpdateManualHosts() {
+void SupervisedUserService::UpdateManualHosts() {
const base::DictionaryValue* dict =
profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUserManualHosts);
scoped_ptr<std::map<std::string, bool> > host_map(
@@ -721,7 +726,7 @@ void ManagedUserService::UpdateManualHosts() {
url_filter_context_.SetManualHosts(host_map.Pass());
}
-void ManagedUserService::UpdateManualURLs() {
+void SupervisedUserService::UpdateManualURLs() {
const base::DictionaryValue* dict =
profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUserManualURLs);
scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>());
@@ -734,7 +739,7 @@ void ManagedUserService::UpdateManualURLs() {
url_filter_context_.SetManualURLs(url_map.Pass());
}
-void ManagedUserService::OnBrowserSetLastActive(Browser* browser) {
+void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) {
bool profile_became_active = profile_->IsSameProfile(browser->profile());
if (!is_profile_active_ && profile_became_active)
content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile"));

Powered by Google App Engine
This is Rietveld 408576698