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 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 | 893 |
894 bool UserManagerImpl::IsEphemeralUser(const std::string& email) const { | 894 bool UserManagerImpl::IsEphemeralUser(const std::string& email) const { |
895 // The guest user always is ephemeral. | 895 // The guest user always is ephemeral. |
896 if (email == kGuestUser) | 896 if (email == kGuestUser) |
897 return true; | 897 return true; |
898 | 898 |
899 // The currently logged-in user is ephemeral iff logged in as ephemeral. | 899 // The currently logged-in user is ephemeral iff logged in as ephemeral. |
900 if (logged_in_user_ && (email == logged_in_user_->email())) | 900 if (logged_in_user_ && (email == logged_in_user_->email())) |
901 return is_current_user_ephemeral_; | 901 return is_current_user_ephemeral_; |
902 | 902 |
903 // Any other user is ephemeral iff ephemeral users are enabled, the user is | 903 // The owner and any users found in the persistent list are never ephemeral. |
904 // not the owner and is not in the persistent list. | 904 if (email == owner_email_ || FindUserInList(email)) |
905 return AreEphemeralUsersEnabled() && | 905 return false; |
906 (email != owner_email_) && | 906 |
907 !FindUserInList(email); | 907 // Any other user is ephemeral when: |
| 908 // a) Going through the regular login flow and ephemeral users are enabled. |
| 909 // - or - |
| 910 // b) The browser is restarting after a crash. |
| 911 return AreEphemeralUsersEnabled() || |
| 912 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager); |
908 } | 913 } |
909 | 914 |
910 const User* UserManagerImpl::FindUserInList(const std::string& email) const { | 915 const User* UserManagerImpl::FindUserInList(const std::string& email) const { |
911 const UserList& users = GetUsers(); | 916 const UserList& users = GetUsers(); |
912 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { | 917 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
913 if ((*it)->email() == email) | 918 if ((*it)->email() == email) |
914 return *it; | 919 return *it; |
915 } | 920 } |
916 return NULL; | 921 return NULL; |
917 } | 922 } |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 BrowserThread::PostTask( | 1381 BrowserThread::PostTask( |
1377 BrowserThread::FILE, | 1382 BrowserThread::FILE, |
1378 FROM_HERE, | 1383 FROM_HERE, |
1379 base::Bind(&UserManagerImpl::DeleteUserImage, | 1384 base::Bind(&UserManagerImpl::DeleteUserImage, |
1380 base::Unretained(this), | 1385 base::Unretained(this), |
1381 image_path)); | 1386 image_path)); |
1382 } | 1387 } |
1383 } | 1388 } |
1384 | 1389 |
1385 } // namespace chromeos | 1390 } // namespace chromeos |
OLD | NEW |