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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_service.cc

Issue 460383002: Only deactivate SupervisedUserService when removing its delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_service.h" 5 #include "chrome/browser/supervised_user/supervised_user_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 prefs::kSupervisedUserSecondCustodianName, std::string(), 191 prefs::kSupervisedUserSecondCustodianName, std::string(),
192 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 192 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
193 registry->RegisterStringPref( 193 registry->RegisterStringPref(
194 prefs::kSupervisedUserSecondCustodianProfileImageURL, std::string(), 194 prefs::kSupervisedUserSecondCustodianProfileImageURL, std::string(),
195 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 195 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
196 registry->RegisterBooleanPref(prefs::kSupervisedUserCreationAllowed, true, 196 registry->RegisterBooleanPref(prefs::kSupervisedUserCreationAllowed, true,
197 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 197 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
198 } 198 }
199 199
200 void SupervisedUserService::SetDelegate(Delegate* delegate) { 200 void SupervisedUserService::SetDelegate(Delegate* delegate) {
201 if (delegate_ == delegate) 201 if (delegate) {
202 return; 202 // Changing delegates isn't allowed.
203 // If the delegate changed, deactivate first to give the old delegate a chance 203 DCHECK(!delegate_);
204 // to clean up. 204 } else {
205 SetActive(false); 205 // If the delegate is removed, deactivate first to give the old delegate a
206 // chance to clean up.
207 SetActive(false);
208 }
206 delegate_ = delegate; 209 delegate_ = delegate;
207 } 210 }
208 211
209 scoped_refptr<const SupervisedUserURLFilter> 212 scoped_refptr<const SupervisedUserURLFilter>
210 SupervisedUserService::GetURLFilterForIOThread() { 213 SupervisedUserService::GetURLFilterForIOThread() {
211 return url_filter_context_.io_url_filter(); 214 return url_filter_context_.io_url_filter();
212 } 215 }
213 216
214 SupervisedUserURLFilter* SupervisedUserService::GetURLFilterForUIThread() { 217 SupervisedUserURLFilter* SupervisedUserService::GetURLFilterForUIThread() {
215 return url_filter_context_.ui_url_filter(); 218 return url_filter_context_.ui_url_filter();
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 // The active user can be NULL in unit tests. 785 // The active user can be NULL in unit tests.
783 if (chromeos::UserManager::Get()->GetActiveUser()) { 786 if (chromeos::UserManager::Get()->GetActiveUser()) {
784 return UTF16ToUTF8(chromeos::UserManager::Get()->GetUserDisplayName( 787 return UTF16ToUTF8(chromeos::UserManager::Get()->GetUserDisplayName(
785 chromeos::UserManager::Get()->GetActiveUser()->GetUserID())); 788 chromeos::UserManager::Get()->GetActiveUser()->GetUserID()));
786 } 789 }
787 return std::string(); 790 return std::string();
788 #else 791 #else
789 return profile_->GetPrefs()->GetString(prefs::kProfileName); 792 return profile_->GetPrefs()->GetString(prefs::kProfileName);
790 #endif 793 #endif
791 } 794 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698