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

Unified Diff: chrome/browser/ui/webui/options/supervised_user_import_handler.cc

Issue 1123283011: Use ScopedObserver to observe the SupervisedUserSyncService in SupervisedUserImportHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « chrome/browser/ui/webui/options/supervised_user_import_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/supervised_user_import_handler.cc
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 dc50eaa0355cc3ec300ca321a549f07ead0f3083..80c0470ddee504e370faa20e80d637de43daad75 100644
--- a/chrome/browser/ui/webui/options/supervised_user_import_handler.cc
+++ b/chrome/browser/ui/webui/options/supervised_user_import_handler.cc
@@ -56,19 +56,12 @@ namespace options {
SupervisedUserImportHandler::SupervisedUserImportHandler()
: profile_observer_(this),
signin_error_observer_(this),
+ supervised_user_sync_service_observer_(this),
removed_profile_is_supervised_(false),
weak_ptr_factory_(this) {
}
SupervisedUserImportHandler::~SupervisedUserImportHandler() {
- Profile* profile = Profile::FromWebUI(web_ui());
- if (!profile->IsSupervised()) {
- SupervisedUserSyncService* service =
- SupervisedUserSyncServiceFactory::GetForProfile(profile);
- if (service)
- service->RemoveObserver(this);
- subscription_.reset();
- }
}
void SupervisedUserImportHandler::GetLocalizedValues(
@@ -105,7 +98,7 @@ void SupervisedUserImportHandler::InitializeHandler() {
SupervisedUserSyncService* sync_service =
SupervisedUserSyncServiceFactory::GetForProfile(profile);
if (sync_service) {
- sync_service->AddObserver(this);
+ supervised_user_sync_service_observer_.Add(sync_service);
signin_error_observer_.Add(
SigninErrorControllerFactory::GetForProfile(profile));
SupervisedUserSharedSettingsService* settings_service =
« no previous file with comments | « chrome/browser/ui/webui/options/supervised_user_import_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698