| 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/chrome_user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/users/chrome_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" | |
| 11 #include "base/bind.h" | 10 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 13 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 14 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 15 #include "base/format_macros.h" | 14 #include "base/format_macros.h" |
| 16 #include "base/logging.h" | 15 #include "base/logging.h" |
| 17 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 18 #include "base/prefs/pref_registry_simple.h" | 17 #include "base/prefs/pref_registry_simple.h" |
| 19 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
| 20 #include "base/prefs/scoped_user_pref_update.h" | 19 #include "base/prefs/scoped_user_pref_update.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "components/user_manager/remove_user_delegate.h" | 52 #include "components/user_manager/remove_user_delegate.h" |
| 54 #include "components/user_manager/user_image/user_image.h" | 53 #include "components/user_manager/user_image/user_image.h" |
| 55 #include "components/user_manager/user_type.h" | 54 #include "components/user_manager/user_type.h" |
| 56 #include "content/public/browser/browser_thread.h" | 55 #include "content/public/browser/browser_thread.h" |
| 57 #include "content/public/browser/notification_service.h" | 56 #include "content/public/browser/notification_service.h" |
| 58 #include "policy/policy_constants.h" | 57 #include "policy/policy_constants.h" |
| 59 #include "ui/base/resource/resource_bundle.h" | 58 #include "ui/base/resource/resource_bundle.h" |
| 60 #include "ui/wm/core/wm_core_switches.h" | 59 #include "ui/wm/core/wm_core_switches.h" |
| 61 | 60 |
| 62 #if !defined(USE_ATHENA) | 61 #if !defined(USE_ATHENA) |
| 62 #include "ash/multi_profile_uma.h" |
| 63 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 63 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 64 #endif | 64 #endif |
| 65 | 65 |
| 66 using content::BrowserThread; | 66 using content::BrowserThread; |
| 67 | 67 |
| 68 namespace chromeos { | 68 namespace chromeos { |
| 69 namespace { | 69 namespace { |
| 70 | 70 |
| 71 // A vector pref of the the regular users known on this device, arranged in LRU | 71 // A vector pref of the the regular users known on this device, arranged in LRU |
| 72 // order. | 72 // order. |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 ChromeUserManager::NotifyUserAddedToSession(added_user, user_switch_pending); | 1055 ChromeUserManager::NotifyUserAddedToSession(added_user, user_switch_pending); |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 void ChromeUserManagerImpl::OnUserNotAllowed(const std::string& user_email) { | 1058 void ChromeUserManagerImpl::OnUserNotAllowed(const std::string& user_email) { |
| 1059 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " | 1059 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " |
| 1060 "current session"; | 1060 "current session"; |
| 1061 chromeos::ShowMultiprofilesSessionAbortedDialog(user_email); | 1061 chromeos::ShowMultiprofilesSessionAbortedDialog(user_email); |
| 1062 } | 1062 } |
| 1063 | 1063 |
| 1064 void ChromeUserManagerImpl::UpdateNumberOfUsers() { | 1064 void ChromeUserManagerImpl::UpdateNumberOfUsers() { |
| 1065 #if !defined(USE_ATHENA) |
| 1065 size_t users = GetLoggedInUsers().size(); | 1066 size_t users = GetLoggedInUsers().size(); |
| 1066 if (users) { | 1067 if (users) { |
| 1067 // Write the user number as UMA stat when a multi user session is possible. | 1068 // Write the user number as UMA stat when a multi user session is possible. |
| 1068 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) | 1069 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) |
| 1069 ash::MultiProfileUMA::RecordUserCount(users); | 1070 ash::MultiProfileUMA::RecordUserCount(users); |
| 1070 } | 1071 } |
| 1072 #endif |
| 1071 | 1073 |
| 1072 base::debug::SetCrashKeyValue( | 1074 base::debug::SetCrashKeyValue( |
| 1073 crash_keys::kNumberOfUsers, | 1075 crash_keys::kNumberOfUsers, |
| 1074 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); | 1076 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); |
| 1075 } | 1077 } |
| 1076 | 1078 |
| 1077 } // namespace chromeos | 1079 } // namespace chromeos |
| OLD | NEW |