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

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

Issue 11499012: Add policy for limiting the session length (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 bool UserManagerImpl::IsLoggedInAsStub() const { 575 bool UserManagerImpl::IsLoggedInAsStub() const {
576 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 576 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
577 return IsUserLoggedIn() && logged_in_user_->email() == kStubUser; 577 return IsUserLoggedIn() && logged_in_user_->email() == kStubUser;
578 } 578 }
579 579
580 bool UserManagerImpl::IsSessionStarted() const { 580 bool UserManagerImpl::IsSessionStarted() const {
581 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 581 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
582 return session_started_; 582 return session_started_;
583 } 583 }
584 584
585 bool UserManagerImpl::HasBrowserRestarted() const {
586 CommandLine* command_line = CommandLine::ForCurrentProcess();
587 return command_line->HasSwitch(switches::kLoginManager) &&
588 !command_line->HasSwitch(switches::kLoginPassword);
589 }
590
585 bool UserManagerImpl::IsUserNonCryptohomeDataEphemeral( 591 bool UserManagerImpl::IsUserNonCryptohomeDataEphemeral(
586 const std::string& email) const { 592 const std::string& email) const {
587 // Data belonging to the guest, retail mode and stub users is always 593 // Data belonging to the guest, retail mode and stub users is always
588 // ephemeral. 594 // ephemeral.
589 if (email == kGuestUserEMail || email == kRetailModeUserEMail || 595 if (email == kGuestUserEMail || email == kRetailModeUserEMail ||
590 email == kStubUser) { 596 email == kStubUser) {
591 return true; 597 return true;
592 } 598 }
593 599
594 // Data belonging to the owner, anyone found on the user list and obsolete 600 // Data belonging to the owner, anyone found on the user list and obsolete
(...skipping 12 matching lines...) Expand all
607 if (IsUserLoggedIn() && (email == GetLoggedInUser()->email()) && 613 if (IsUserLoggedIn() && (email == GetLoggedInUser()->email()) &&
608 (is_current_user_ephemeral_regular_user_ || !IsLoggedInAsRegularUser())) { 614 (is_current_user_ephemeral_regular_user_ || !IsLoggedInAsRegularUser())) {
609 return true; 615 return true;
610 } 616 }
611 617
612 // Data belonging to any other user is ephemeral when: 618 // Data belonging to any other user is ephemeral when:
613 // a) Going through the regular login flow and the ephemeral users policy is 619 // a) Going through the regular login flow and the ephemeral users policy is
614 // enabled. 620 // enabled.
615 // - or - 621 // - or -
616 // b) The browser is restarting after a crash. 622 // b) The browser is restarting after a crash.
617 return AreEphemeralUsersEnabled() || 623 return AreEphemeralUsersEnabled() || HasBrowserRestarted();
618 (base::chromeos::IsRunningOnChromeOS() &&
619 !CommandLine::ForCurrentProcess()->
620 HasSwitch(switches::kLoginManager));
621 } 624 }
622 625
623 void UserManagerImpl::AddObserver(UserManager::Observer* obs) { 626 void UserManagerImpl::AddObserver(UserManager::Observer* obs) {
624 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 627 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
625 observer_list_.AddObserver(obs); 628 observer_list_.AddObserver(obs);
626 } 629 }
627 630
628 void UserManagerImpl::RemoveObserver(UserManager::Observer* obs) { 631 void UserManagerImpl::RemoveObserver(UserManager::Observer* obs) {
629 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 632 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
630 observer_list_.RemoveObserver(obs); 633 observer_list_.RemoveObserver(obs);
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 users_.insert(users_.begin(), User::CreatePublicAccountUser(*it)); 908 users_.insert(users_.begin(), User::CreatePublicAccountUser(*it));
906 } 909 }
907 910
908 user_image_manager_->LoadUserImages( 911 user_image_manager_->LoadUserImages(
909 UserList(users_.begin(), users_.begin() + new_public_accounts.size())); 912 UserList(users_.begin(), users_.begin() + new_public_accounts.size()));
910 913
911 return true; 914 return true;
912 } 915 }
913 916
914 } // namespace chromeos 917 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698