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()) | |
Luis Héctor Chávez
2017/03/17 17:46:54
nit: add braces.
re: style guide, I think it's on
Ivan Šandrk
2017/03/20 13:22:58
Done. I'm just wondering what's the reasoning on t
Luis Héctor Chávez
2017/03/20 15:09:16
The rule for eliding braces is that all statements
| |
257 return std::unique_ptr<policy::DeviceLocalAccount>(); | 259 return std::unique_ptr<policy::DeviceLocalAccount>(); |
258 const user_manager::User* const user = | 260 const user_manager::User* const user = |
259 user_manager::UserManager::Get()->GetActiveUser(); | 261 user_manager::UserManager::Get()->GetActiveUser(); |
260 const std::vector<policy::DeviceLocalAccount> accounts = | 262 const std::vector<policy::DeviceLocalAccount> accounts = |
261 policy::GetDeviceLocalAccounts(settings); | 263 policy::GetDeviceLocalAccounts(settings); |
262 | 264 |
263 for (const auto& device_local_account : accounts) { | 265 for (const auto& device_local_account : accounts) { |
264 if (AccountId::FromUserEmail(device_local_account.user_id) == | 266 if (AccountId::FromUserEmail(device_local_account.user_id) == |
265 user->GetAccountId()) { | 267 user->GetAccountId()) { |
266 return base::MakeUnique<policy::DeviceLocalAccount>(device_local_account); | 268 return base::MakeUnique<policy::DeviceLocalAccount>(device_local_account); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
684 } | 686 } |
685 last_idle_check_ = now; | 687 last_idle_check_ = now; |
686 } | 688 } |
687 | 689 |
688 std::unique_ptr<DeviceLocalAccount> | 690 std::unique_ptr<DeviceLocalAccount> |
689 DeviceStatusCollector::GetAutoLaunchedKioskSessionInfo() { | 691 DeviceStatusCollector::GetAutoLaunchedKioskSessionInfo() { |
690 std::unique_ptr<DeviceLocalAccount> account = | 692 std::unique_ptr<DeviceLocalAccount> account = |
691 GetCurrentKioskDeviceLocalAccount(cros_settings_); | 693 GetCurrentKioskDeviceLocalAccount(cros_settings_); |
692 if (account) { | 694 if (account) { |
693 chromeos::KioskAppManager::App current_app; | 695 chromeos::KioskAppManager::App current_app; |
694 if (chromeos::KioskAppManager::Get()->GetApp(account->kiosk_app_id, | 696 if ((chromeos::KioskAppManager::Get()->GetApp(account->kiosk_app_id, |
695 ¤t_app) && | 697 ¤t_app) && |
696 current_app.was_auto_launched_with_zero_delay) { | 698 current_app.was_auto_launched_with_zero_delay) || |
699 chromeos::ArcKioskAppManager::Get()-> | |
700 CurrentAppWasAutoLaunchedWithZeroDelay()) { | |
697 return account; | 701 return account; |
698 } | 702 } |
699 } | 703 } |
700 // No auto-launched kiosk session active. | 704 // No auto-launched kiosk session active. |
701 return std::unique_ptr<DeviceLocalAccount>(); | 705 return std::unique_ptr<DeviceLocalAccount>(); |
702 } | 706 } |
703 | 707 |
704 void DeviceStatusCollector::SampleResourceUsage() { | 708 void DeviceStatusCollector::SampleResourceUsage() { |
705 // Results must be written in the creation thread since that's where they | 709 // Results must be written in the creation thread since that's where they |
706 // are read from in the Get*StatusAsync methods. | 710 // are read from in the Get*StatusAsync methods. |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1251 | 1255 |
1252 void DeviceStatusCollector::OnOSVersion(const std::string& version) { | 1256 void DeviceStatusCollector::OnOSVersion(const std::string& version) { |
1253 os_version_ = version; | 1257 os_version_ = version; |
1254 } | 1258 } |
1255 | 1259 |
1256 void DeviceStatusCollector::OnOSFirmware(const std::string& version) { | 1260 void DeviceStatusCollector::OnOSFirmware(const std::string& version) { |
1257 firmware_version_ = version; | 1261 firmware_version_ = version; |
1258 } | 1262 } |
1259 | 1263 |
1260 } // namespace policy | 1264 } // namespace policy |
OLD | NEW |