From 88da63664e112a412cee277f459b27a05d16a657 Mon Sep 17 00:00:00 2001 From: treib Date: Fri, 29 May 2015 08:41:56 -0700 Subject: [PATCH] Don't show supervised user as "already on this device" while they're being imported. BUG=493087 Review URL: https://codereview.chromium.org/1159003005 Cr-Commit-Position: refs/heads/master@{#331977} --- .../ui/webui/options/supervised_user_import_handler.cc | 12 +++++++++++- .../ui/webui/options/supervised_user_import_handler.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/chrome/browser/ui/webui/options/supervised_user_import_handler.cc b/chrome/browser/ui/webui/options/supervised_user_import_handler.cc index 80c0470ddee5..ee1d69ec9fd8 100644 --- a/chrome/browser/ui/webui/options/supervised_user_import_handler.cc +++ b/chrome/browser/ui/webui/options/supervised_user_import_handler.cc @@ -149,6 +149,12 @@ void SupervisedUserImportHandler::OnProfileWasRemoved( } } +void SupervisedUserImportHandler::OnProfileIsOmittedChanged( + const base::FilePath& profile_path) { + if (ProfileIsLegacySupervised(profile_path)) + FetchSupervisedUsers(); +} + void SupervisedUserImportHandler::OnSupervisedUsersChanged() { FetchSupervisedUsers(); } @@ -187,8 +193,12 @@ void SupervisedUserImportHandler::SendExistingSupervisedUsers( // Collect the ids of local supervised user profiles. std::set supervised_user_ids; for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { - if (cache.ProfileIsLegacySupervisedAtIndex(i)) + // Filter out omitted profiles. These are currently being imported, and + // shouldn't show up as "already on this device" just yet. + if (cache.ProfileIsLegacySupervisedAtIndex(i) && + !cache.IsOmittedProfileAtIndex(i)) { supervised_user_ids.insert(cache.GetSupervisedUserIdOfProfileAtIndex(i)); + } } base::ListValue supervised_users; diff --git a/chrome/browser/ui/webui/options/supervised_user_import_handler.h b/chrome/browser/ui/webui/options/supervised_user_import_handler.h index 0aa9fcaafaff..46e93a26a1f2 100644 --- a/chrome/browser/ui/webui/options/supervised_user_import_handler.h +++ b/chrome/browser/ui/webui/options/supervised_user_import_handler.h @@ -51,6 +51,7 @@ class SupervisedUserImportHandler : public OptionsPageUIHandler, void OnProfileWillBeRemoved(const base::FilePath& profile_path) override; void OnProfileWasRemoved(const base::FilePath& profile_path, const base::string16& profile_name) override; + void OnProfileIsOmittedChanged(const base::FilePath& profile_path) override; // SupervisedUserSyncServiceObserver implementation. void OnSupervisedUserAcknowledged( -- 2.11.4.GIT