OLD | NEW |
1 // Copyright (c) 2011 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.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" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 void UserManager::NotifyLocalStateChanged() { | 589 void UserManager::NotifyLocalStateChanged() { |
590 FOR_EACH_OBSERVER( | 590 FOR_EACH_OBSERVER( |
591 Observer, | 591 Observer, |
592 observer_list_, | 592 observer_list_, |
593 LocalStateChanged(this)); | 593 LocalStateChanged(this)); |
594 } | 594 } |
595 | 595 |
596 // Protected constructor and destructor. | 596 // Protected constructor and destructor. |
597 UserManager::UserManager() | 597 UserManager::UserManager() |
598 : ALLOW_THIS_IN_INITIALIZER_LIST(image_loader_(new UserImageLoader)), | 598 : ALLOW_THIS_IN_INITIALIZER_LIST(image_loader_(new UserImageLoader)), |
599 guest_user_(kGuestUser), | 599 guest_user_(kGuestUser, true), |
600 stub_user_(kStubUser), | 600 stub_user_(kStubUser, false), |
601 logged_in_user_(NULL), | 601 logged_in_user_(NULL), |
602 current_user_is_owner_(false), | 602 current_user_is_owner_(false), |
603 current_user_is_new_(false), | 603 current_user_is_new_(false), |
604 user_is_logged_in_(false), | 604 user_is_logged_in_(false), |
605 last_image_set_async_(false), | 605 last_image_set_async_(false), |
606 downloaded_profile_image_data_url_(chrome::kAboutBlankURL) { | 606 downloaded_profile_image_data_url_(chrome::kAboutBlankURL) { |
607 // Use stub as the logged-in user for test paths without login. | 607 // Use stub as the logged-in user for test paths without login. |
608 if (!system::runtime_environment::IsRunningOnChromeOS()) | 608 if (!system::runtime_environment::IsRunningOnChromeOS()) |
609 StubUserLoggedIn(); | 609 StubUserLoggedIn(); |
610 registrar_.Add(this, chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, | 610 registrar_.Add(this, chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 content::Details<const SkBitmap>(&downloaded_profile_image_)); | 973 content::Details<const SkBitmap>(&downloaded_profile_image_)); |
974 } else { | 974 } else { |
975 content::NotificationService::current()->Notify( | 975 content::NotificationService::current()->Notify( |
976 chrome::NOTIFICATION_PROFILE_IMAGE_UPDATE_FAILED, | 976 chrome::NOTIFICATION_PROFILE_IMAGE_UPDATE_FAILED, |
977 content::Source<UserManager>(this), | 977 content::Source<UserManager>(this), |
978 content::NotificationService::NoDetails()); | 978 content::NotificationService::NoDetails()); |
979 } | 979 } |
980 } | 980 } |
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, email == kGuestUser); |
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 |