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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 users_update->Remove( | 1248 users_update->Remove( |
1264 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL); | 1249 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL); |
1265 } | 1250 } |
1266 | 1251 |
1267 void ChromeUserManagerImpl::UpdateLoginState( | 1252 void ChromeUserManagerImpl::UpdateLoginState( |
1268 const user_manager::User* active_user, | 1253 const user_manager::User* active_user, |
1269 const user_manager::User* primary_user, | 1254 const user_manager::User* primary_user, |
1270 bool is_current_user_owner) const { | 1255 bool is_current_user_owner) const { |
1271 chrome_user_manager_util::UpdateLoginState(active_user, primary_user, | 1256 chrome_user_manager_util::UpdateLoginState(active_user, primary_user, |
1272 is_current_user_owner); | 1257 is_current_user_owner); |
1273 // If a user is logged in, update session type as seen by extensions system. | |
1274 if (active_user) { | |
1275 extensions::SetCurrentFeatureSessionType( | |
1276 GetFeatureSessionTypeForUser(active_user)); | |
1277 } | |
1278 } | 1258 } |
1279 | 1259 |
1280 bool ChromeUserManagerImpl::GetPlatformKnownUserId( | 1260 bool ChromeUserManagerImpl::GetPlatformKnownUserId( |
1281 const std::string& user_email, | 1261 const std::string& user_email, |
1282 const std::string& gaia_id, | 1262 const std::string& gaia_id, |
1283 AccountId* out_account_id) const { | 1263 AccountId* out_account_id) const { |
1284 return chrome_user_manager_util::GetPlatformKnownUserId(user_email, gaia_id, | 1264 return chrome_user_manager_util::GetPlatformKnownUserId(user_email, gaia_id, |
1285 out_account_id); | 1265 out_account_id); |
1286 } | 1266 } |
1287 | 1267 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 break; | 1344 break; |
1365 default: | 1345 default: |
1366 NOTREACHED(); | 1346 NOTREACHED(); |
1367 break; | 1347 break; |
1368 } | 1348 } |
1369 | 1349 |
1370 return user; | 1350 return user; |
1371 } | 1351 } |
1372 | 1352 |
1373 } // namespace chromeos | 1353 } // namespace chromeos |
OLD | NEW |