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" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/command_line.h" | |
15 #include "base/logging.h" | 14 #include "base/logging.h" |
16 #include "base/values.h" | 15 #include "base/values.h" |
17 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/lifetime/application_lifetime.h" | 17 #include "chrome/browser/lifetime/application_lifetime.h" |
19 #include "chromeos/cryptohome/async_method_caller.h" | 18 #include "chromeos/cryptohome/async_method_caller.h" |
20 #include "chromeos/cryptohome/cryptohome_parameters.h" | 19 #include "chromeos/cryptohome/cryptohome_parameters.h" |
21 #include "chromeos/dbus/cryptohome_client.h" | 20 #include "chromeos/dbus/cryptohome_client.h" |
22 #include "chromeos/dbus/dbus_thread_manager.h" | 21 #include "chromeos/dbus/dbus_thread_manager.h" |
23 #include "chromeos/settings/cros_settings_names.h" | 22 #include "chromeos/settings/cros_settings_names.h" |
24 #include "components/arc/arc_bridge_service.h" | 23 #include "components/arc/arc_util.h" |
25 #include "components/prefs/pref_registry_simple.h" | 24 #include "components/prefs/pref_registry_simple.h" |
26 #include "components/prefs/pref_service.h" | 25 #include "components/prefs/pref_service.h" |
27 #include "components/prefs/scoped_user_pref_update.h" | 26 #include "components/prefs/scoped_user_pref_update.h" |
28 #include "components/user_manager/user.h" | 27 #include "components/user_manager/user.h" |
29 #include "components/user_manager/user_manager.h" | 28 #include "components/user_manager/user_manager.h" |
30 #include "third_party/cros_system_api/dbus/service_constants.h" | 29 #include "third_party/cros_system_api/dbus/service_constants.h" |
31 | 30 |
32 namespace chromeos { | 31 namespace chromeos { |
33 | 32 |
34 namespace { | 33 namespace { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 observers_.AddObserver(observer); | 166 observers_.AddObserver(observer); |
168 } | 167 } |
169 | 168 |
170 void ArcKioskAppManager::RemoveObserver(ArcKioskAppManagerObserver* observer) { | 169 void ArcKioskAppManager::RemoveObserver(ArcKioskAppManagerObserver* observer) { |
171 observers_.RemoveObserver(observer); | 170 observers_.RemoveObserver(observer); |
172 } | 171 } |
173 | 172 |
174 void ArcKioskAppManager::UpdateApps() { | 173 void ArcKioskAppManager::UpdateApps() { |
175 // Do not populate ARC kiosk apps if ARC apps can't be run on the device. | 174 // Do not populate ARC kiosk apps if ARC apps can't be run on the device. |
176 // Apps won't be added to kiosk Apps menu and won't be auto-launched. | 175 // Apps won't be added to kiosk Apps menu and won't be auto-launched. |
177 if (!arc::ArcBridgeService::GetEnabled( | 176 if (!arc::IsArcAvailable()) { |
178 base::CommandLine::ForCurrentProcess())) { | |
179 VLOG(1) << "Device doesn't support ARC apps, don't populate ARC kiosk apps"; | 177 VLOG(1) << "Device doesn't support ARC apps, don't populate ARC kiosk apps"; |
180 return; | 178 return; |
181 } | 179 } |
182 | 180 |
183 // Store current apps. We will compare old and new apps to determine which | 181 // Store current apps. We will compare old and new apps to determine which |
184 // apps are new, and which were deleted. | 182 // apps are new, and which were deleted. |
185 ArcKioskApps old_apps(std::move(apps_)); | 183 ArcKioskApps old_apps(std::move(apps_)); |
186 | 184 |
187 auto_launch_account_id_.clear(); | 185 auto_launch_account_id_.clear(); |
188 std::string auto_login_account_id_from_settings; | 186 std::string auto_login_account_id_from_settings; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 cryptohome_id, base::Bind(&OnRemoveAppCryptohomeComplete, | 247 cryptohome_id, base::Bind(&OnRemoveAppCryptohomeComplete, |
250 cryptohome_id, base::Closure())); | 248 cryptohome_id, base::Closure())); |
251 } | 249 } |
252 } | 250 } |
253 | 251 |
254 if (active_user_to_be_deleted) | 252 if (active_user_to_be_deleted) |
255 chrome::AttemptUserExit(); | 253 chrome::AttemptUserExit(); |
256 } | 254 } |
257 | 255 |
258 } // namespace chromeos | 256 } // namespace chromeos |
OLD | NEW |