OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <cstddef> | 7 #include <cstddef> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 UserManagerImpl::UserManagerImpl() | 174 UserManagerImpl::UserManagerImpl() |
175 : cros_settings_(CrosSettings::Get()), | 175 : cros_settings_(CrosSettings::Get()), |
176 device_local_account_policy_service_(NULL), | 176 device_local_account_policy_service_(NULL), |
177 users_loaded_(false), | 177 users_loaded_(false), |
178 logged_in_user_(NULL), | 178 logged_in_user_(NULL), |
179 session_started_(false), | 179 session_started_(false), |
180 is_current_user_owner_(false), | 180 is_current_user_owner_(false), |
181 is_current_user_new_(false), | 181 is_current_user_new_(false), |
182 is_current_user_ephemeral_regular_user_(false), | 182 is_current_user_ephemeral_regular_user_(false), |
183 ephemeral_users_enabled_(false), | 183 ephemeral_users_enabled_(false), |
| 184 merge_session_state_(MERGE_STATUS_NOT_STARTED), |
184 observed_sync_service_(NULL), | 185 observed_sync_service_(NULL), |
185 user_image_manager_(new UserImageManagerImpl) { | 186 user_image_manager_(new UserImageManagerImpl) { |
186 // UserManager instance should be used only on UI thread. | 187 // UserManager instance should be used only on UI thread. |
187 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
188 registrar_.Add(this, chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED, | 189 registrar_.Add(this, chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED, |
189 content::NotificationService::AllSources()); | 190 content::NotificationService::AllSources()); |
190 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED, | 191 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED, |
191 content::NotificationService::AllSources()); | 192 content::NotificationService::AllSources()); |
192 RetrieveTrustedDevicePolicies(); | 193 RetrieveTrustedDevicePolicies(); |
193 } | 194 } |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 bool UserManagerImpl::IsLoggedInAsStub() const { | 719 bool UserManagerImpl::IsLoggedInAsStub() const { |
719 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 720 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
720 return IsUserLoggedIn() && logged_in_user_->email() == kStubUser; | 721 return IsUserLoggedIn() && logged_in_user_->email() == kStubUser; |
721 } | 722 } |
722 | 723 |
723 bool UserManagerImpl::IsSessionStarted() const { | 724 bool UserManagerImpl::IsSessionStarted() const { |
724 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 725 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
725 return session_started_; | 726 return session_started_; |
726 } | 727 } |
727 | 728 |
| 729 UserManager::MergeSessionState UserManagerImpl::GetMergeSessionState() const { |
| 730 return merge_session_state_; |
| 731 } |
| 732 |
| 733 void UserManagerImpl::SetMergeSessionState( |
| 734 UserManager::MergeSessionState state) { |
| 735 if (merge_session_state_ == state) |
| 736 return; |
| 737 |
| 738 merge_session_state_ = state; |
| 739 NotifyMergeSessionStateChanged(); |
| 740 } |
| 741 |
728 bool UserManagerImpl::HasBrowserRestarted() const { | 742 bool UserManagerImpl::HasBrowserRestarted() const { |
729 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 743 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
730 return base::chromeos::IsRunningOnChromeOS() && | 744 return base::chromeos::IsRunningOnChromeOS() && |
731 command_line->HasSwitch(switches::kLoginUser) && | 745 command_line->HasSwitch(switches::kLoginUser) && |
732 !command_line->HasSwitch(switches::kLoginPassword); | 746 !command_line->HasSwitch(switches::kLoginPassword); |
733 } | 747 } |
734 | 748 |
735 bool UserManagerImpl::IsUserNonCryptohomeDataEphemeral( | 749 bool UserManagerImpl::IsUserNonCryptohomeDataEphemeral( |
736 const std::string& email) const { | 750 const std::string& email) const { |
737 // Data belonging to the guest, retail mode and stub users is always | 751 // Data belonging to the guest, retail mode and stub users is always |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 SaveUserDisplayName(username, UTF8ToUTF16(display_name)); | 1094 SaveUserDisplayName(username, UTF8ToUTF16(display_name)); |
1081 } | 1095 } |
1082 | 1096 |
1083 void UserManagerImpl::NotifyUserListChanged() { | 1097 void UserManagerImpl::NotifyUserListChanged() { |
1084 content::NotificationService::current()->Notify( | 1098 content::NotificationService::current()->Notify( |
1085 chrome::NOTIFICATION_USER_LIST_CHANGED, | 1099 chrome::NOTIFICATION_USER_LIST_CHANGED, |
1086 content::Source<UserManager>(this), | 1100 content::Source<UserManager>(this), |
1087 content::NotificationService::NoDetails()); | 1101 content::NotificationService::NoDetails()); |
1088 } | 1102 } |
1089 | 1103 |
| 1104 void UserManagerImpl::NotifyMergeSessionStateChanged() { |
| 1105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1106 FOR_EACH_OBSERVER(UserManager::Observer, observer_list_, |
| 1107 MergeSessionStateChanged(merge_session_state_)); |
| 1108 } |
| 1109 |
1090 } // namespace chromeos | 1110 } // namespace chromeos |
OLD | NEW |