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

Side by Side Diff: components/user_manager/user_manager_base.cc

Issue 1470633002: ChromeOS: Fix removeUser button on signin screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@462823--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Fix-GetKnownUserAccountId
Patch Set: Rebased. Created 5 years 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
« no previous file with comments | « components/user_manager/remove_user_delegate.h ('k') | 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 "components/user_manager/user_manager_base.h" 5 #include "components/user_manager/user_manager_base.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 const char kGAPSCookie[] = "gaps_cookie"; 92 const char kGAPSCookie[] = "gaps_cookie";
93 93
94 // Key of the reason for re-auth. 94 // Key of the reason for re-auth.
95 const char kReauthReasonKey[] = "reauth_reason"; 95 const char kReauthReasonKey[] = "reauth_reason";
96 96
97 // Upper bound for a histogram metric reporting the amount of time between 97 // Upper bound for a histogram metric reporting the amount of time between
98 // one regular user logging out and a different regular user logging in. 98 // one regular user logging out and a different regular user logging in.
99 const int kLogoutToLoginDelayMaxSec = 1800; 99 const int kLogoutToLoginDelayMaxSec = 1800;
100 100
101 // Callback that is called after user removal is complete. 101 // Callback that is called after user removal is complete.
102 void OnRemoveUserComplete(const std::string& user_email, 102 void OnRemoveUserComplete(const AccountId& account_id,
103 bool success, 103 bool success,
104 cryptohome::MountError return_code) { 104 cryptohome::MountError return_code) {
105 // Log the error, but there's not much we can do. 105 // Log the error, but there's not much we can do.
106 if (!success) { 106 if (!success) {
107 LOG(ERROR) << "Removal of cryptohome for " << user_email 107 LOG(ERROR) << "Removal of cryptohome for " << account_id.Serialize()
108 << " failed, return code: " << return_code; 108 << " failed, return code: " << return_code;
109 } 109 }
110 } 110 }
111 111
112 // Runs on SequencedWorkerPool thread. Passes resolved locale to UI thread. 112 // Runs on SequencedWorkerPool thread. Passes resolved locale to UI thread.
113 void ResolveLocale(const std::string& raw_locale, 113 void ResolveLocale(const std::string& raw_locale,
114 std::string* resolved_locale) { 114 std::string* resolved_locale) {
115 ignore_result(l10n_util::CheckAndResolveLocale(raw_locale, resolved_locale)); 115 ignore_result(l10n_util::CheckAndResolveLocale(raw_locale, resolved_locale));
116 } 116 }
117 117
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 346 }
347 347
348 void UserManagerBase::RemoveUserInternal(const AccountId& account_id, 348 void UserManagerBase::RemoveUserInternal(const AccountId& account_id,
349 RemoveUserDelegate* delegate) { 349 RemoveUserDelegate* delegate) {
350 RemoveNonOwnerUserInternal(account_id, delegate); 350 RemoveNonOwnerUserInternal(account_id, delegate);
351 } 351 }
352 352
353 void UserManagerBase::RemoveNonOwnerUserInternal(const AccountId& account_id, 353 void UserManagerBase::RemoveNonOwnerUserInternal(const AccountId& account_id,
354 RemoveUserDelegate* delegate) { 354 RemoveUserDelegate* delegate) {
355 if (delegate) 355 if (delegate)
356 delegate->OnBeforeUserRemoved(account_id.GetUserEmail()); 356 delegate->OnBeforeUserRemoved(account_id);
357 RemoveUserFromList(account_id); 357 RemoveUserFromList(account_id);
358 cryptohome::AsyncMethodCaller::GetInstance()->AsyncRemove( 358 cryptohome::AsyncMethodCaller::GetInstance()->AsyncRemove(
359 account_id.GetUserEmail(), 359 account_id.GetUserEmail(), base::Bind(&OnRemoveUserComplete, account_id));
360 base::Bind(&OnRemoveUserComplete, account_id.GetUserEmail()));
361 360
362 if (delegate) 361 if (delegate)
363 delegate->OnUserRemoved(account_id.GetUserEmail()); 362 delegate->OnUserRemoved(account_id);
364 } 363 }
365 364
366 void UserManagerBase::RemoveUserFromList(const AccountId& account_id) { 365 void UserManagerBase::RemoveUserFromList(const AccountId& account_id) {
367 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 366 DCHECK(task_runner_->RunsTasksOnCurrentThread());
368 RemoveNonCryptohomeData(account_id); 367 RemoveNonCryptohomeData(account_id);
369 if (user_loading_stage_ == STAGE_LOADED) { 368 if (user_loading_stage_ == STAGE_LOADED) {
370 DeleteUser(RemoveRegularOrSupervisedUserFromList(account_id)); 369 DeleteUser(RemoveRegularOrSupervisedUserFromList(account_id));
371 } else if (user_loading_stage_ == STAGE_LOADING) { 370 } else if (user_loading_stage_ == STAGE_LOADING) {
372 DCHECK(gaia::ExtractDomainName(account_id.GetUserEmail()) == 371 DCHECK(gaia::ExtractDomainName(account_id.GetUserEmail()) ==
373 chromeos::login::kSupervisedUserDomain || 372 chromeos::login::kSupervisedUserDomain ||
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 } 1388 }
1390 1389
1391 void UserManagerBase::DeleteUser(User* user) { 1390 void UserManagerBase::DeleteUser(User* user) {
1392 const bool is_active_user = (user == active_user_); 1391 const bool is_active_user = (user == active_user_);
1393 delete user; 1392 delete user;
1394 if (is_active_user) 1393 if (is_active_user)
1395 active_user_ = nullptr; 1394 active_user_ = nullptr;
1396 } 1395 }
1397 1396
1398 } // namespace user_manager 1397 } // namespace user_manager
OLDNEW
« no previous file with comments | « components/user_manager/remove_user_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698