| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "components/session_manager/core/session_manager.h" | 69 #include "components/session_manager/core/session_manager.h" |
| 70 #include "components/signin/core/account_id/account_id.h" | 70 #include "components/signin/core/account_id/account_id.h" |
| 71 #include "components/user_manager/known_user.h" | 71 #include "components/user_manager/known_user.h" |
| 72 #include "components/user_manager/remove_user_delegate.h" | 72 #include "components/user_manager/remove_user_delegate.h" |
| 73 #include "components/user_manager/user.h" | 73 #include "components/user_manager/user.h" |
| 74 #include "components/user_manager/user_image/user_image.h" | 74 #include "components/user_manager/user_image/user_image.h" |
| 75 #include "components/user_manager/user_names.h" | 75 #include "components/user_manager/user_names.h" |
| 76 #include "components/user_manager/user_type.h" | 76 #include "components/user_manager/user_type.h" |
| 77 #include "content/public/browser/browser_thread.h" | 77 #include "content/public/browser/browser_thread.h" |
| 78 #include "content/public/browser/notification_service.h" | 78 #include "content/public/browser/notification_service.h" |
| 79 #include "extensions/common/features/feature_session_type.h" | |
| 80 #include "ui/base/l10n/l10n_util.h" | 79 #include "ui/base/l10n/l10n_util.h" |
| 81 #include "ui/base/resource/resource_bundle.h" | 80 #include "ui/base/resource/resource_bundle.h" |
| 82 #include "ui/chromeos/resources/grit/ui_chromeos_resources.h" | 81 #include "ui/chromeos/resources/grit/ui_chromeos_resources.h" |
| 83 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" | 82 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" |
| 84 #include "ui/gfx/image/image_skia.h" | 83 #include "ui/gfx/image/image_skia.h" |
| 85 #include "ui/wm/core/wm_core_switches.h" | 84 #include "ui/wm/core/wm_core_switches.h" |
| 86 | 85 |
| 87 using content::BrowserThread; | 86 using content::BrowserThread; |
| 88 | 87 |
| 89 namespace chromeos { | 88 namespace chromeos { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 PrefService* const prefs = profile->GetPrefs(); | 139 PrefService* const prefs = profile->GetPrefs(); |
| 141 if (can_lock) | 140 if (can_lock) |
| 142 *can_lock = user->can_lock() && prefs->GetBoolean(prefs::kAllowScreenLock); | 141 *can_lock = user->can_lock() && prefs->GetBoolean(prefs::kAllowScreenLock); |
| 143 if (multi_profile_behavior) { | 142 if (multi_profile_behavior) { |
| 144 *multi_profile_behavior = | 143 *multi_profile_behavior = |
| 145 prefs->GetString(prefs::kMultiProfileUserBehavior); | 144 prefs->GetString(prefs::kMultiProfileUserBehavior); |
| 146 } | 145 } |
| 147 return true; | 146 return true; |
| 148 } | 147 } |
| 149 | 148 |
| 150 extensions::FeatureSessionType GetFeatureSessionTypeForUser( | |
| 151 const user_manager::User* user) { | |
| 152 switch (user->GetType()) { | |
| 153 case user_manager::USER_TYPE_REGULAR: | |
| 154 case user_manager::USER_TYPE_CHILD: | |
| 155 return extensions::FeatureSessionType::REGULAR; | |
| 156 case user_manager::USER_TYPE_KIOSK_APP: | |
| 157 return extensions::FeatureSessionType::KIOSK; | |
| 158 default: | |
| 159 // The rest of user types is not used by extensions features. | |
| 160 return extensions::FeatureSessionType::UNKNOWN; | |
| 161 } | |
| 162 } | |
| 163 | |
| 164 } // namespace | 149 } // namespace |
| 165 | 150 |
| 166 // static | 151 // static |
| 167 void ChromeUserManagerImpl::RegisterPrefs(PrefRegistrySimple* registry) { | 152 void ChromeUserManagerImpl::RegisterPrefs(PrefRegistrySimple* registry) { |
| 168 ChromeUserManager::RegisterPrefs(registry); | 153 ChromeUserManager::RegisterPrefs(registry); |
| 169 | 154 |
| 170 registry->RegisterListPref(kDeviceLocalAccounts); | 155 registry->RegisterListPref(kDeviceLocalAccounts); |
| 171 registry->RegisterStringPref(kDeviceLocalAccountPendingDataRemoval, | 156 registry->RegisterStringPref(kDeviceLocalAccountPendingDataRemoval, |
| 172 std::string()); | 157 std::string()); |
| 173 registry->RegisterListPref(kReportingUsers); | 158 registry->RegisterListPref(kReportingUsers); |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 users_update->Remove( | 1241 users_update->Remove( |
| 1257 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL); | 1242 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL); |
| 1258 } | 1243 } |
| 1259 | 1244 |
| 1260 void ChromeUserManagerImpl::UpdateLoginState( | 1245 void ChromeUserManagerImpl::UpdateLoginState( |
| 1261 const user_manager::User* active_user, | 1246 const user_manager::User* active_user, |
| 1262 const user_manager::User* primary_user, | 1247 const user_manager::User* primary_user, |
| 1263 bool is_current_user_owner) const { | 1248 bool is_current_user_owner) const { |
| 1264 chrome_user_manager_util::UpdateLoginState(active_user, primary_user, | 1249 chrome_user_manager_util::UpdateLoginState(active_user, primary_user, |
| 1265 is_current_user_owner); | 1250 is_current_user_owner); |
| 1266 // If a user is logged in, update session type as seen by extensions system. | |
| 1267 if (active_user) { | |
| 1268 extensions::SetCurrentFeatureSessionType( | |
| 1269 GetFeatureSessionTypeForUser(active_user)); | |
| 1270 } | |
| 1271 } | 1251 } |
| 1272 | 1252 |
| 1273 bool ChromeUserManagerImpl::GetPlatformKnownUserId( | 1253 bool ChromeUserManagerImpl::GetPlatformKnownUserId( |
| 1274 const std::string& user_email, | 1254 const std::string& user_email, |
| 1275 const std::string& gaia_id, | 1255 const std::string& gaia_id, |
| 1276 AccountId* out_account_id) const { | 1256 AccountId* out_account_id) const { |
| 1277 return chrome_user_manager_util::GetPlatformKnownUserId(user_email, gaia_id, | 1257 return chrome_user_manager_util::GetPlatformKnownUserId(user_email, gaia_id, |
| 1278 out_account_id); | 1258 out_account_id); |
| 1279 } | 1259 } |
| 1280 | 1260 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 break; | 1337 break; |
| 1358 default: | 1338 default: |
| 1359 NOTREACHED(); | 1339 NOTREACHED(); |
| 1360 break; | 1340 break; |
| 1361 } | 1341 } |
| 1362 | 1342 |
| 1363 return user; | 1343 return user; |
| 1364 } | 1344 } |
| 1365 | 1345 |
| 1366 } // namespace chromeos | 1346 } // namespace chromeos |
| OLD | NEW |