Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: chrome/browser/chromeos/login/user_manager_impl.cc

Issue 12335051: Merge 182894 - 3rd attempt (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <cstddef> 7 #include <cstddef>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 UserManagerImpl::UserManagerImpl() 165 UserManagerImpl::UserManagerImpl()
166 : cros_settings_(CrosSettings::Get()), 166 : cros_settings_(CrosSettings::Get()),
167 device_local_account_policy_service_(NULL), 167 device_local_account_policy_service_(NULL),
168 users_loaded_(false), 168 users_loaded_(false),
169 logged_in_user_(NULL), 169 logged_in_user_(NULL),
170 session_started_(false), 170 session_started_(false),
171 is_current_user_owner_(false), 171 is_current_user_owner_(false),
172 is_current_user_new_(false), 172 is_current_user_new_(false),
173 is_current_user_ephemeral_regular_user_(false), 173 is_current_user_ephemeral_regular_user_(false),
174 ephemeral_users_enabled_(false), 174 ephemeral_users_enabled_(false),
175 merge_session_state_(MERGE_STATUS_NOT_STARTED),
175 observed_sync_service_(NULL), 176 observed_sync_service_(NULL),
176 user_image_manager_(new UserImageManagerImpl) { 177 user_image_manager_(new UserImageManagerImpl) {
177 // UserManager instance should be used only on UI thread. 178 // UserManager instance should be used only on UI thread.
178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
179 registrar_.Add(this, chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED, 180 registrar_.Add(this, chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED,
180 content::NotificationService::AllSources()); 181 content::NotificationService::AllSources());
181 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED, 182 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED,
182 content::NotificationService::AllSources()); 183 content::NotificationService::AllSources());
183 RetrieveTrustedDevicePolicies(); 184 RetrieveTrustedDevicePolicies();
184 } 185 }
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 bool UserManagerImpl::IsLoggedInAsStub() const { 605 bool UserManagerImpl::IsLoggedInAsStub() const {
605 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 606 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
606 return IsUserLoggedIn() && logged_in_user_->email() == kStubUser; 607 return IsUserLoggedIn() && logged_in_user_->email() == kStubUser;
607 } 608 }
608 609
609 bool UserManagerImpl::IsSessionStarted() const { 610 bool UserManagerImpl::IsSessionStarted() const {
610 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 611 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
611 return session_started_; 612 return session_started_;
612 } 613 }
613 614
615 UserManager::MergeSessionState UserManagerImpl::GetMergeSessionState() const {
616 return merge_session_state_;
617 }
618
619 void UserManagerImpl::SetMergeSessionState(
620 UserManager::MergeSessionState state) {
621 if (merge_session_state_ == state)
622 return;
623
624 merge_session_state_ = state;
625 NotifyMergeSessionStateChanged();
626 }
627
614 bool UserManagerImpl::HasBrowserRestarted() const { 628 bool UserManagerImpl::HasBrowserRestarted() const {
615 CommandLine* command_line = CommandLine::ForCurrentProcess(); 629 CommandLine* command_line = CommandLine::ForCurrentProcess();
616 return base::chromeos::IsRunningOnChromeOS() && 630 return base::chromeos::IsRunningOnChromeOS() &&
617 command_line->HasSwitch(switches::kLoginUser) && 631 command_line->HasSwitch(switches::kLoginUser) &&
618 !command_line->HasSwitch(switches::kLoginPassword); 632 !command_line->HasSwitch(switches::kLoginPassword);
619 } 633 }
620 634
621 bool UserManagerImpl::IsUserNonCryptohomeDataEphemeral( 635 bool UserManagerImpl::IsUserNonCryptohomeDataEphemeral(
622 const std::string& email) const { 636 const std::string& email) const {
623 // Data belonging to the guest, retail mode and stub users is always 637 // Data belonging to the guest, retail mode and stub users is always
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 SaveUserDisplayName(username, UTF8ToUTF16(display_name)); 971 SaveUserDisplayName(username, UTF8ToUTF16(display_name));
958 } 972 }
959 973
960 void UserManagerImpl::NotifyUserListChanged() { 974 void UserManagerImpl::NotifyUserListChanged() {
961 content::NotificationService::current()->Notify( 975 content::NotificationService::current()->Notify(
962 chrome::NOTIFICATION_USER_LIST_CHANGED, 976 chrome::NOTIFICATION_USER_LIST_CHANGED,
963 content::Source<UserManager>(this), 977 content::Source<UserManager>(this),
964 content::NotificationService::NoDetails()); 978 content::NotificationService::NoDetails());
965 } 979 }
966 980
981 void UserManagerImpl::NotifyMergeSessionStateChanged() {
982 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
983 FOR_EACH_OBSERVER(UserManager::Observer, observer_list_,
984 MergeSessionStateChanged(merge_session_state_));
985 }
986
967 } // namespace chromeos 987 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698