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

Unified Diff: chrome/browser/content_settings/content_settings_supervised_provider.cc

Issue 1312453005: Removed Profile::GetHostContentSettingsMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed patch conflict Created 5 years, 3 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/content_settings/content_settings_supervised_provider.cc
diff --git a/chrome/browser/content_settings/content_settings_supervised_provider.cc b/chrome/browser/content_settings/content_settings_supervised_provider.cc
index c45e638fc4cdc5e0d0e2a9814e2ec3fe6c526054..e956f0a6898ea08653e54c3795363faacddcfcd2 100644
--- a/chrome/browser/content_settings/content_settings_supervised_provider.cc
+++ b/chrome/browser/content_settings/content_settings_supervised_provider.cc
@@ -7,10 +7,8 @@
#include <string>
#include <vector>
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/supervised_user/supervised_user_constants.h"
#include "chrome/browser/supervised_user/supervised_user_settings_service.h"
-#include "content/public/browser/notification_source.h"
namespace {
@@ -38,22 +36,16 @@ const ContentSettingsFromSupervisedSettingsEntry
namespace content_settings {
SupervisedProvider::SupervisedProvider(
- SupervisedUserSettingsService* supervised_user_settings_service)
- : unsubscriber_registrar_(new content::NotificationRegistrar()) {
+ SupervisedUserSettingsService* supervised_user_settings_service) {
+ // The SupervisedProvider is owned by the HostContentSettingsMap which
+ // DependsOn the SupervisedUserSettingsService (through their factories).
+ // This means this will get destroyed before the SUSS and will be
+ // unsubscribed from it.
user_settings_subscription_ = supervised_user_settings_service->Subscribe(
base::Bind(
&content_settings::SupervisedProvider::OnSupervisedSettingsAvailable,
base::Unretained(this)));
-
- // Should only be nullptr in unit tests
- // TODO(peconn): Remove this notification once HostContentSettingsMap is
- // a KeyedService.
- if (supervised_user_settings_service->GetProfile() != nullptr){
- unsubscriber_registrar_->Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
- content::Source<Profile>(
- supervised_user_settings_service->GetProfile()));
- }
}
SupervisedProvider::~SupervisedProvider() {
@@ -112,16 +104,6 @@ void SupervisedProvider::ShutdownOnUIThread() {
DCHECK(CalledOnValidThread());
RemoveAllObservers();
user_settings_subscription_.reset();
- unsubscriber_registrar_.reset();
-}
-
-// Callback to unsubscribe from the supervised user settings service.
-void SupervisedProvider::Observe(
- int type,
- const content::NotificationSource& src,
- const content::NotificationDetails& details) {
- DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type);
- user_settings_subscription_.reset();
}
} // namespace content_settings

Powered by Google App Engine
This is Rietveld 408576698