| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 #include "chromeos/login/user_names.h" | 63 #include "chromeos/login/user_names.h" |
| 64 #include "chromeos/settings/cros_settings_names.h" | 64 #include "chromeos/settings/cros_settings_names.h" |
| 65 #include "chromeos/timezone/timezone_resolver.h" | 65 #include "chromeos/timezone/timezone_resolver.h" |
| 66 #include "components/prefs/pref_registry_simple.h" | 66 #include "components/prefs/pref_registry_simple.h" |
| 67 #include "components/prefs/pref_service.h" | 67 #include "components/prefs/pref_service.h" |
| 68 #include "components/prefs/scoped_user_pref_update.h" | 68 #include "components/prefs/scoped_user_pref_update.h" |
| 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_image/user_image.h" | 74 #include "components/user_manager/user_image/user_image.h" |
| 74 #include "components/user_manager/user_type.h" | 75 #include "components/user_manager/user_type.h" |
| 75 #include "content/public/browser/browser_thread.h" | 76 #include "content/public/browser/browser_thread.h" |
| 76 #include "content/public/browser/notification_service.h" | 77 #include "content/public/browser/notification_service.h" |
| 78 #include "extensions/common/features/feature_session_type.h" |
| 77 #include "policy/policy_constants.h" | 79 #include "policy/policy_constants.h" |
| 78 #include "ui/base/l10n/l10n_util.h" | 80 #include "ui/base/l10n/l10n_util.h" |
| 79 #include "ui/base/resource/resource_bundle.h" | 81 #include "ui/base/resource/resource_bundle.h" |
| 80 #include "ui/chromeos/resources/grit/ui_chromeos_resources.h" | 82 #include "ui/chromeos/resources/grit/ui_chromeos_resources.h" |
| 81 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" | 83 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" |
| 82 #include "ui/gfx/image/image_skia.h" | 84 #include "ui/gfx/image/image_skia.h" |
| 83 #include "ui/wm/core/wm_core_switches.h" | 85 #include "ui/wm/core/wm_core_switches.h" |
| 84 | 86 |
| 85 using content::BrowserThread; | 87 using content::BrowserThread; |
| 86 | 88 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 PrefService* const prefs = profile->GetPrefs(); | 140 PrefService* const prefs = profile->GetPrefs(); |
| 139 if (can_lock) | 141 if (can_lock) |
| 140 *can_lock = user->can_lock() && prefs->GetBoolean(prefs::kAllowScreenLock); | 142 *can_lock = user->can_lock() && prefs->GetBoolean(prefs::kAllowScreenLock); |
| 141 if (multi_profile_behavior) { | 143 if (multi_profile_behavior) { |
| 142 *multi_profile_behavior = | 144 *multi_profile_behavior = |
| 143 prefs->GetString(prefs::kMultiProfileUserBehavior); | 145 prefs->GetString(prefs::kMultiProfileUserBehavior); |
| 144 } | 146 } |
| 145 return true; | 147 return true; |
| 146 } | 148 } |
| 147 | 149 |
| 150 extensions::FeatureSessionType GetFeatureSessionTypeForUser( |
| 151 const user_manager::User* user) { |
| 152 switch (user->GetType()) { |
| 153 case user_manager::USER_TYPE_REGULAR: |
| 154 return extensions::FeatureSessionType::REGULAR; |
| 155 case user_manager::USER_TYPE_KIOSK_APP: |
| 156 return extensions::FeatureSessionType::KIOSK; |
| 157 default: |
| 158 // The rest of user types is not used by extensions features. |
| 159 return extensions::FeatureSessionType::UNKNOWN; |
| 160 } |
| 161 } |
| 162 |
| 148 } // namespace | 163 } // namespace |
| 149 | 164 |
| 150 // static | 165 // static |
| 151 void ChromeUserManagerImpl::RegisterPrefs(PrefRegistrySimple* registry) { | 166 void ChromeUserManagerImpl::RegisterPrefs(PrefRegistrySimple* registry) { |
| 152 ChromeUserManager::RegisterPrefs(registry); | 167 ChromeUserManager::RegisterPrefs(registry); |
| 153 | 168 |
| 154 registry->RegisterListPref(kDeviceLocalAccounts); | 169 registry->RegisterListPref(kDeviceLocalAccounts); |
| 155 registry->RegisterStringPref(kDeviceLocalAccountPendingDataRemoval, | 170 registry->RegisterStringPref(kDeviceLocalAccountPendingDataRemoval, |
| 156 std::string()); | 171 std::string()); |
| 157 registry->RegisterListPref(kReportingUsers); | 172 registry->RegisterListPref(kReportingUsers); |
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 users_update->Remove( | 1245 users_update->Remove( |
| 1231 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL); | 1246 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL); |
| 1232 } | 1247 } |
| 1233 | 1248 |
| 1234 void ChromeUserManagerImpl::UpdateLoginState( | 1249 void ChromeUserManagerImpl::UpdateLoginState( |
| 1235 const user_manager::User* active_user, | 1250 const user_manager::User* active_user, |
| 1236 const user_manager::User* primary_user, | 1251 const user_manager::User* primary_user, |
| 1237 bool is_current_user_owner) const { | 1252 bool is_current_user_owner) const { |
| 1238 chrome_user_manager_util::UpdateLoginState(active_user, primary_user, | 1253 chrome_user_manager_util::UpdateLoginState(active_user, primary_user, |
| 1239 is_current_user_owner); | 1254 is_current_user_owner); |
| 1255 // If a user is logged in, update session type as seen by extensions system. |
| 1256 if (active_user) { |
| 1257 extensions::SetCurrentFeatureSessionType( |
| 1258 GetFeatureSessionTypeForUser(active_user)); |
| 1259 } |
| 1240 } | 1260 } |
| 1241 | 1261 |
| 1242 bool ChromeUserManagerImpl::GetPlatformKnownUserId( | 1262 bool ChromeUserManagerImpl::GetPlatformKnownUserId( |
| 1243 const std::string& user_email, | 1263 const std::string& user_email, |
| 1244 const std::string& gaia_id, | 1264 const std::string& gaia_id, |
| 1245 AccountId* out_account_id) const { | 1265 AccountId* out_account_id) const { |
| 1246 return chrome_user_manager_util::GetPlatformKnownUserId(user_email, gaia_id, | 1266 return chrome_user_manager_util::GetPlatformKnownUserId(user_email, gaia_id, |
| 1247 out_account_id); | 1267 out_account_id); |
| 1248 } | 1268 } |
| 1249 | 1269 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 break; | 1343 break; |
| 1324 default: | 1344 default: |
| 1325 NOTREACHED(); | 1345 NOTREACHED(); |
| 1326 break; | 1346 break; |
| 1327 } | 1347 } |
| 1328 | 1348 |
| 1329 return user; | 1349 return user; |
| 1330 } | 1350 } |
| 1331 | 1351 |
| 1332 } // namespace chromeos | 1352 } // namespace chromeos |
| OLD | NEW |