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

Side by Side Diff: chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.cc

Issue 2758593002: Enable screen capture for ARC++ Kiosk (Closed)
Patch Set: Second version, set flag in ArcKioskAppManager::UpdateApps Created 3 years, 9 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 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 163 }
164 164
165 void ArcKioskAppManager::AddObserver(ArcKioskAppManagerObserver* observer) { 165 void ArcKioskAppManager::AddObserver(ArcKioskAppManagerObserver* observer) {
166 observers_.AddObserver(observer); 166 observers_.AddObserver(observer);
167 } 167 }
168 168
169 void ArcKioskAppManager::RemoveObserver(ArcKioskAppManagerObserver* observer) { 169 void ArcKioskAppManager::RemoveObserver(ArcKioskAppManagerObserver* observer) {
170 observers_.RemoveObserver(observer); 170 observers_.RemoveObserver(observer);
171 } 171 }
172 172
173 bool ArcKioskAppManager::CurrentAppWasAutoLaunchedWithZeroDelay() const {
174 return auto_launched_with_zero_delay_;
175 }
176
173 void ArcKioskAppManager::UpdateApps() { 177 void ArcKioskAppManager::UpdateApps() {
174 // Do not populate ARC kiosk apps if ARC kiosk apps can't be run on the 178 // Do not populate ARC kiosk apps if ARC kiosk apps can't be run on the
175 // device. 179 // device.
176 // Apps won't be added to kiosk Apps menu and won't be auto-launched. 180 // Apps won't be added to kiosk Apps menu and won't be auto-launched.
177 if (!arc::IsArcKioskAvailable()) { 181 if (!arc::IsArcKioskAvailable()) {
178 VLOG(1) << "Device doesn't support ARC kiosk"; 182 VLOG(1) << "Device doesn't support ARC kiosk";
179 return; 183 return;
180 } 184 }
181 185
182 // Store current apps. We will compare old and new apps to determine which 186 // Store current apps. We will compare old and new apps to determine which
183 // apps are new, and which were deleted. 187 // apps are new, and which were deleted.
184 ArcKioskApps old_apps(std::move(apps_)); 188 ArcKioskApps old_apps(std::move(apps_));
185 189
186 auto_launch_account_id_.clear(); 190 auto_launch_account_id_.clear();
191 auto_launched_with_zero_delay_ = false;
187 std::string auto_login_account_id_from_settings; 192 std::string auto_login_account_id_from_settings;
188 CrosSettings::Get()->GetString(kAccountsPrefDeviceLocalAccountAutoLoginId, 193 CrosSettings::Get()->GetString(kAccountsPrefDeviceLocalAccountAutoLoginId,
189 &auto_login_account_id_from_settings); 194 &auto_login_account_id_from_settings);
190 195
191 // Re-populates |apps_| and reuses existing apps when possible. 196 // Re-populates |apps_| and reuses existing apps when possible.
192 const std::vector<policy::DeviceLocalAccount> device_local_accounts = 197 const std::vector<policy::DeviceLocalAccount> device_local_accounts =
193 policy::GetDeviceLocalAccounts(CrosSettings::Get()); 198 policy::GetDeviceLocalAccounts(CrosSettings::Get());
194 for (auto account : device_local_accounts) { 199 for (auto account : device_local_accounts) {
195 if (account.type != policy::DeviceLocalAccount::TYPE_ARC_KIOSK_APP) 200 if (account.type != policy::DeviceLocalAccount::TYPE_ARC_KIOSK_APP)
196 continue; 201 continue;
197 202
198 const AccountId account_id(AccountId::FromUserEmail(account.user_id)); 203 const AccountId account_id(AccountId::FromUserEmail(account.user_id));
199 204
200 if (account.account_id == auto_login_account_id_from_settings) 205 if (account.account_id == auto_login_account_id_from_settings) {
201 auto_launch_account_id_ = account_id; 206 auto_launch_account_id_ = account_id;
207 int auto_launch_delay = 0;
208 CrosSettings::Get()->GetInteger(
209 kAccountsPrefDeviceLocalAccountAutoLoginDelay, &auto_launch_delay);
210 if (auto_launch_delay == 0)
Luis Héctor Chávez 2017/03/17 17:46:54 nit: auto_launched_with_zero_delay_ = auto_launch_
Ivan Šandrk 2017/03/20 13:22:58 Done.
211 auto_launched_with_zero_delay_ = true;
212 }
202 213
203 auto old_it = 214 auto old_it =
204 std::find(old_apps.begin(), old_apps.end(), account.arc_kiosk_app_info); 215 std::find(old_apps.begin(), old_apps.end(), account.arc_kiosk_app_info);
205 if (old_it != old_apps.end()) { 216 if (old_it != old_apps.end()) {
206 apps_.push_back(std::move(*old_it)); 217 apps_.push_back(std::move(*old_it));
207 old_apps.erase(old_it); 218 old_apps.erase(old_it);
208 } else { 219 } else {
209 // Use package name when display name is not specified. 220 // Use package name when display name is not specified.
210 std::string name = account.arc_kiosk_app_info.package_name(); 221 std::string name = account.arc_kiosk_app_info.package_name();
211 if (!account.arc_kiosk_app_info.display_name().empty()) 222 if (!account.arc_kiosk_app_info.display_name().empty())
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 cryptohome_id, base::Bind(&OnRemoveAppCryptohomeComplete, 261 cryptohome_id, base::Bind(&OnRemoveAppCryptohomeComplete,
251 cryptohome_id, base::Closure())); 262 cryptohome_id, base::Closure()));
252 } 263 }
253 } 264 }
254 265
255 if (active_user_to_be_deleted) 266 if (active_user_to_be_deleted)
256 chrome::AttemptUserExit(); 267 chrome::AttemptUserExit();
257 } 268 }
258 269
259 } // namespace chromeos 270 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698