| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/users/user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/users/user_manager_impl.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "ash/multi_profile_uma.h" | 10 #include "ash/multi_profile_uma.h" |
| 11 #include "base/base_paths.h" | |
| 12 #include "base/bind.h" | 11 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 14 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 15 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 16 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 17 #include "base/format_macros.h" | 16 #include "base/format_macros.h" |
| 18 #include "base/logging.h" | 17 #include "base/logging.h" |
| 19 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 20 #include "base/path_service.h" | |
| 21 #include "base/prefs/pref_registry_simple.h" | 19 #include "base/prefs/pref_registry_simple.h" |
| 22 #include "base/prefs/pref_service.h" | 20 #include "base/prefs/pref_service.h" |
| 23 #include "base/prefs/scoped_user_pref_update.h" | 21 #include "base/prefs/scoped_user_pref_update.h" |
| 24 #include "base/rand_util.h" | 22 #include "base/rand_util.h" |
| 25 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 26 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
| 27 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
| 28 #include "base/sys_info.h" | 26 #include "base/sys_info.h" |
| 29 #include "base/threading/worker_pool.h" | 27 #include "base/threading/worker_pool.h" |
| 30 #include "base/values.h" | 28 #include "base/values.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 51 #include "chrome/browser/chromeos/session_length_limiter.h" | 49 #include "chrome/browser/chromeos/session_length_limiter.h" |
| 52 #include "chrome/browser/managed_mode/chromeos/managed_user_password_service_fac
tory.h" | 50 #include "chrome/browser/managed_mode/chromeos/managed_user_password_service_fac
tory.h" |
| 53 #include "chrome/browser/managed_mode/chromeos/manager_password_service_factory.
h" | 51 #include "chrome/browser/managed_mode/chromeos/manager_password_service_factory.
h" |
| 54 #include "chrome/browser/net/nss_context.h" | 52 #include "chrome/browser/net/nss_context.h" |
| 55 #include "chrome/browser/profiles/profile.h" | 53 #include "chrome/browser/profiles/profile.h" |
| 56 #include "chrome/browser/profiles/profile_manager.h" | 54 #include "chrome/browser/profiles/profile_manager.h" |
| 57 #include "chrome/browser/profiles/profiles_state.h" | 55 #include "chrome/browser/profiles/profiles_state.h" |
| 58 #include "chrome/browser/sync/profile_sync_service.h" | 56 #include "chrome/browser/sync/profile_sync_service.h" |
| 59 #include "chrome/browser/sync/profile_sync_service_factory.h" | 57 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 60 #include "chrome/common/chrome_constants.h" | 58 #include "chrome/common/chrome_constants.h" |
| 61 #include "chrome/common/chrome_paths.h" | |
| 62 #include "chrome/common/chrome_switches.h" | 59 #include "chrome/common/chrome_switches.h" |
| 63 #include "chrome/common/crash_keys.h" | 60 #include "chrome/common/crash_keys.h" |
| 64 #include "chrome/common/pref_names.h" | 61 #include "chrome/common/pref_names.h" |
| 65 #include "chromeos/cert_loader.h" | 62 #include "chromeos/cert_loader.h" |
| 66 #include "chromeos/chromeos_switches.h" | 63 #include "chromeos/chromeos_switches.h" |
| 67 #include "chromeos/cryptohome/async_method_caller.h" | 64 #include "chromeos/cryptohome/async_method_caller.h" |
| 68 #include "chromeos/dbus/dbus_thread_manager.h" | 65 #include "chromeos/dbus/dbus_thread_manager.h" |
| 69 #include "chromeos/login/login_state.h" | 66 #include "chromeos/login/login_state.h" |
| 70 #include "chromeos/settings/cros_settings_names.h" | 67 #include "chromeos/settings/cros_settings_names.h" |
| 71 #include "content/public/browser/browser_thread.h" | 68 #include "content/public/browser/browser_thread.h" |
| (...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 GetUserImageManager(UserManager::kRetailModeUserName)->UserLoggedIn( | 1543 GetUserImageManager(UserManager::kRetailModeUserName)->UserLoggedIn( |
| 1547 is_current_user_new_, | 1544 is_current_user_new_, |
| 1548 true); | 1545 true); |
| 1549 WallpaperManager::Get()->SetUserWallpaperNow( | 1546 WallpaperManager::Get()->SetUserWallpaperNow( |
| 1550 UserManager::kRetailModeUserName); | 1547 UserManager::kRetailModeUserName); |
| 1551 } | 1548 } |
| 1552 | 1549 |
| 1553 void UserManagerImpl::NotifyOnLogin() { | 1550 void UserManagerImpl::NotifyOnLogin() { |
| 1554 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1551 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1555 | 1552 |
| 1556 // Override user homedir, check for ProfileManager being initialized as | |
| 1557 // it may not exist in unit tests. | |
| 1558 if (g_browser_process->profile_manager()) { | |
| 1559 if (GetLoggedInUsers().size() == 1) { | |
| 1560 base::FilePath homedir = ProfileHelper::GetProfilePathByUserIdHash( | |
| 1561 primary_user_->username_hash()); | |
| 1562 PathService::Override(base::DIR_HOME, homedir); | |
| 1563 } | |
| 1564 } | |
| 1565 | |
| 1566 UpdateNumberOfUsers(); | 1553 UpdateNumberOfUsers(); |
| 1567 NotifyActiveUserHashChanged(active_user_->username_hash()); | 1554 NotifyActiveUserHashChanged(active_user_->username_hash()); |
| 1568 NotifyActiveUserChanged(active_user_); | 1555 NotifyActiveUserChanged(active_user_); |
| 1569 UpdateLoginState(); | 1556 UpdateLoginState(); |
| 1570 | 1557 |
| 1571 // TODO(nkostylev): Deprecate this notification in favor of | 1558 // TODO(nkostylev): Deprecate this notification in favor of |
| 1572 // ActiveUserChanged() observer call. | 1559 // ActiveUserChanged() observer call. |
| 1573 content::NotificationService::current()->Notify( | 1560 content::NotificationService::current()->Notify( |
| 1574 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 1561 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
| 1575 content::Source<UserManager>(this), | 1562 content::Source<UserManager>(this), |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2102 } | 2089 } |
| 2103 | 2090 |
| 2104 void UserManagerImpl::DeleteUser(User* user) { | 2091 void UserManagerImpl::DeleteUser(User* user) { |
| 2105 const bool is_active_user = (user == active_user_); | 2092 const bool is_active_user = (user == active_user_); |
| 2106 delete user; | 2093 delete user; |
| 2107 if (is_active_user) | 2094 if (is_active_user) |
| 2108 active_user_ = NULL; | 2095 active_user_ = NULL; |
| 2109 } | 2096 } |
| 2110 | 2097 |
| 2111 } // namespace chromeos | 2098 } // namespace chromeos |
| OLD | NEW |