OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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.h" | 5 #include "chrome/browser/chromeos/login/user_manager.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 it < users.end(); | 207 it < users.end(); |
208 ++it) { | 208 ++it) { |
209 std::string user_email = it->email(); | 209 std::string user_email = it->email(); |
210 // Skip user that we would like to delete. | 210 // Skip user that we would like to delete. |
211 if (email != user_email) | 211 if (email != user_email) |
212 prefs_users->Append(Value::CreateStringValue(user_email)); | 212 prefs_users->Append(Value::CreateStringValue(user_email)); |
213 } | 213 } |
214 prefs->SavePersistentPrefs(); | 214 prefs->SavePersistentPrefs(); |
215 } | 215 } |
216 | 216 |
| 217 bool UserManager::IsKnownUser(const std::string& email) { |
| 218 std::vector<User> users = GetUsers(); |
| 219 for (std::vector<User>::iterator it = users.begin(); |
| 220 it < users.end(); |
| 221 ++it) { |
| 222 if (it->email() == email) |
| 223 return true; |
| 224 } |
| 225 |
| 226 return false; |
| 227 } |
| 228 |
217 void UserManager::SetLoggedInUserImage(const SkBitmap& image) { | 229 void UserManager::SetLoggedInUserImage(const SkBitmap& image) { |
218 if (logged_in_user_.email().empty()) | 230 if (logged_in_user_.email().empty()) |
219 return; | 231 return; |
220 logged_in_user_.set_image(image); | 232 logged_in_user_.set_image(image); |
221 OnImageLoaded(logged_in_user_.email(), image); | 233 OnImageLoaded(logged_in_user_.email(), image); |
222 } | 234 } |
223 | 235 |
224 void UserManager::SaveUserImage(const std::string& username, | 236 void UserManager::SaveUserImage(const std::string& username, |
225 const SkBitmap& image) { | 237 const SkBitmap& image) { |
226 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 238 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 void UserManager::Observe(NotificationType type, | 296 void UserManager::Observe(NotificationType type, |
285 const NotificationSource& source, | 297 const NotificationSource& source, |
286 const NotificationDetails& details) { | 298 const NotificationDetails& details) { |
287 if (type == NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) { | 299 if (type == NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) { |
288 ChromeThread::PostTask(ChromeThread::FILE, FROM_HERE, | 300 ChromeThread::PostTask(ChromeThread::FILE, FROM_HERE, |
289 NewRunnableFunction(&CheckOwnership)); | 301 NewRunnableFunction(&CheckOwnership)); |
290 } | 302 } |
291 } | 303 } |
292 | 304 |
293 } // namespace chromeos | 305 } // namespace chromeos |
OLD | NEW |