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

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

Issue 23678007: OAuth2LoginManager+MergeSessionThrottle hardening, multi-profle support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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) 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 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 : cros_settings_(CrosSettings::Get()), 216 : cros_settings_(CrosSettings::Get()),
217 device_local_account_policy_service_(NULL), 217 device_local_account_policy_service_(NULL),
218 users_loaded_(false), 218 users_loaded_(false),
219 active_user_(NULL), 219 active_user_(NULL),
220 session_started_(false), 220 session_started_(false),
221 user_sessions_restored_(false), 221 user_sessions_restored_(false),
222 is_current_user_owner_(false), 222 is_current_user_owner_(false),
223 is_current_user_new_(false), 223 is_current_user_new_(false),
224 is_current_user_ephemeral_regular_user_(false), 224 is_current_user_ephemeral_regular_user_(false),
225 ephemeral_users_enabled_(false), 225 ephemeral_users_enabled_(false),
226 merge_session_state_(MERGE_STATUS_NOT_STARTED),
227 observed_sync_service_(NULL), 226 observed_sync_service_(NULL),
228 user_image_manager_(new UserImageManagerImpl), 227 user_image_manager_(new UserImageManagerImpl),
229 manager_creation_time_(base::TimeTicks::Now()) { 228 manager_creation_time_(base::TimeTicks::Now()) {
230 // UserManager instance should be used only on UI thread. 229 // UserManager instance should be used only on UI thread.
231 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
232 registrar_.Add(this, chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED, 231 registrar_.Add(this, chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED,
233 content::NotificationService::AllSources()); 232 content::NotificationService::AllSources());
234 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 233 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
235 content::NotificationService::AllSources()); 234 content::NotificationService::AllSources());
236 RetrieveTrustedDevicePolicies(); 235 RetrieveTrustedDevicePolicies();
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 bool UserManagerImpl::IsSessionStarted() const { 902 bool UserManagerImpl::IsSessionStarted() const {
904 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 903 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
905 return session_started_; 904 return session_started_;
906 } 905 }
907 906
908 bool UserManagerImpl::UserSessionsRestored() const { 907 bool UserManagerImpl::UserSessionsRestored() const {
909 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 908 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
910 return user_sessions_restored_; 909 return user_sessions_restored_;
911 } 910 }
912 911
913 UserManager::MergeSessionState UserManagerImpl::GetMergeSessionState() const {
914 return merge_session_state_;
915 }
916
917 void UserManagerImpl::SetMergeSessionState(
918 UserManager::MergeSessionState state) {
919 if (merge_session_state_ == state)
920 return;
921
922 merge_session_state_ = state;
923 NotifyMergeSessionStateChanged();
924 }
925
926 bool UserManagerImpl::HasBrowserRestarted() const { 912 bool UserManagerImpl::HasBrowserRestarted() const {
927 CommandLine* command_line = CommandLine::ForCurrentProcess(); 913 CommandLine* command_line = CommandLine::ForCurrentProcess();
928 return base::chromeos::IsRunningOnChromeOS() && 914 return base::chromeos::IsRunningOnChromeOS() &&
929 command_line->HasSwitch(switches::kLoginUser) && 915 command_line->HasSwitch(switches::kLoginUser) &&
930 !command_line->HasSwitch(switches::kLoginPassword); 916 !command_line->HasSwitch(switches::kLoginPassword);
931 } 917 }
932 918
933 bool UserManagerImpl::IsUserNonCryptohomeDataEphemeral( 919 bool UserManagerImpl::IsUserNonCryptohomeDataEphemeral(
934 const std::string& email) const { 920 const std::string& email) const {
935 // Data belonging to the guest, retail mode and stub users is always 921 // Data belonging to the guest, retail mode and stub users is always
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 return default_flow_.get(); 1647 return default_flow_.get();
1662 } 1648 }
1663 1649
1664 void UserManagerImpl::NotifyUserListChanged() { 1650 void UserManagerImpl::NotifyUserListChanged() {
1665 content::NotificationService::current()->Notify( 1651 content::NotificationService::current()->Notify(
1666 chrome::NOTIFICATION_USER_LIST_CHANGED, 1652 chrome::NOTIFICATION_USER_LIST_CHANGED,
1667 content::Source<UserManager>(this), 1653 content::Source<UserManager>(this),
1668 content::NotificationService::NoDetails()); 1654 content::NotificationService::NoDetails());
1669 } 1655 }
1670 1656
1671 void UserManagerImpl::NotifyMergeSessionStateChanged() {
1672 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1673 FOR_EACH_OBSERVER(UserManager::Observer, observer_list_,
1674 MergeSessionStateChanged(merge_session_state_));
1675 }
1676
1677 void UserManagerImpl::NotifyActiveUserChanged(const User* active_user) { 1657 void UserManagerImpl::NotifyActiveUserChanged(const User* active_user) {
1678 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1658 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1679 FOR_EACH_OBSERVER(UserManager::UserSessionStateObserver, 1659 FOR_EACH_OBSERVER(UserManager::UserSessionStateObserver,
1680 session_state_observer_list_, 1660 session_state_observer_list_,
1681 ActiveUserChanged(active_user)); 1661 ActiveUserChanged(active_user));
1682 } 1662 }
1683 1663
1684 void UserManagerImpl::NotifyActiveUserHashChanged(const std::string& hash) { 1664 void UserManagerImpl::NotifyActiveUserHashChanged(const std::string& hash) {
1685 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1665 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1686 FOR_EACH_OBSERVER(UserManager::UserSessionStateObserver, 1666 FOR_EACH_OBSERVER(UserManager::UserSessionStateObserver,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 base::TimeTicks::Now() - manager_creation_time_; 1793 base::TimeTicks::Now() - manager_creation_time_;
1814 if (!last_email.empty() && email != last_email && 1794 if (!last_email.empty() && email != last_email &&
1815 time_to_login.InSeconds() <= kLogoutToLoginDelayMaxSec) { 1795 time_to_login.InSeconds() <= kLogoutToLoginDelayMaxSec) {
1816 UMA_HISTOGRAM_CUSTOM_COUNTS("UserManager.LogoutToLoginDelay", 1796 UMA_HISTOGRAM_CUSTOM_COUNTS("UserManager.LogoutToLoginDelay",
1817 time_to_login.InSeconds(), 0, kLogoutToLoginDelayMaxSec, 50); 1797 time_to_login.InSeconds(), 0, kLogoutToLoginDelayMaxSec, 50);
1818 } 1798 }
1819 } 1799 }
1820 } 1800 }
1821 1801
1822 } // namespace chromeos 1802 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager_impl.h ('k') | chrome/browser/chromeos/profiles/profile_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698