| 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 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1634 &locally_managed_users_allowed); | 1634 &locally_managed_users_allowed); |
| 1635 return ManagedUserService::AreManagedUsersEnabled() && | 1635 return ManagedUserService::AreManagedUsersEnabled() && |
| 1636 (locally_managed_users_allowed || | 1636 (locally_managed_users_allowed || |
| 1637 !g_browser_process->browser_policy_connector()->IsEnterpriseManaged()); | 1637 !g_browser_process->browser_policy_connector()->IsEnterpriseManaged()); |
| 1638 } | 1638 } |
| 1639 | 1639 |
| 1640 base::FilePath UserManagerImpl::GetUserProfileDir( | 1640 base::FilePath UserManagerImpl::GetUserProfileDir( |
| 1641 const std::string& email) const { | 1641 const std::string& email) const { |
| 1642 // TODO(dpolukhin): Remove Chrome OS specific profile path logic from | 1642 // TODO(dpolukhin): Remove Chrome OS specific profile path logic from |
| 1643 // ProfileManager and use only this function to construct profile path. | 1643 // ProfileManager and use only this function to construct profile path. |
| 1644 // TODO(nkostylev): Cleanup profile dir related code paths crbug.com/294233 |
| 1644 base::FilePath profile_dir; | 1645 base::FilePath profile_dir; |
| 1645 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1646 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 1646 if (command_line.HasSwitch(::switches::kMultiProfiles)) { | 1647 if (command_line.HasSwitch(::switches::kMultiProfiles)) { |
| 1647 const User* user = FindUser(email); | 1648 const User* user = FindUser(email); |
| 1648 if (user && !user->username_hash().empty()) { | 1649 if (user && !user->username_hash().empty()) { |
| 1649 profile_dir = base::FilePath( | 1650 profile_dir = base::FilePath( |
| 1650 chrome::kProfileDirPrefix + user->username_hash()); | 1651 chrome::kProfileDirPrefix + user->username_hash()); |
| 1651 } | 1652 } |
| 1652 } else if (command_line.HasSwitch(chromeos::switches::kLoginProfile)) { | 1653 } else if (command_line.HasSwitch(chromeos::switches::kLoginProfile)) { |
| 1653 profile_dir = command_line.GetSwitchValuePath( | 1654 std::string login_profile_value = |
| 1654 chromeos::switches::kLoginProfile); | 1655 command_line.GetSwitchValueASCII(chromeos::switches::kLoginProfile); |
| 1656 if (login_profile_value == chrome::kLegacyProfileDir || |
| 1657 login_profile_value == chrome::kTestUserProfileDir) { |
| 1658 profile_dir = base::FilePath(login_profile_value); |
| 1659 } else { |
| 1660 profile_dir = base::FilePath( |
| 1661 chrome::kProfileDirPrefix + login_profile_value); |
| 1662 } |
| 1655 } else { | 1663 } else { |
| 1656 // We should never be logged in with no profile dir unless | 1664 // We should never be logged in with no profile dir unless |
| 1657 // multi-profiles are enabled. | 1665 // multi-profiles are enabled. |
| 1658 NOTREACHED(); | 1666 NOTREACHED(); |
| 1659 profile_dir = base::FilePath(); | 1667 profile_dir = base::FilePath(); |
| 1660 } | 1668 } |
| 1661 | 1669 |
| 1662 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1670 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 1663 profile_dir = profile_manager->user_data_dir().Append(profile_dir); | 1671 profile_dir = profile_manager->user_data_dir().Append(profile_dir); |
| 1664 | 1672 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1818 base::TimeTicks::Now() - manager_creation_time_; | 1826 base::TimeTicks::Now() - manager_creation_time_; |
| 1819 if (!last_email.empty() && email != last_email && | 1827 if (!last_email.empty() && email != last_email && |
| 1820 time_to_login.InSeconds() <= kLogoutToLoginDelayMaxSec) { | 1828 time_to_login.InSeconds() <= kLogoutToLoginDelayMaxSec) { |
| 1821 UMA_HISTOGRAM_CUSTOM_COUNTS("UserManager.LogoutToLoginDelay", | 1829 UMA_HISTOGRAM_CUSTOM_COUNTS("UserManager.LogoutToLoginDelay", |
| 1822 time_to_login.InSeconds(), 0, kLogoutToLoginDelayMaxSec, 50); | 1830 time_to_login.InSeconds(), 0, kLogoutToLoginDelayMaxSec, 50); |
| 1823 } | 1831 } |
| 1824 } | 1832 } |
| 1825 } | 1833 } |
| 1826 | 1834 |
| 1827 } // namespace chromeos | 1835 } // namespace chromeos |
| OLD | NEW |