Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc

Issue 2601803003: Introduce kiosk.autolaunched feature session type (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 users_update->Remove( 1247 users_update->Remove(
1263 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL); 1248 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL);
1264 } 1249 }
1265 1250
1266 void ChromeUserManagerImpl::UpdateLoginState( 1251 void ChromeUserManagerImpl::UpdateLoginState(
1267 const user_manager::User* active_user, 1252 const user_manager::User* active_user,
1268 const user_manager::User* primary_user, 1253 const user_manager::User* primary_user,
1269 bool is_current_user_owner) const { 1254 bool is_current_user_owner) const {
1270 chrome_user_manager_util::UpdateLoginState(active_user, primary_user, 1255 chrome_user_manager_util::UpdateLoginState(active_user, primary_user,
1271 is_current_user_owner); 1256 is_current_user_owner);
1272 // If a user is logged in, update session type as seen by extensions system.
1273 if (active_user) {
1274 extensions::SetCurrentFeatureSessionType(
1275 GetFeatureSessionTypeForUser(active_user));
1276 }
1277 } 1257 }
1278 1258
1279 bool ChromeUserManagerImpl::GetPlatformKnownUserId( 1259 bool ChromeUserManagerImpl::GetPlatformKnownUserId(
1280 const std::string& user_email, 1260 const std::string& user_email,
1281 const std::string& gaia_id, 1261 const std::string& gaia_id,
1282 AccountId* out_account_id) const { 1262 AccountId* out_account_id) const {
1283 return chrome_user_manager_util::GetPlatformKnownUserId(user_email, gaia_id, 1263 return chrome_user_manager_util::GetPlatformKnownUserId(user_email, gaia_id,
1284 out_account_id); 1264 out_account_id);
1285 } 1265 }
1286 1266
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 break; 1343 break;
1364 default: 1344 default:
1365 NOTREACHED(); 1345 NOTREACHED();
1366 break; 1346 break;
1367 } 1347 }
1368 1348
1369 return user; 1349 return user;
1370 } 1350 }
1371 1351
1372 } // namespace chromeos 1352 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698