OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/app_mode/arc/arc_kiosk_app_manager.h> | 5 #include <chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/barrier_closure.h" | 10 #include "base/barrier_closure.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (!arc::IsArcKioskAvailable()) { | 177 if (!arc::IsArcKioskAvailable()) { |
178 VLOG(1) << "Device doesn't support ARC kiosk"; | 178 VLOG(1) << "Device doesn't support ARC kiosk"; |
179 return; | 179 return; |
180 } | 180 } |
181 | 181 |
182 // Store current apps. We will compare old and new apps to determine which | 182 // Store current apps. We will compare old and new apps to determine which |
183 // apps are new, and which were deleted. | 183 // apps are new, and which were deleted. |
184 ArcKioskApps old_apps(std::move(apps_)); | 184 ArcKioskApps old_apps(std::move(apps_)); |
185 | 185 |
186 auto_launch_account_id_.clear(); | 186 auto_launch_account_id_.clear(); |
| 187 auto_launched_with_zero_delay_ = false; |
187 std::string auto_login_account_id_from_settings; | 188 std::string auto_login_account_id_from_settings; |
188 CrosSettings::Get()->GetString(kAccountsPrefDeviceLocalAccountAutoLoginId, | 189 CrosSettings::Get()->GetString(kAccountsPrefDeviceLocalAccountAutoLoginId, |
189 &auto_login_account_id_from_settings); | 190 &auto_login_account_id_from_settings); |
190 | 191 |
191 // Re-populates |apps_| and reuses existing apps when possible. | 192 // Re-populates |apps_| and reuses existing apps when possible. |
192 const std::vector<policy::DeviceLocalAccount> device_local_accounts = | 193 const std::vector<policy::DeviceLocalAccount> device_local_accounts = |
193 policy::GetDeviceLocalAccounts(CrosSettings::Get()); | 194 policy::GetDeviceLocalAccounts(CrosSettings::Get()); |
194 for (auto account : device_local_accounts) { | 195 for (auto account : device_local_accounts) { |
195 if (account.type != policy::DeviceLocalAccount::TYPE_ARC_KIOSK_APP) | 196 if (account.type != policy::DeviceLocalAccount::TYPE_ARC_KIOSK_APP) |
196 continue; | 197 continue; |
197 | 198 |
198 const AccountId account_id(AccountId::FromUserEmail(account.user_id)); | 199 const AccountId account_id(AccountId::FromUserEmail(account.user_id)); |
199 | 200 |
200 if (account.account_id == auto_login_account_id_from_settings) | 201 if (account.account_id == auto_login_account_id_from_settings) { |
201 auto_launch_account_id_ = account_id; | 202 auto_launch_account_id_ = account_id; |
| 203 int auto_launch_delay = 0; |
| 204 CrosSettings::Get()->GetInteger( |
| 205 kAccountsPrefDeviceLocalAccountAutoLoginDelay, &auto_launch_delay); |
| 206 auto_launched_with_zero_delay_ = auto_launch_delay == 0; |
| 207 } |
202 | 208 |
203 auto old_it = | 209 auto old_it = |
204 std::find(old_apps.begin(), old_apps.end(), account.arc_kiosk_app_info); | 210 std::find(old_apps.begin(), old_apps.end(), account.arc_kiosk_app_info); |
205 if (old_it != old_apps.end()) { | 211 if (old_it != old_apps.end()) { |
206 apps_.push_back(std::move(*old_it)); | 212 apps_.push_back(std::move(*old_it)); |
207 old_apps.erase(old_it); | 213 old_apps.erase(old_it); |
208 } else { | 214 } else { |
209 // Use package name when display name is not specified. | 215 // Use package name when display name is not specified. |
210 std::string name = account.arc_kiosk_app_info.package_name(); | 216 std::string name = account.arc_kiosk_app_info.package_name(); |
211 if (!account.arc_kiosk_app_info.display_name().empty()) | 217 if (!account.arc_kiosk_app_info.display_name().empty()) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 cryptohome_id, base::Bind(&OnRemoveAppCryptohomeComplete, | 256 cryptohome_id, base::Bind(&OnRemoveAppCryptohomeComplete, |
251 cryptohome_id, base::Closure())); | 257 cryptohome_id, base::Closure())); |
252 } | 258 } |
253 } | 259 } |
254 | 260 |
255 if (active_user_to_be_deleted) | 261 if (active_user_to_be_deleted) |
256 chrome::AttemptUserExit(); | 262 chrome::AttemptUserExit(); |
257 } | 263 } |
258 | 264 |
259 } // namespace chromeos | 265 } // namespace chromeos |
OLD | NEW |