OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy/device_status_collector.h" | 5 #include "chrome/browser/chromeos/policy/device_status_collector.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 13 matching lines...) Expand all Loading... | |
24 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
25 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
26 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
27 #include "base/sys_info.h" | 27 #include "base/sys_info.h" |
28 #include "base/task_runner_util.h" | 28 #include "base/task_runner_util.h" |
29 #include "base/threading/sequenced_task_runner_handle.h" | 29 #include "base/threading/sequenced_task_runner_handle.h" |
30 #include "base/threading/sequenced_worker_pool.h" | 30 #include "base/threading/sequenced_worker_pool.h" |
31 #include "base/values.h" | 31 #include "base/values.h" |
32 #include "base/version.h" | 32 #include "base/version.h" |
33 #include "chrome/browser/browser_process.h" | 33 #include "chrome/browser/browser_process.h" |
34 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.h" | |
34 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 35 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
35 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 36 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
36 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 37 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
37 #include "chrome/browser/chromeos/policy/device_local_account.h" | 38 #include "chrome/browser/chromeos/policy/device_local_account.h" |
38 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 39 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
39 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h" | 40 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h" |
40 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 41 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
41 #include "chrome/browser/chromeos/settings/cros_settings.h" | 42 #include "chrome/browser/chromeos/settings/cros_settings.h" |
42 #include "chrome/browser/policy/profile_policy_connector.h" | 43 #include "chrome/browser/policy/profile_policy_connector.h" |
43 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 44 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 instance->GetStatus(receiver); | 247 instance->GetStatus(receiver); |
247 return true; | 248 return true; |
248 } | 249 } |
249 | 250 |
250 // Returns the DeviceLocalAccount associated with the current kiosk session. | 251 // Returns the DeviceLocalAccount associated with the current kiosk session. |
251 // Returns null if there is no active kiosk session, or if that kiosk | 252 // Returns null if there is no active kiosk session, or if that kiosk |
252 // session has been removed from policy since the session started, in which | 253 // session has been removed from policy since the session started, in which |
253 // case we won't report its status). | 254 // case we won't report its status). |
254 std::unique_ptr<policy::DeviceLocalAccount> GetCurrentKioskDeviceLocalAccount( | 255 std::unique_ptr<policy::DeviceLocalAccount> GetCurrentKioskDeviceLocalAccount( |
255 chromeos::CrosSettings* settings) { | 256 chromeos::CrosSettings* settings) { |
256 if (!user_manager::UserManager::Get()->IsLoggedInAsKioskApp()) | 257 if (!user_manager::UserManager::Get()->IsLoggedInAsKioskApp() && |
258 !user_manager::UserManager::Get()->IsLoggedInAsArcKioskApp()) { | |
257 return std::unique_ptr<policy::DeviceLocalAccount>(); | 259 return std::unique_ptr<policy::DeviceLocalAccount>(); |
260 } | |
258 const user_manager::User* const user = | 261 const user_manager::User* const user = |
259 user_manager::UserManager::Get()->GetActiveUser(); | 262 user_manager::UserManager::Get()->GetActiveUser(); |
260 const std::vector<policy::DeviceLocalAccount> accounts = | 263 const std::vector<policy::DeviceLocalAccount> accounts = |
261 policy::GetDeviceLocalAccounts(settings); | 264 policy::GetDeviceLocalAccounts(settings); |
262 | 265 |
263 for (const auto& device_local_account : accounts) { | 266 for (const auto& device_local_account : accounts) { |
264 if (AccountId::FromUserEmail(device_local_account.user_id) == | 267 if (AccountId::FromUserEmail(device_local_account.user_id) == |
265 user->GetAccountId()) { | 268 user->GetAccountId()) { |
266 return base::MakeUnique<policy::DeviceLocalAccount>(device_local_account); | 269 return base::MakeUnique<policy::DeviceLocalAccount>(device_local_account); |
267 } | 270 } |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
684 } | 687 } |
685 last_idle_check_ = now; | 688 last_idle_check_ = now; |
686 } | 689 } |
687 | 690 |
688 std::unique_ptr<DeviceLocalAccount> | 691 std::unique_ptr<DeviceLocalAccount> |
689 DeviceStatusCollector::GetAutoLaunchedKioskSessionInfo() { | 692 DeviceStatusCollector::GetAutoLaunchedKioskSessionInfo() { |
690 std::unique_ptr<DeviceLocalAccount> account = | 693 std::unique_ptr<DeviceLocalAccount> account = |
691 GetCurrentKioskDeviceLocalAccount(cros_settings_); | 694 GetCurrentKioskDeviceLocalAccount(cros_settings_); |
692 if (account) { | 695 if (account) { |
693 chromeos::KioskAppManager::App current_app; | 696 chromeos::KioskAppManager::App current_app; |
694 if (chromeos::KioskAppManager::Get()->GetApp(account->kiosk_app_id, | 697 bool regular_app_auto_launched_with_zero_delay = |
achuithb
2017/03/21 18:43:56
nit: const
| |
698 chromeos::KioskAppManager::Get()->GetApp(account->kiosk_app_id, | |
695 ¤t_app) && | 699 ¤t_app) && |
696 current_app.was_auto_launched_with_zero_delay) { | 700 current_app.was_auto_launched_with_zero_delay; |
701 bool arc_app_auto_launched_with_zero_delay = | |
achuithb
2017/03/21 18:43:56
nit: const
| |
702 chromeos::ArcKioskAppManager::Get() | |
703 ->current_app_was_auto_launched_with_zero_delay(); | |
704 if (regular_app_auto_launched_with_zero_delay || | |
705 arc_app_auto_launched_with_zero_delay) { | |
697 return account; | 706 return account; |
698 } | 707 } |
699 } | 708 } |
700 // No auto-launched kiosk session active. | 709 // No auto-launched kiosk session active. |
701 return std::unique_ptr<DeviceLocalAccount>(); | 710 return std::unique_ptr<DeviceLocalAccount>(); |
702 } | 711 } |
703 | 712 |
704 void DeviceStatusCollector::SampleResourceUsage() { | 713 void DeviceStatusCollector::SampleResourceUsage() { |
705 // Results must be written in the creation thread since that's where they | 714 // Results must be written in the creation thread since that's where they |
706 // are read from in the Get*StatusAsync methods. | 715 // are read from in the Get*StatusAsync methods. |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1251 | 1260 |
1252 void DeviceStatusCollector::OnOSVersion(const std::string& version) { | 1261 void DeviceStatusCollector::OnOSVersion(const std::string& version) { |
1253 os_version_ = version; | 1262 os_version_ = version; |
1254 } | 1263 } |
1255 | 1264 |
1256 void DeviceStatusCollector::OnOSFirmware(const std::string& version) { | 1265 void DeviceStatusCollector::OnOSFirmware(const std::string& version) { |
1257 firmware_version_ = version; | 1266 firmware_version_ = version; |
1258 } | 1267 } |
1259 | 1268 |
1260 } // namespace policy | 1269 } // namespace policy |
OLD | NEW |