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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_pref_store.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/supervised_user/supervised_user_pref_store.h" 5 #include "chrome/browser/supervised_user/supervised_user_pref_store.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 } // namespace 64 } // namespace
65 65
66 SupervisedUserPrefStore::SupervisedUserPrefStore( 66 SupervisedUserPrefStore::SupervisedUserPrefStore(
67 SupervisedUserSettingsService* supervised_user_settings_service) { 67 SupervisedUserSettingsService* supervised_user_settings_service) {
68 user_settings_subscription_ = supervised_user_settings_service->Subscribe( 68 user_settings_subscription_ = supervised_user_settings_service->Subscribe(
69 base::Bind(&SupervisedUserPrefStore::OnNewSettingsAvailable, 69 base::Bind(&SupervisedUserPrefStore::OnNewSettingsAvailable,
70 base::Unretained(this))); 70 base::Unretained(this)));
71 71
72 // Should only be nullptr in unit tests 72 // Should only be nullptr in unit tests
73 // TODO(peconn): Remove this notification once HostContentSettingsMap is 73 // TODO(peconn): Remove this once SupervisedUserPrefStore is (partially at
74 // a KeyedService. 74 // least) a KeyedService. The user_settings_subscription_ must be reset or
75 // destroyed before the SupervisedUserSettingsService is.
75 if (supervised_user_settings_service->GetProfile() != nullptr){ 76 if (supervised_user_settings_service->GetProfile() != nullptr){
76 unsubscriber_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, 77 unsubscriber_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
77 content::Source<Profile>( 78 content::Source<Profile>(
78 supervised_user_settings_service->GetProfile())); 79 supervised_user_settings_service->GetProfile()));
79 } 80 }
80 } 81 }
81 82
82 bool SupervisedUserPrefStore::GetValue(const std::string& key, 83 bool SupervisedUserPrefStore::GetValue(const std::string& key,
83 const base::Value** value) const { 84 const base::Value** value) const {
84 // TODO(bauerb): Temporary CHECK to force a clean crash while investigating 85 // TODO(bauerb): Temporary CHECK to force a clean crash while investigating
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 166 }
166 167
167 // Callback to unsubscribe from the supervised user settings service. 168 // Callback to unsubscribe from the supervised user settings service.
168 void SupervisedUserPrefStore::Observe( 169 void SupervisedUserPrefStore::Observe(
169 int type, 170 int type,
170 const content::NotificationSource& src, 171 const content::NotificationSource& src,
171 const content::NotificationDetails& details) { 172 const content::NotificationDetails& details) {
172 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); 173 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type);
173 user_settings_subscription_.reset(); 174 user_settings_subscription_.reset();
174 } 175 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698