| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 // A vector pref of the users who have logged into the device. | 62 // A vector pref of the users who have logged into the device. |
| 63 const char kLoggedInUsers[] = "LoggedInUsers"; | 63 const char kLoggedInUsers[] = "LoggedInUsers"; |
| 64 // A dictionary that maps usernames to file paths to their images. | 64 // A dictionary that maps usernames to file paths to their images. |
| 65 const char kUserImages[] = "UserImages"; | 65 const char kUserImages[] = "UserImages"; |
| 66 // A dictionary that maps usernames to the displayed (non-canonical) emails. | 66 // A dictionary that maps usernames to the displayed (non-canonical) emails. |
| 67 const char kUserDisplayEmail[] = "UserDisplayEmail"; | 67 const char kUserDisplayEmail[] = "UserDisplayEmail"; |
| 68 // A dictionary that maps usernames to OAuth token presence flag. | 68 // A dictionary that maps usernames to OAuth token presence flag. |
| 69 const char kUserOAuthTokenStatus[] = "OAuthTokenStatus"; | 69 const char kUserOAuthTokenStatus[] = "OAuthTokenStatus"; |
| 70 | 70 |
| 71 // Incognito user is represented by an empty string (since some code already | |
| 72 // depends on that and it's hard to figure out what). | |
| 73 const char kGuestUser[] = ""; | |
| 74 | |
| 75 // Stub user email (for test paths). | 71 // Stub user email (for test paths). |
| 76 const char kStubUser[] = "stub-user@example.com"; | 72 const char kStubUser[] = "stub-user@example.com"; |
| 77 | 73 |
| 78 // Names of nodes with info about user image. | 74 // Names of nodes with info about user image. |
| 79 const char kImagePathNodeName[] = "path"; | 75 const char kImagePathNodeName[] = "path"; |
| 80 const char kImageIndexNodeName[] = "index"; | 76 const char kImageIndexNodeName[] = "index"; |
| 81 | 77 |
| 82 // Index of the default image used for the |kStubUser| user. | 78 // Index of the default image used for the |kStubUser| user. |
| 83 const int kStubDefaultImageIndex = 0; | 79 const int kStubDefaultImageIndex = 0; |
| 84 | 80 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 CrosLibrary::Get()->GetCryptohomeLibrary()->Pkcs11GetTpmTokenInfo( | 239 CrosLibrary::Get()->GetCryptohomeLibrary()->Pkcs11GetTpmTokenInfo( |
| 244 &local_token_name, &local_user_pin); | 240 &local_token_name, &local_user_pin); |
| 245 if (token_name) | 241 if (token_name) |
| 246 *token_name = local_token_name; | 242 *token_name = local_token_name; |
| 247 if (user_pin) | 243 if (user_pin) |
| 248 *user_pin = local_user_pin; | 244 *user_pin = local_user_pin; |
| 249 } | 245 } |
| 250 | 246 |
| 251 } // namespace | 247 } // namespace |
| 252 | 248 |
| 249 // Incognito user is represented by an empty string (since some code already |
| 250 // depends on that and it's hard to figure out what). |
| 251 const char UserManager::kGuestUser[] = ""; |
| 252 |
| 253 // static | 253 // static |
| 254 UserManager* UserManager::Get() { | 254 UserManager* UserManager::Get() { |
| 255 // Not thread-safe. | 255 // Not thread-safe. |
| 256 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 256 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 257 return &g_user_manager.Get(); | 257 return &g_user_manager.Get(); |
| 258 } | 258 } |
| 259 | 259 |
| 260 // static | 260 // static |
| 261 void UserManager::RegisterPrefs(PrefService* local_state) { | 261 void UserManager::RegisterPrefs(PrefService* local_state) { |
| 262 local_state->RegisterListPref(kLoggedInUsers, PrefService::UNSYNCABLE_PREF); | 262 local_state->RegisterListPref(kLoggedInUsers, PrefService::UNSYNCABLE_PREF); |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 | 981 |
| 982 User* UserManager::CreateUser(const std::string& email) const { | 982 User* UserManager::CreateUser(const std::string& email) const { |
| 983 User* user = new User(email); | 983 User* user = new User(email); |
| 984 user->set_oauth_token_status(LoadUserOAuthStatus(email)); | 984 user->set_oauth_token_status(LoadUserOAuthStatus(email)); |
| 985 // Used to determine whether user's display name is unique. | 985 // Used to determine whether user's display name is unique. |
| 986 ++display_name_count_[user->GetDisplayName()]; | 986 ++display_name_count_[user->GetDisplayName()]; |
| 987 return user; | 987 return user; |
| 988 } | 988 } |
| 989 | 989 |
| 990 } // namespace chromeos | 990 } // namespace chromeos |
| OLD | NEW |