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

Unified Diff: chrome/browser/supervised_user/supervised_user_registration_utility.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_registration_utility.cc
diff --git a/chrome/browser/managed_mode/managed_user_registration_utility.cc b/chrome/browser/supervised_user/supervised_user_registration_utility.cc
similarity index 40%
rename from chrome/browser/managed_mode/managed_user_registration_utility.cc
rename to chrome/browser/supervised_user/supervised_user_registration_utility.cc
index 6d2d8e166e7ec4f1e62e9e70eb41ffe9245b3a15..e53c858a065432d2553e62eb3aee5c1f7058f485 100644
--- a/chrome/browser/managed_mode/managed_user_registration_utility.cc
+++ b/chrome/browser/supervised_user/supervised_user_registration_utility.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_registration_utility.h"
+#include "chrome/browser/supervised_user/supervised_user_registration_utility.h"
#include "base/base64.h"
#include "base/bind.h"
@@ -11,16 +11,16 @@
#include "base/prefs/pref_service.h"
#include "base/rand_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/managed_mode/managed_user_constants.h"
-#include "chrome/browser/managed_mode/managed_user_refresh_token_fetcher.h"
-#include "chrome/browser/managed_mode/managed_user_shared_settings_service.h"
-#include "chrome/browser/managed_mode/managed_user_shared_settings_service_factory.h"
-#include "chrome/browser/managed_mode/managed_user_shared_settings_update.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/profiles/profile.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
+#include "chrome/browser/supervised_user/supervised_user_constants.h"
+#include "chrome/browser/supervised_user/supervised_user_refresh_token_fetcher.h"
+#include "chrome/browser/supervised_user/supervised_user_shared_settings_service.h"
+#include "chrome/browser/supervised_user/supervised_user_shared_settings_service_factory.h"
+#include "chrome/browser/supervised_user/supervised_user_shared_settings_update.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/glue/device_info.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
@@ -33,45 +33,44 @@ using base::DictionaryValue;
namespace {
-ManagedUserRegistrationUtility* g_instance_for_tests = NULL;
+SupervisedUserRegistrationUtility* g_instance_for_tests = NULL;
-// Actual implementation of ManagedUserRegistrationUtility.
-class ManagedUserRegistrationUtilityImpl
- : public ManagedUserRegistrationUtility,
- public ManagedUserSyncServiceObserver {
+// Actual implementation of SupervisedUserRegistrationUtility.
+class SupervisedUserRegistrationUtilityImpl
+ : public SupervisedUserRegistrationUtility,
+ public SupervisedUserSyncServiceObserver {
public:
- ManagedUserRegistrationUtilityImpl(
+ SupervisedUserRegistrationUtilityImpl(
PrefService* prefs,
- scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher,
- ManagedUserSyncService* service,
- ManagedUserSharedSettingsService* shared_settings_service);
-
- virtual ~ManagedUserRegistrationUtilityImpl();
-
- // Registers a new managed user with the server. |managed_user_id| is a new
- // unique ID for the new managed user. If its value is the same as that of
- // of one of the existing managed users, then the same user will be created
- // on this machine (and if he has no avatar in sync, his avatar will
- // be updated). |info| contains necessary information like
- // the display name of the user and his avatar. |callback| is called
- // with the result of the registration. We use the info here and not the
- // profile, because on Chrome OS the profile of the managed user does not
- // yet exist.
- virtual void Register(const std::string& managed_user_id,
- const ManagedUserRegistrationInfo& info,
+ scoped_ptr<SupervisedUserRefreshTokenFetcher> token_fetcher,
+ SupervisedUserSyncService* service,
+ SupervisedUserSharedSettingsService* shared_settings_service);
+
+ virtual ~SupervisedUserRegistrationUtilityImpl();
+
+ // Registers a new supervised user with the server. |supervised_user_id| is a
+ // new unique ID for the new supervised user. If its value is the same as that
+ // of one of the existing supervised users, then the same user will be created
+ // on this machine (and if he has no avatar in sync, his avatar will be
+ // updated). |info| contains necessary information like the display name of
+ // the user and his avatar. |callback| is called with the result of the
+ // registration. We use the info here and not the profile, because on Chrome
+ // OS the profile of the supervised user does not yet exist.
+ virtual void Register(const std::string& supervised_user_id,
+ const SupervisedUserRegistrationInfo& info,
const RegistrationCallback& callback) OVERRIDE;
- // ManagedUserSyncServiceObserver:
- virtual void OnManagedUserAcknowledged(const std::string& managed_user_id)
- OVERRIDE;
- virtual void OnManagedUsersSyncingStopped() OVERRIDE;
- virtual void OnManagedUsersChanged() OVERRIDE;
+ // SupervisedUserSyncServiceObserver:
+ virtual void OnSupervisedUserAcknowledged(
+ const std::string& supervised_user_id) OVERRIDE;
+ virtual void OnSupervisedUsersSyncingStopped() OVERRIDE;
+ virtual void OnSupervisedUsersChanged() OVERRIDE;
private:
- // Fetches the managed user token when we have the device name.
+ // Fetches the supervised user token when we have the device name.
void FetchToken(const std::string& client_name);
- // Called when we have received a token for the managed user.
+ // Called when we have received a token for the supervised user.
void OnReceivedToken(const GoogleServiceAuthError& error,
const std::string& token);
@@ -93,59 +92,59 @@ class ManagedUserRegistrationUtilityImpl
// callback or reporting an error.
void CancelPendingRegistration();
- // ManagedUserSharedSettingsUpdate acknowledgment callback for password data
- // in shared settings.
+ // SupervisedUserSharedSettingsUpdate acknowledgment callback for password
+ // data in shared settings.
void OnPasswordChangeAcknowledged(bool success);
PrefService* prefs_;
- scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher_;
+ scoped_ptr<SupervisedUserRefreshTokenFetcher> token_fetcher_;
// A |KeyedService| owned by the custodian profile.
- ManagedUserSyncService* managed_user_sync_service_;
+ SupervisedUserSyncService* supervised_user_sync_service_;
// A |KeyedService| owned by the custodian profile.
- ManagedUserSharedSettingsService* managed_user_shared_settings_service_;
+ SupervisedUserSharedSettingsService* supervised_user_shared_settings_service_;
- std::string pending_managed_user_id_;
- std::string pending_managed_user_token_;
- bool pending_managed_user_acknowledged_;
- bool is_existing_managed_user_;
+ std::string pending_supervised_user_id_;
+ std::string pending_supervised_user_token_;
+ bool pending_supervised_user_acknowledged_;
+ bool is_existing_supervised_user_;
bool avatar_updated_;
RegistrationCallback callback_;
- scoped_ptr<ManagedUserSharedSettingsUpdate> password_update_;
+ scoped_ptr<SupervisedUserSharedSettingsUpdate> password_update_;
- base::WeakPtrFactory<ManagedUserRegistrationUtilityImpl> weak_ptr_factory_;
+ base::WeakPtrFactory<SupervisedUserRegistrationUtilityImpl> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(ManagedUserRegistrationUtilityImpl);
+ DISALLOW_COPY_AND_ASSIGN(SupervisedUserRegistrationUtilityImpl);
};
} // namespace
-ManagedUserRegistrationInfo::ManagedUserRegistrationInfo(
+SupervisedUserRegistrationInfo::SupervisedUserRegistrationInfo(
const base::string16& name,
int avatar_index)
: avatar_index(avatar_index),
name(name) {
}
-ManagedUserRegistrationInfo::~ManagedUserRegistrationInfo() {}
+SupervisedUserRegistrationInfo::~SupervisedUserRegistrationInfo() {}
-ScopedTestingManagedUserRegistrationUtility::
- ScopedTestingManagedUserRegistrationUtility(
- ManagedUserRegistrationUtility* instance) {
- ManagedUserRegistrationUtility::SetUtilityForTests(instance);
+ScopedTestingSupervisedUserRegistrationUtility::
+ ScopedTestingSupervisedUserRegistrationUtility(
+ SupervisedUserRegistrationUtility* instance) {
+ SupervisedUserRegistrationUtility::SetUtilityForTests(instance);
}
-ScopedTestingManagedUserRegistrationUtility::
- ~ScopedTestingManagedUserRegistrationUtility() {
- ManagedUserRegistrationUtility::SetUtilityForTests(NULL);
+ScopedTestingSupervisedUserRegistrationUtility::
+ ~ScopedTestingSupervisedUserRegistrationUtility() {
+ SupervisedUserRegistrationUtility::SetUtilityForTests(NULL);
}
// static
-scoped_ptr<ManagedUserRegistrationUtility>
-ManagedUserRegistrationUtility::Create(Profile* profile) {
+scoped_ptr<SupervisedUserRegistrationUtility>
+SupervisedUserRegistrationUtility::Create(Profile* profile) {
if (g_instance_for_tests) {
- ManagedUserRegistrationUtility* result = g_instance_for_tests;
+ SupervisedUserRegistrationUtility* result = g_instance_for_tests;
g_instance_for_tests = NULL;
return make_scoped_ptr(result);
}
@@ -154,111 +153,115 @@ ManagedUserRegistrationUtility::Create(Profile* profile) {
ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
SigninManagerBase* signin_manager =
SigninManagerFactory::GetForProfile(profile);
- scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher =
- ManagedUserRefreshTokenFetcher::Create(
+ scoped_ptr<SupervisedUserRefreshTokenFetcher> token_fetcher =
+ SupervisedUserRefreshTokenFetcher::Create(
token_service,
signin_manager->GetAuthenticatedAccountId(),
profile->GetRequestContext());
- ManagedUserSyncService* managed_user_sync_service =
- ManagedUserSyncServiceFactory::GetForProfile(profile);
- ManagedUserSharedSettingsService* managed_user_shared_settings_service =
- ManagedUserSharedSettingsServiceFactory::GetForBrowserContext(profile);
- return make_scoped_ptr(ManagedUserRegistrationUtility::CreateImpl(
+ SupervisedUserSyncService* supervised_user_sync_service =
+ SupervisedUserSyncServiceFactory::GetForProfile(profile);
+ SupervisedUserSharedSettingsService* supervised_user_shared_settings_service =
+ SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext(profile);
+ return make_scoped_ptr(SupervisedUserRegistrationUtility::CreateImpl(
profile->GetPrefs(),
token_fetcher.Pass(),
- managed_user_sync_service,
- managed_user_shared_settings_service));
+ supervised_user_sync_service,
+ supervised_user_shared_settings_service));
}
// static
-std::string ManagedUserRegistrationUtility::GenerateNewManagedUserId() {
- std::string new_managed_user_id;
- base::Base64Encode(base::RandBytesAsString(8), &new_managed_user_id);
- return new_managed_user_id;
+std::string SupervisedUserRegistrationUtility::GenerateNewSupervisedUserId() {
+ std::string new_supervised_user_id;
+ base::Base64Encode(base::RandBytesAsString(8), &new_supervised_user_id);
+ return new_supervised_user_id;
}
// static
-void ManagedUserRegistrationUtility::SetUtilityForTests(
- ManagedUserRegistrationUtility* utility) {
+void SupervisedUserRegistrationUtility::SetUtilityForTests(
+ SupervisedUserRegistrationUtility* utility) {
if (g_instance_for_tests)
delete g_instance_for_tests;
g_instance_for_tests = utility;
}
// static
-ManagedUserRegistrationUtility* ManagedUserRegistrationUtility::CreateImpl(
+SupervisedUserRegistrationUtility*
+SupervisedUserRegistrationUtility::CreateImpl(
PrefService* prefs,
- scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher,
- ManagedUserSyncService* service,
- ManagedUserSharedSettingsService* shared_settings_service) {
- return new ManagedUserRegistrationUtilityImpl(prefs,
- token_fetcher.Pass(),
- service,
- shared_settings_service);
+ scoped_ptr<SupervisedUserRefreshTokenFetcher> token_fetcher,
+ SupervisedUserSyncService* service,
+ SupervisedUserSharedSettingsService* shared_settings_service) {
+ return new SupervisedUserRegistrationUtilityImpl(prefs,
+ token_fetcher.Pass(),
+ service,
+ shared_settings_service);
}
namespace {
-ManagedUserRegistrationUtilityImpl::ManagedUserRegistrationUtilityImpl(
+SupervisedUserRegistrationUtilityImpl::SupervisedUserRegistrationUtilityImpl(
PrefService* prefs,
- scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher,
- ManagedUserSyncService* service,
- ManagedUserSharedSettingsService* shared_settings_service)
+ scoped_ptr<SupervisedUserRefreshTokenFetcher> token_fetcher,
+ SupervisedUserSyncService* service,
+ SupervisedUserSharedSettingsService* shared_settings_service)
: prefs_(prefs),
token_fetcher_(token_fetcher.Pass()),
- managed_user_sync_service_(service),
- managed_user_shared_settings_service_(shared_settings_service),
- pending_managed_user_acknowledged_(false),
- is_existing_managed_user_(false),
+ supervised_user_sync_service_(service),
+ supervised_user_shared_settings_service_(shared_settings_service),
+ pending_supervised_user_acknowledged_(false),
+ is_existing_supervised_user_(false),
avatar_updated_(false),
weak_ptr_factory_(this) {
- managed_user_sync_service_->AddObserver(this);
+ supervised_user_sync_service_->AddObserver(this);
}
-ManagedUserRegistrationUtilityImpl::~ManagedUserRegistrationUtilityImpl() {
- managed_user_sync_service_->RemoveObserver(this);
+SupervisedUserRegistrationUtilityImpl::
+~SupervisedUserRegistrationUtilityImpl() {
+ supervised_user_sync_service_->RemoveObserver(this);
CancelPendingRegistration();
}
-void ManagedUserRegistrationUtilityImpl::Register(
- const std::string& managed_user_id,
- const ManagedUserRegistrationInfo& info,
+void SupervisedUserRegistrationUtilityImpl::Register(
+ const std::string& supervised_user_id,
+ const SupervisedUserRegistrationInfo& info,
const RegistrationCallback& callback) {
- DCHECK(pending_managed_user_id_.empty());
+ DCHECK(pending_supervised_user_id_.empty());
callback_ = callback;
- pending_managed_user_id_ = managed_user_id;
+ pending_supervised_user_id_ = supervised_user_id;
bool need_password_update = !info.password_data.empty();
const base::DictionaryValue* dict =
prefs_->GetDictionary(prefs::kSupervisedUsers);
- is_existing_managed_user_ = dict->HasKey(managed_user_id);
- if (!is_existing_managed_user_) {
- managed_user_sync_service_->AddManagedUser(pending_managed_user_id_,
- base::UTF16ToUTF8(info.name),
- info.master_key,
- info.password_signature_key,
- info.password_encryption_key,
- info.avatar_index);
+ is_existing_supervised_user_ = dict->HasKey(supervised_user_id);
+ if (!is_existing_supervised_user_) {
+ supervised_user_sync_service_->AddSupervisedUser(
+ pending_supervised_user_id_,
+ base::UTF16ToUTF8(info.name),
+ info.master_key,
+ info.password_signature_key,
+ info.password_encryption_key,
+ info.avatar_index);
} else {
const base::DictionaryValue* value = NULL;
bool success =
- dict->GetDictionaryWithoutPathExpansion(managed_user_id, &value);
+ dict->GetDictionaryWithoutPathExpansion(supervised_user_id, &value);
DCHECK(success);
std::string key;
bool need_keys = !info.password_signature_key.empty() ||
!info.password_encryption_key.empty();
bool have_keys =
- value->GetString(ManagedUserSyncService::kPasswordSignatureKey, &key) &&
+ value->GetString(SupervisedUserSyncService::kPasswordSignatureKey,
+ &key) &&
!key.empty() &&
- value->GetString(ManagedUserSyncService::kPasswordEncryptionKey,
+ value->GetString(SupervisedUserSyncService::kPasswordEncryptionKey,
&key) &&
!key.empty();
bool keys_need_update = need_keys && !have_keys;
if (keys_need_update) {
- managed_user_sync_service_->UpdateManagedUser(
- pending_managed_user_id_,
+ supervised_user_sync_service_->UpdateSupervisedUser(
+ pending_supervised_user_id_,
base::UTF16ToUTF8(info.name),
info.master_key,
info.password_signature_key,
@@ -267,52 +270,53 @@ void ManagedUserRegistrationUtilityImpl::Register(
} else {
// The user already exists and does not need to be updated.
need_password_update = false;
- OnManagedUserAcknowledged(managed_user_id);
+ OnSupervisedUserAcknowledged(supervised_user_id);
}
avatar_updated_ =
- managed_user_sync_service_->UpdateManagedUserAvatarIfNeeded(
- managed_user_id,
+ supervised_user_sync_service_->UpdateSupervisedUserAvatarIfNeeded(
+ supervised_user_id,
info.avatar_index);
}
#if defined(OS_CHROMEOS)
- const char* kAvatarKey = managed_users::kChromeOSAvatarIndex;
+ const char* kAvatarKey = supervised_users::kChromeOSAvatarIndex;
#else
- const char* kAvatarKey = managed_users::kChromeAvatarIndex;
+ const char* kAvatarKey = supervised_users::kChromeAvatarIndex;
#endif
- managed_user_shared_settings_service_->SetValue(
- pending_managed_user_id_, kAvatarKey,
+ supervised_user_shared_settings_service_->SetValue(
+ pending_supervised_user_id_, kAvatarKey,
base::FundamentalValue(info.avatar_index));
if (need_password_update) {
- password_update_.reset(new ManagedUserSharedSettingsUpdate(
- managed_user_shared_settings_service_,
- pending_managed_user_id_,
- managed_users::kChromeOSPasswordData,
+ password_update_.reset(new SupervisedUserSharedSettingsUpdate(
+ supervised_user_shared_settings_service_,
+ pending_supervised_user_id_,
+ supervised_users::kChromeOSPasswordData,
scoped_ptr<base::Value>(info.password_data.DeepCopy()),
base::Bind(
- &ManagedUserRegistrationUtilityImpl::OnPasswordChangeAcknowledged,
+ &SupervisedUserRegistrationUtilityImpl::
+ OnPasswordChangeAcknowledged,
weak_ptr_factory_.GetWeakPtr())));
}
browser_sync::DeviceInfo::GetClientName(
- base::Bind(&ManagedUserRegistrationUtilityImpl::FetchToken,
+ base::Bind(&SupervisedUserRegistrationUtilityImpl::FetchToken,
weak_ptr_factory_.GetWeakPtr()));
}
-void ManagedUserRegistrationUtilityImpl::CancelPendingRegistration() {
+void SupervisedUserRegistrationUtilityImpl::CancelPendingRegistration() {
AbortPendingRegistration(
false, // Don't run the callback. The error will be ignored.
GoogleServiceAuthError(GoogleServiceAuthError::NONE));
}
-void ManagedUserRegistrationUtilityImpl::OnManagedUserAcknowledged(
- const std::string& managed_user_id) {
- DCHECK_EQ(pending_managed_user_id_, managed_user_id);
- DCHECK(!pending_managed_user_acknowledged_);
- pending_managed_user_acknowledged_ = true;
+void SupervisedUserRegistrationUtilityImpl::OnSupervisedUserAcknowledged(
+ const std::string& supervised_user_id) {
+ DCHECK_EQ(pending_supervised_user_id_, supervised_user_id);
+ DCHECK(!pending_supervised_user_acknowledged_);
+ pending_supervised_user_acknowledged_ = true;
CompleteRegistrationIfReady();
}
-void ManagedUserRegistrationUtilityImpl::OnPasswordChangeAcknowledged(
+void SupervisedUserRegistrationUtilityImpl::OnPasswordChangeAcknowledged(
bool success) {
DCHECK(password_update_);
DCHECK(success);
@@ -320,23 +324,23 @@ void ManagedUserRegistrationUtilityImpl::OnPasswordChangeAcknowledged(
CompleteRegistrationIfReady();
}
-void ManagedUserRegistrationUtilityImpl::OnManagedUsersSyncingStopped() {
+void SupervisedUserRegistrationUtilityImpl::OnSupervisedUsersSyncingStopped() {
AbortPendingRegistration(
true, // Run the callback.
GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED));
}
-void ManagedUserRegistrationUtilityImpl::OnManagedUsersChanged() {}
+void SupervisedUserRegistrationUtilityImpl::OnSupervisedUsersChanged() {}
-void ManagedUserRegistrationUtilityImpl::FetchToken(
+void SupervisedUserRegistrationUtilityImpl::FetchToken(
const std::string& client_name) {
token_fetcher_->Start(
- pending_managed_user_id_, client_name,
- base::Bind(&ManagedUserRegistrationUtilityImpl::OnReceivedToken,
+ pending_supervised_user_id_, client_name,
+ base::Bind(&SupervisedUserRegistrationUtilityImpl::OnReceivedToken,
weak_ptr_factory_.GetWeakPtr()));
}
-void ManagedUserRegistrationUtilityImpl::OnReceivedToken(
+void SupervisedUserRegistrationUtilityImpl::OnReceivedToken(
const GoogleServiceAuthError& error,
const std::string& token) {
if (error.state() != GoogleServiceAuthError::NONE) {
@@ -345,57 +349,59 @@ void ManagedUserRegistrationUtilityImpl::OnReceivedToken(
}
DCHECK(!token.empty());
- pending_managed_user_token_ = token;
+ pending_supervised_user_token_ = token;
CompleteRegistrationIfReady();
}
-void ManagedUserRegistrationUtilityImpl::CompleteRegistrationIfReady() {
+void SupervisedUserRegistrationUtilityImpl::CompleteRegistrationIfReady() {
bool skip_check = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNoSupervisedUserAcknowledgmentCheck);
- if (!pending_managed_user_acknowledged_ && !skip_check)
+ if (!pending_supervised_user_acknowledged_ && !skip_check)
return;
if (password_update_ && !skip_check)
return;
- if (pending_managed_user_token_.empty())
+ if (pending_supervised_user_token_.empty())
return;
GoogleServiceAuthError error(GoogleServiceAuthError::NONE);
CompleteRegistration(true, error);
}
-void ManagedUserRegistrationUtilityImpl::AbortPendingRegistration(
+void SupervisedUserRegistrationUtilityImpl::AbortPendingRegistration(
bool run_callback,
const GoogleServiceAuthError& error) {
- pending_managed_user_token_.clear();
+ pending_supervised_user_token_.clear();
CompleteRegistration(run_callback, error);
}
-void ManagedUserRegistrationUtilityImpl::CompleteRegistration(
+void SupervisedUserRegistrationUtilityImpl::CompleteRegistration(
bool run_callback,
const GoogleServiceAuthError& error) {
if (callback_.is_null())
return;
- if (pending_managed_user_token_.empty()) {
- DCHECK(!pending_managed_user_id_.empty());
+ if (pending_supervised_user_token_.empty()) {
+ DCHECK(!pending_supervised_user_id_.empty());
- if (!is_existing_managed_user_) {
- // Remove the pending managed user if we weren't successful.
- // However, check that we are not importing a managed user
+ if (!is_existing_supervised_user_) {
+ // Remove the pending supervised user if we weren't successful.
+ // However, check that we are not importing a supervised user
// before deleting it from sync to avoid accidental deletion of
- // existing managed users by just canceling the registration for example.
- managed_user_sync_service_->DeleteManagedUser(pending_managed_user_id_);
+ // existing supervised users by just canceling the registration for
+ // example.
+ supervised_user_sync_service_->DeleteSupervisedUser(
+ pending_supervised_user_id_);
} else if (avatar_updated_) {
- // Canceling (or failing) a managed user import that did set the avatar
+ // Canceling (or failing) a supervised user import that did set the avatar
// should undo this change.
- managed_user_sync_service_->ClearManagedUserAvatar(
- pending_managed_user_id_);
+ supervised_user_sync_service_->ClearSupervisedUserAvatar(
+ pending_supervised_user_id_);
}
}
if (run_callback)
- callback_.Run(error, pending_managed_user_token_);
+ callback_.Run(error, pending_supervised_user_token_);
callback_.Reset();
}

Powered by Google App Engine
This is Rietveld 408576698