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

Side by Side Diff: chrome/browser/chromeos/login/user_manager_impl.cc

Issue 10382086: Determine whether user is ephemeral when coming back from a crash (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/user_manager_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 881
882 bool UserManagerImpl::IsEphemeralUser(const std::string& email) const { 882 bool UserManagerImpl::IsEphemeralUser(const std::string& email) const {
883 // The guest user always is ephemeral. 883 // The guest user always is ephemeral.
884 if (email == kGuestUser) 884 if (email == kGuestUser)
885 return true; 885 return true;
886 886
887 // The currently logged-in user is ephemeral iff logged in as ephemeral. 887 // The currently logged-in user is ephemeral iff logged in as ephemeral.
888 if (logged_in_user_ && (email == logged_in_user_->email())) 888 if (logged_in_user_ && (email == logged_in_user_->email()))
889 return is_current_user_ephemeral_; 889 return is_current_user_ephemeral_;
890 890
891 // If the browser is coming back after a crash in the middle of a session, the
892 // user's cryptohome will already be mounted. When this is the case, the user
893 // is ephemeral iff the cryptohome was mounted as ephemeral.
894 bool is_mounted;
895 bool is_ephemeral_mount;
896 if (DBusThreadManager::Get()->GetCryptohomeClient()->
Nikita (slow) 2012/05/10 09:10:12 That doesn't seem like a correct solution i.e. alw
Nikita (slow) 2012/05/10 09:19:56 When Chrome is restarted after crash, UserManager:
bartfab (slow) 2012/05/10 09:21:44 Thanks. I was looking through the code just now to
897 IsMountedForUser(email, &is_mounted, &is_ephemeral_mount)) {
898 if (is_mounted)
899 return is_ephemeral_mount;
900 }
901
891 // Any other user is ephemeral iff ephemeral users are enabled, the user is 902 // Any other user is ephemeral iff ephemeral users are enabled, the user is
892 // not the owner and is not in the persistent list. 903 // not the owner and is not in the persistent list.
893 return AreEphemeralUsersEnabled() && 904 return AreEphemeralUsersEnabled() &&
894 (email != owner_email_) && 905 (email != owner_email_) &&
895 !FindUserInList(email); 906 !FindUserInList(email);
896 } 907 }
897 908
898 const User* UserManagerImpl::FindUserInList(const std::string& email) const { 909 const User* UserManagerImpl::FindUserInList(const std::string& email) const {
899 const UserList& users = GetUsers(); 910 const UserList& users = GetUsers();
900 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { 911 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) {
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 BrowserThread::PostTask( 1319 BrowserThread::PostTask(
1309 BrowserThread::FILE, 1320 BrowserThread::FILE,
1310 FROM_HERE, 1321 FROM_HERE,
1311 base::Bind(&UserManagerImpl::DeleteUserImage, 1322 base::Bind(&UserManagerImpl::DeleteUserImage,
1312 base::Unretained(this), 1323 base::Unretained(this),
1313 image_path)); 1324 image_path));
1314 } 1325 }
1315 } 1326 }
1316 1327
1317 } // namespace chromeos 1328 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698