OLD | NEW |
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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 | 790 |
791 bool UserManagerImpl::IsEphemeralUser(const std::string& email) const { | 791 bool UserManagerImpl::IsEphemeralUser(const std::string& email) const { |
792 // The guest user always is ephemeral. | 792 // The guest user always is ephemeral. |
793 if (email == kGuestUser) | 793 if (email == kGuestUser) |
794 return true; | 794 return true; |
795 | 795 |
796 // The currently logged-in user is ephemeral iff logged in as ephemeral. | 796 // The currently logged-in user is ephemeral iff logged in as ephemeral. |
797 if (logged_in_user_ && (email == logged_in_user_->email())) | 797 if (logged_in_user_ && (email == logged_in_user_->email())) |
798 return is_current_user_ephemeral_; | 798 return is_current_user_ephemeral_; |
799 | 799 |
800 // The owner and any users found in the persistent list are never ephemeral. | 800 // Any other user is ephemeral iff ephemeral users are enabled, the user is |
801 if (email == owner_email_ || FindUserInList(email)) | 801 // not the owner and is not in the persistent list. |
802 return false; | 802 return AreEphemeralUsersEnabled() && |
803 | 803 (email != owner_email_) && |
804 // Any other user is ephemeral when: | 804 !FindUserInList(email); |
805 // a) Going through the regular login flow and ephemeral users are enabled. | |
806 // - or - | |
807 // b) The browser is restarting after a crash. | |
808 return AreEphemeralUsersEnabled() || | |
809 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager); | |
810 } | 805 } |
811 | 806 |
812 const User* UserManagerImpl::FindUserInList(const std::string& email) const { | 807 const User* UserManagerImpl::FindUserInList(const std::string& email) const { |
813 const UserList& users = GetUsers(); | 808 const UserList& users = GetUsers(); |
814 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { | 809 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
815 if ((*it)->email() == email) | 810 if ((*it)->email() == email) |
816 return *it; | 811 return *it; |
817 } | 812 } |
818 return NULL; | 813 return NULL; |
819 } | 814 } |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 BrowserThread::PostTask( | 1246 BrowserThread::PostTask( |
1252 BrowserThread::FILE, | 1247 BrowserThread::FILE, |
1253 FROM_HERE, | 1248 FROM_HERE, |
1254 base::Bind(&UserManagerImpl::DeleteUserImage, | 1249 base::Bind(&UserManagerImpl::DeleteUserImage, |
1255 base::Unretained(this), | 1250 base::Unretained(this), |
1256 image_path)); | 1251 image_path)); |
1257 } | 1252 } |
1258 } | 1253 } |
1259 | 1254 |
1260 } // namespace chromeos | 1255 } // namespace chromeos |
OLD | NEW |