Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/login/supervised_user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/supervised_user_manager_impl.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_registry_simple.h" | 7 #include "base/prefs/pref_registry_simple.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 GetString(kLocallyManagedUserCreationTransactionDisplayName); | 256 GetString(kLocallyManagedUserCreationTransactionDisplayName); |
| 257 std::string user_id = prefs-> | 257 std::string user_id = prefs-> |
| 258 GetString(kLocallyManagedUserCreationTransactionUserId); | 258 GetString(kLocallyManagedUserCreationTransactionUserId); |
| 259 | 259 |
| 260 LOG(WARNING) << "Cleaning up transaction for " | 260 LOG(WARNING) << "Cleaning up transaction for " |
| 261 << display_name << "/" << user_id; | 261 << display_name << "/" << user_id; |
| 262 | 262 |
| 263 if (user_id.empty()) { | 263 if (user_id.empty()) { |
| 264 // Not much to do - just remove transaction. | 264 // Not much to do - just remove transaction. |
| 265 prefs->ClearPref(kLocallyManagedUserCreationTransactionDisplayName); | 265 prefs->ClearPref(kLocallyManagedUserCreationTransactionDisplayName); |
| 266 prefs->CommitPendingWrite(); | |
| 266 return; | 267 return; |
| 267 } | 268 } |
| 268 | 269 |
| 269 if (gaia::ExtractDomainName(user_id) != | 270 if (gaia::ExtractDomainName(user_id) != |
| 270 UserManager::kLocallyManagedUserDomain) { | 271 UserManager::kLocallyManagedUserDomain) { |
| 271 LOG(WARNING) << "Clean up transaction for non-locally managed user found :" | 272 LOG(WARNING) << "Clean up transaction for non-locally managed user found :" |
| 272 << user_id << ", will not remove data"; | 273 << user_id << ", will not remove data"; |
| 273 prefs->ClearPref(kLocallyManagedUserCreationTransactionDisplayName); | 274 prefs->ClearPref(kLocallyManagedUserCreationTransactionDisplayName); |
| 274 prefs->ClearPref(kLocallyManagedUserCreationTransactionUserId); | 275 prefs->ClearPref(kLocallyManagedUserCreationTransactionUserId); |
| 276 prefs->CommitPendingWrite(); | |
| 275 return; | 277 return; |
| 276 } | 278 } |
| 277 | 279 owner_->RemoveNonOwnerUserInternal(user_id, NULL); |
|
Nikita (slow)
2013/11/13 01:37:19
What was the issue with using just RemoveUser?
Denis Kuznetsov (DE-MUC)
2013/11/14 01:18:17
Yes, it tried to get a User* at some point, and as
| |
| 278 owner_->RemoveUser(user_id, NULL); | |
| 279 | 280 |
| 280 prefs->ClearPref(kLocallyManagedUserCreationTransactionDisplayName); | 281 prefs->ClearPref(kLocallyManagedUserCreationTransactionDisplayName); |
| 281 prefs->ClearPref(kLocallyManagedUserCreationTransactionUserId); | 282 prefs->ClearPref(kLocallyManagedUserCreationTransactionUserId); |
| 282 prefs->CommitPendingWrite(); | 283 prefs->CommitPendingWrite(); |
| 283 } | 284 } |
| 284 | 285 |
| 285 void SupervisedUserManagerImpl::RemoveNonCryptohomeData( | 286 void SupervisedUserManagerImpl::RemoveNonCryptohomeData( |
| 286 const std::string& user_id) { | 287 const std::string& user_id) { |
| 287 PrefService* prefs = g_browser_process->local_state(); | 288 PrefService* prefs = g_browser_process->local_state(); |
| 288 ListPrefUpdate prefs_new_users_update(prefs, kLocallyManagedUsersFirstRun); | 289 ListPrefUpdate prefs_new_users_update(prefs, kLocallyManagedUsersFirstRun); |
| 289 prefs_new_users_update->Remove(base::StringValue(user_id), NULL); | 290 prefs_new_users_update->Remove(base::StringValue(user_id), NULL); |
| 290 | 291 |
| 292 DictionaryPrefUpdate synd_id_update(prefs, kManagedUserSyncId); | |
| 293 synd_id_update->RemoveWithoutPathExpansion(user_id, NULL); | |
| 294 | |
| 291 DictionaryPrefUpdate managers_update(prefs, kManagedUserManagers); | 295 DictionaryPrefUpdate managers_update(prefs, kManagedUserManagers); |
| 292 managers_update->RemoveWithoutPathExpansion(user_id, NULL); | 296 managers_update->RemoveWithoutPathExpansion(user_id, NULL); |
| 293 | 297 |
| 294 DictionaryPrefUpdate manager_names_update(prefs, | 298 DictionaryPrefUpdate manager_names_update(prefs, |
| 295 kManagedUserManagerNames); | 299 kManagedUserManagerNames); |
| 296 manager_names_update->RemoveWithoutPathExpansion(user_id, NULL); | 300 manager_names_update->RemoveWithoutPathExpansion(user_id, NULL); |
| 297 | 301 |
| 298 DictionaryPrefUpdate manager_emails_update(prefs, | 302 DictionaryPrefUpdate manager_emails_update(prefs, |
| 299 kManagedUserManagerDisplayEmails); | 303 kManagedUserManagerDisplayEmails); |
| 300 manager_emails_update->RemoveWithoutPathExpansion(user_id, NULL); | 304 manager_emails_update->RemoveWithoutPathExpansion(user_id, NULL); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 323 if (user_id == manager_id) { | 327 if (user_id == manager_id) { |
| 324 manager_name_update->SetWithoutPathExpansion( | 328 manager_name_update->SetWithoutPathExpansion( |
| 325 it.key(), | 329 it.key(), |
| 326 new base::StringValue(new_display_name)); | 330 new base::StringValue(new_display_name)); |
| 327 } | 331 } |
| 328 } | 332 } |
| 329 } | 333 } |
| 330 | 334 |
| 331 | 335 |
| 332 } // namespace chromeos | 336 } // namespace chromeos |
| OLD | NEW |