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