Chromium Code Reviews| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <sys/statvfs.h> | 9 #include <sys/statvfs.h> |
| 10 | 10 |
| 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/location.h" | 13 #include "base/location.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/posix/eintr_wrapper.h" | 16 #include "base/posix/eintr_wrapper.h" |
| 17 #include "base/prefs/pref_registry_simple.h" | 17 #include "base/prefs/pref_registry_simple.h" |
| 18 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
| 19 #include "base/prefs/scoped_user_pref_update.h" | 19 #include "base/prefs/scoped_user_pref_update.h" |
| 20 #include "base/process/process.h" | 20 #include "base/process/process.h" |
| 21 #include "base/process/process_iterator.h" | 21 #include "base/process/process_iterator.h" |
| 22 #include "base/process/process_metrics.h" | 22 #include "base/process/process_metrics.h" |
| 23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/sys_info.h" | 24 #include "base/sys_info.h" |
| 25 #include "base/task_runner_util.h" | 25 #include "base/task_runner_util.h" |
| 26 #include "base/values.h" | 26 #include "base/values.h" |
| 27 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
| 28 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | |
| 28 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 29 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 30 #include "chrome/browser/chromeos/policy/device_local_account.h" | |
| 31 #include "chrome/browser/chromeos/profiles/profile_helper.h" | |
| 29 #include "chrome/browser/chromeos/settings/cros_settings.h" | 32 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 30 #include "chrome/common/chrome_version_info.h" | 33 #include "chrome/common/chrome_version_info.h" |
| 31 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 32 #include "chromeos/disks/disk_mount_manager.h" | 35 #include "chromeos/disks/disk_mount_manager.h" |
| 33 #include "chromeos/network/device_state.h" | 36 #include "chromeos/network/device_state.h" |
| 34 #include "chromeos/network/network_handler.h" | 37 #include "chromeos/network/network_handler.h" |
| 35 #include "chromeos/network/network_state.h" | 38 #include "chromeos/network/network_state.h" |
| 36 #include "chromeos/network/network_state_handler.h" | 39 #include "chromeos/network/network_state_handler.h" |
| 37 #include "chromeos/settings/cros_settings_names.h" | 40 #include "chromeos/settings/cros_settings_names.h" |
| 38 #include "chromeos/system/statistics_provider.h" | 41 #include "chromeos/system/statistics_provider.h" |
| 39 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 42 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 40 #include "components/user_manager/user_manager.h" | 43 #include "components/user_manager/user_manager.h" |
| 41 #include "components/user_manager/user_type.h" | 44 #include "components/user_manager/user_type.h" |
| 42 #include "content/public/browser/browser_thread.h" | 45 #include "content/public/browser/browser_thread.h" |
| 46 #include "extensions/browser/extension_registry.h" | |
| 47 #include "extensions/common/extension.h" | |
| 43 #include "policy/proto/device_management_backend.pb.h" | 48 #include "policy/proto/device_management_backend.pb.h" |
| 44 #include "third_party/cros_system_api/dbus/service_constants.h" | 49 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 45 | 50 |
| 46 using base::Time; | 51 using base::Time; |
| 47 using base::TimeDelta; | 52 using base::TimeDelta; |
| 48 | 53 |
| 49 namespace em = enterprise_management; | 54 namespace em = enterprise_management; |
| 50 | 55 |
| 51 namespace { | 56 namespace { |
| 52 // How many seconds of inactivity triggers the idle state. | 57 // How many seconds of inactivity triggers the idle state. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 info.set_storage_free(static_cast<uint64_t>(stat.f_bavail) * | 104 info.set_storage_free(static_cast<uint64_t>(stat.f_bavail) * |
| 100 stat.f_frsize); | 105 stat.f_frsize); |
| 101 result.push_back(info); | 106 result.push_back(info); |
| 102 } else { | 107 } else { |
| 103 LOG(ERROR) << "Unable to get volume status for " << mount_point; | 108 LOG(ERROR) << "Unable to get volume status for " << mount_point; |
| 104 } | 109 } |
| 105 } | 110 } |
| 106 return result; | 111 return result; |
| 107 } | 112 } |
| 108 | 113 |
| 114 bool GetCurrentDeviceLocalAccount(chromeos::CrosSettings* settings, | |
|
bartfab (slow)
2015/02/11 17:28:43
Nit: The name does not match what the method actua
Andrew T Wilson (Slow)
2015/02/12 15:15:38
Done.
Andrew T Wilson (Slow)
2015/02/12 15:15:39
Changed name to clarify the behavior and added a c
| |
| 115 policy::DeviceLocalAccount* account) { | |
| 116 if (!user_manager::UserManager::Get()->IsLoggedInAsKioskApp()) | |
| 117 return false; | |
| 118 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); | |
|
bartfab (slow)
2015/02/11 17:28:43
Nit: s/user_manager::User*/const user_manager::Use
Andrew T Wilson (Slow)
2015/02/12 15:15:38
Done.
| |
| 119 std::string user_id = user->GetUserID(); | |
|
bartfab (slow)
2015/02/11 17:28:43
Nit: const.
Andrew T Wilson (Slow)
2015/02/12 15:15:38
Done.
| |
| 120 std::vector<policy::DeviceLocalAccount> accounts = | |
|
bartfab (slow)
2015/02/11 17:28:43
Nit: const.
| |
| 121 policy::GetDeviceLocalAccounts(settings); | |
|
bartfab (slow)
2015/02/11 17:28:43
It is possible to remove a device-local account fr
Andrew T Wilson (Slow)
2015/02/12 15:15:38
OK, good to know. I've changed the NOTREACHED into
Andrew T Wilson (Slow)
2015/02/13 13:59:59
BTW, not using the policy broker because it's basi
bartfab (slow)
2015/02/16 13:30:33
The one advantage of going via the broker is that
| |
| 122 | |
| 123 for (auto device_account : accounts) { | |
|
bartfab (slow)
2015/02/11 17:28:43
Nit 1: s/device_account/device_local_account/ or s
Andrew T Wilson (Slow)
2015/02/12 15:15:38
Done.
| |
| 124 if (device_account.user_id == user_id) { | |
| 125 *account = device_account; | |
| 126 return true; | |
| 127 } | |
| 128 } | |
| 129 NOTREACHED() << "Kiosk app user not found in list of local accounts"; | |
|
bartfab (slow)
2015/02/11 17:28:43
Nit: s/local/device-local/
Andrew T Wilson (Slow)
2015/02/12 15:15:38
Done.
| |
| 130 return false; | |
| 131 } | |
| 132 | |
| 109 } // namespace | 133 } // namespace |
| 110 | 134 |
| 111 namespace policy { | 135 namespace policy { |
| 112 | 136 |
| 113 DeviceStatusCollector::DeviceStatusCollector( | 137 DeviceStatusCollector::DeviceStatusCollector( |
| 114 PrefService* local_state, | 138 PrefService* local_state, |
| 115 chromeos::system::StatisticsProvider* provider, | 139 chromeos::system::StatisticsProvider* provider, |
| 116 const LocationUpdateRequester& location_update_requester, | 140 const LocationUpdateRequester& location_update_requester, |
| 117 const VolumeInfoFetcher& volume_info_fetcher) | 141 const VolumeInfoFetcher& volume_info_fetcher) |
| 118 : max_stored_past_activity_days_(kMaxStoredPastActivityDays), | 142 : max_stored_past_activity_days_(kMaxStoredPastActivityDays), |
| 119 max_stored_future_activity_days_(kMaxStoredFutureActivityDays), | 143 max_stored_future_activity_days_(kMaxStoredFutureActivityDays), |
| 120 local_state_(local_state), | 144 local_state_(local_state), |
| 121 last_idle_check_(Time()), | 145 last_idle_check_(Time()), |
| 122 last_reported_day_(0), | 146 last_reported_day_(0), |
| 123 duration_for_last_reported_day_(0), | 147 duration_for_last_reported_day_(0), |
| 124 geolocation_update_in_progress_(false), | 148 geolocation_update_in_progress_(false), |
| 125 volume_info_fetcher_(volume_info_fetcher), | 149 volume_info_fetcher_(volume_info_fetcher), |
| 126 statistics_provider_(provider), | 150 statistics_provider_(provider), |
| 127 location_update_requester_(location_update_requester), | 151 location_update_requester_(location_update_requester), |
| 128 report_version_info_(false), | 152 report_version_info_(false), |
| 129 report_activity_times_(false), | 153 report_activity_times_(false), |
| 130 report_boot_mode_(false), | 154 report_boot_mode_(false), |
| 131 report_location_(false), | 155 report_location_(false), |
| 132 report_network_interfaces_(false), | 156 report_network_interfaces_(false), |
| 133 report_users_(false), | 157 report_users_(false), |
| 134 report_hardware_status_(false), | 158 report_hardware_status_(false), |
| 159 report_session_status_(false), | |
| 135 weak_factory_(this) { | 160 weak_factory_(this) { |
| 136 if (volume_info_fetcher_.is_null()) | 161 if (volume_info_fetcher_.is_null()) |
| 137 volume_info_fetcher_ = base::Bind(&GetVolumeInfo); | 162 volume_info_fetcher_ = base::Bind(&GetVolumeInfo); |
| 138 | 163 |
| 139 idle_poll_timer_.Start(FROM_HERE, | 164 idle_poll_timer_.Start(FROM_HERE, |
| 140 TimeDelta::FromSeconds(kIdlePollIntervalSeconds), | 165 TimeDelta::FromSeconds(kIdlePollIntervalSeconds), |
| 141 this, &DeviceStatusCollector::CheckIdleState); | 166 this, &DeviceStatusCollector::CheckIdleState); |
| 142 hardware_status_sampling_timer_.Start( | 167 hardware_status_sampling_timer_.Start( |
| 143 FROM_HERE, | 168 FROM_HERE, |
| 144 TimeDelta::FromSeconds(kHardwareStatusSampleIntervalSeconds), | 169 TimeDelta::FromSeconds(kHardwareStatusSampleIntervalSeconds), |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 159 boot_mode_subscription_ = cros_settings_->AddSettingsObserver( | 184 boot_mode_subscription_ = cros_settings_->AddSettingsObserver( |
| 160 chromeos::kReportDeviceBootMode, callback); | 185 chromeos::kReportDeviceBootMode, callback); |
| 161 location_subscription_ = cros_settings_->AddSettingsObserver( | 186 location_subscription_ = cros_settings_->AddSettingsObserver( |
| 162 chromeos::kReportDeviceLocation, callback); | 187 chromeos::kReportDeviceLocation, callback); |
| 163 network_interfaces_subscription_ = cros_settings_->AddSettingsObserver( | 188 network_interfaces_subscription_ = cros_settings_->AddSettingsObserver( |
| 164 chromeos::kReportDeviceNetworkInterfaces, callback); | 189 chromeos::kReportDeviceNetworkInterfaces, callback); |
| 165 users_subscription_ = cros_settings_->AddSettingsObserver( | 190 users_subscription_ = cros_settings_->AddSettingsObserver( |
| 166 chromeos::kReportDeviceUsers, callback); | 191 chromeos::kReportDeviceUsers, callback); |
| 167 hardware_status_subscription_ = cros_settings_->AddSettingsObserver( | 192 hardware_status_subscription_ = cros_settings_->AddSettingsObserver( |
| 168 chromeos::kReportDeviceHardwareStatus, callback); | 193 chromeos::kReportDeviceHardwareStatus, callback); |
| 194 session_status_subscription_ = cros_settings_->AddSettingsObserver( | |
| 195 chromeos::kReportDeviceSessionStatus, callback); | |
| 169 | 196 |
| 170 // The last known location is persisted in local state. This makes location | 197 // The last known location is persisted in local state. This makes location |
| 171 // information available immediately upon startup and avoids the need to | 198 // information available immediately upon startup and avoids the need to |
| 172 // reacquire the location on every user session change or browser crash. | 199 // reacquire the location on every user session change or browser crash. |
| 173 content::Geoposition position; | 200 content::Geoposition position; |
| 174 std::string timestamp_str; | 201 std::string timestamp_str; |
| 175 int64 timestamp; | 202 int64 timestamp; |
| 176 const base::DictionaryValue* location = | 203 const base::DictionaryValue* location = |
| 177 local_state_->GetDictionary(prefs::kDeviceLocation); | 204 local_state_->GetDictionary(prefs::kDeviceLocation); |
| 178 if (location->GetDouble(kLatitude, &position.latitude) && | 205 if (location->GetDouble(kLatitude, &position.latitude) && |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 // back when they are available. | 257 // back when they are available. |
| 231 if (chromeos::CrosSettingsProvider::TRUSTED != | 258 if (chromeos::CrosSettingsProvider::TRUSTED != |
| 232 cros_settings_->PrepareTrustedValues( | 259 cros_settings_->PrepareTrustedValues( |
| 233 base::Bind(&DeviceStatusCollector::UpdateReportingSettings, | 260 base::Bind(&DeviceStatusCollector::UpdateReportingSettings, |
| 234 weak_factory_.GetWeakPtr()))) { | 261 weak_factory_.GetWeakPtr()))) { |
| 235 return; | 262 return; |
| 236 } | 263 } |
| 237 | 264 |
| 238 // All reporting settings default to 'enabled'. | 265 // All reporting settings default to 'enabled'. |
| 239 if (!cros_settings_->GetBoolean( | 266 if (!cros_settings_->GetBoolean( |
| 240 chromeos::kReportDeviceVersionInfo, &report_version_info_)) { | 267 chromeos::kReportDeviceVersionInfo, &report_version_info_)) { |
| 241 report_version_info_ = true; | 268 report_version_info_ = true; |
| 242 } | 269 } |
| 243 if (!cros_settings_->GetBoolean( | 270 if (!cros_settings_->GetBoolean( |
| 244 chromeos::kReportDeviceActivityTimes, &report_activity_times_)) { | 271 chromeos::kReportDeviceActivityTimes, &report_activity_times_)) { |
| 245 report_activity_times_ = true; | 272 report_activity_times_ = true; |
| 246 } | 273 } |
| 247 if (!cros_settings_->GetBoolean( | 274 if (!cros_settings_->GetBoolean( |
| 248 chromeos::kReportDeviceBootMode, &report_boot_mode_)) { | 275 chromeos::kReportDeviceBootMode, &report_boot_mode_)) { |
| 249 report_boot_mode_ = true; | 276 report_boot_mode_ = true; |
| 250 } | 277 } |
| 251 if (!cros_settings_->GetBoolean( | 278 if (!cros_settings_->GetBoolean( |
| 252 chromeos::kReportDeviceNetworkInterfaces, &report_network_interfaces_)) { | 279 chromeos::kReportDeviceNetworkInterfaces, |
| 280 &report_network_interfaces_)) { | |
| 253 report_network_interfaces_ = true; | 281 report_network_interfaces_ = true; |
| 254 } | 282 } |
| 255 if (!cros_settings_->GetBoolean( | 283 if (!cros_settings_->GetBoolean( |
| 256 chromeos::kReportDeviceUsers, &report_users_)) { | 284 chromeos::kReportDeviceUsers, &report_users_)) { |
| 257 report_users_ = true; | 285 report_users_ = true; |
| 258 } | 286 } |
| 259 | 287 |
| 260 const bool already_reporting_hardware_status = report_hardware_status_; | 288 const bool already_reporting_hardware_status = report_hardware_status_; |
| 261 if (!cros_settings_->GetBoolean( | 289 if (!cros_settings_->GetBoolean( |
| 262 chromeos::kReportDeviceHardwareStatus, &report_hardware_status_)) { | 290 chromeos::kReportDeviceHardwareStatus, &report_hardware_status_)) { |
| 263 report_hardware_status_ = true; | 291 report_hardware_status_ = true; |
| 264 } | 292 } |
| 265 | 293 |
| 294 if (!cros_settings_->GetBoolean( | |
| 295 chromeos::kReportDeviceSessionStatus, &report_session_status_)) { | |
| 296 report_session_status_ = true; | |
| 297 } | |
| 298 | |
| 266 // Device location reporting is disabled by default because it is | 299 // Device location reporting is disabled by default because it is |
| 267 // not launched yet. | 300 // not launched yet. |
| 268 if (!cros_settings_->GetBoolean( | 301 if (!cros_settings_->GetBoolean( |
| 269 chromeos::kReportDeviceLocation, &report_location_)) { | 302 chromeos::kReportDeviceLocation, &report_location_)) { |
| 270 report_location_ = false; | 303 report_location_ = false; |
| 271 } | 304 } |
| 272 | 305 |
| 273 if (report_location_) { | 306 if (report_location_) { |
| 274 ScheduleGeolocationUpdateRequest(); | 307 ScheduleGeolocationUpdateRequest(); |
| 275 } else { | 308 } else { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 } else { | 408 } else { |
| 376 AddActivePeriod(last_idle_check_, now); | 409 AddActivePeriod(last_idle_check_, now); |
| 377 } | 410 } |
| 378 | 411 |
| 379 PruneStoredActivityPeriods(now); | 412 PruneStoredActivityPeriods(now); |
| 380 } | 413 } |
| 381 last_idle_check_ = now; | 414 last_idle_check_ = now; |
| 382 } | 415 } |
| 383 | 416 |
| 384 bool DeviceStatusCollector::IsAutoLaunchedKioskSession() { | 417 bool DeviceStatusCollector::IsAutoLaunchedKioskSession() { |
| 385 // TODO(atwilson): Determine if the currently active session is an | 418 DeviceLocalAccount account(DeviceLocalAccount::TYPE_KIOSK_APP); |
|
bartfab (slow)
2015/02/11 17:28:43
I think this implementation can be improved. The l
Andrew T Wilson (Slow)
2015/02/12 15:15:39
Done.
| |
| 386 // autolaunched kiosk session (http://crbug.com/452968). | 419 // If no kiosk app is currently running, exit. |
| 387 return false; | 420 if (!GetCurrentDeviceLocalAccount(cros_settings_, &account)) |
| 421 return false; | |
| 422 chromeos::KioskAppManager::App current_app; | |
| 423 if (!chromeos::KioskAppManager::Get()->GetApp(account.kiosk_app_id, | |
| 424 ¤t_app)) { | |
| 425 return false; | |
|
bartfab (slow)
2015/02/11 17:28:43
Is this not a NOTREACHED() case?
Andrew T Wilson (Slow)
2015/02/12 15:15:38
Done.
| |
| 426 } | |
| 427 return current_app.was_auto_launched_with_zero_delay; | |
| 388 } | 428 } |
| 389 | 429 |
| 390 void DeviceStatusCollector::SampleHardwareStatus() { | 430 void DeviceStatusCollector::SampleHardwareStatus() { |
| 391 // If hardware reporting has been disabled, do nothing here. | 431 // If hardware reporting has been disabled, do nothing here. |
| 392 if (!report_hardware_status_) | 432 if (!report_hardware_status_) |
| 393 return; | 433 return; |
| 394 | 434 |
| 395 // Create list of mounted disk volumes to query status. | 435 // Create list of mounted disk volumes to query status. |
| 396 std::vector<std::string> mount_points; | 436 std::vector<std::string> mount_points; |
| 397 for (const auto& mount_info : | 437 for (const auto& mount_info : |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 686 | 726 |
| 687 if (report_boot_mode_) | 727 if (report_boot_mode_) |
| 688 GetBootMode(status); | 728 GetBootMode(status); |
| 689 | 729 |
| 690 if (report_location_) | 730 if (report_location_) |
| 691 GetLocation(status); | 731 GetLocation(status); |
| 692 | 732 |
| 693 if (report_network_interfaces_) | 733 if (report_network_interfaces_) |
| 694 GetNetworkInterfaces(status); | 734 GetNetworkInterfaces(status); |
| 695 | 735 |
| 696 if (report_users_) { | 736 if (report_users_) |
| 697 GetUsers(status); | 737 GetUsers(status); |
| 698 } | |
| 699 | 738 |
| 700 if (report_hardware_status_) | 739 if (report_hardware_status_) |
| 701 GetHardwareStatus(status); | 740 GetHardwareStatus(status); |
| 702 | 741 |
| 703 return (report_activity_times_ || | 742 return (report_activity_times_ || |
| 704 report_version_info_ || | 743 report_version_info_ || |
| 705 report_boot_mode_ || | 744 report_boot_mode_ || |
| 706 report_location_ || | 745 report_location_ || |
| 707 report_network_interfaces_ || | 746 report_network_interfaces_ || |
| 708 report_users_ || | 747 report_users_ || |
| 709 report_hardware_status_); | 748 report_hardware_status_); |
| 710 } | 749 } |
| 711 | 750 |
| 712 bool DeviceStatusCollector::GetDeviceSessionStatus( | 751 bool DeviceStatusCollector::GetDeviceSessionStatus( |
| 713 em::SessionStatusReportRequest* status) { | 752 em::SessionStatusReportRequest* status) { |
| 714 return false; | 753 // Only generate session status reports if session status reporting is |
| 754 // enabled, and we are in an auto-launched kiosk session. | |
| 755 if (!report_session_status_ || !IsAutoLaunchedKioskSession()) | |
| 756 return false; | |
| 757 | |
| 758 // Get the account ID associated with this user. | |
| 759 DeviceLocalAccount account(DeviceLocalAccount::TYPE_KIOSK_APP); | |
| 760 if (!GetCurrentDeviceLocalAccount(cros_settings_, &account)) | |
|
bartfab (slow)
2015/02/11 17:28:43
You are doing all this fetching, parsing and searc
Andrew T Wilson (Slow)
2015/02/12 15:15:38
Done. This cascaded into a yak shave that impacted
| |
| 761 return false; | |
| 762 status->set_device_local_account_id(account.account_id); | |
| 763 em::AppStatus* app_status = status->add_installed_apps(); | |
| 764 app_status->set_app_id(account.kiosk_app_id); | |
| 765 | |
| 766 // Look up the app and get the version. | |
| 767 std::string app_version = GetAppVersion(account.kiosk_app_id); | |
|
bartfab (slow)
2015/02/11 17:28:43
Nit: const.
Andrew T Wilson (Slow)
2015/02/12 15:15:39
Done.
| |
| 768 if (app_version.empty()) { | |
| 769 DLOG(ERROR) << "Unable to get version for extension: " | |
| 770 << account.kiosk_app_id; | |
| 771 } else { | |
| 772 app_status->set_extension_version(app_version); | |
| 773 } | |
| 774 return true; | |
| 775 } | |
| 776 | |
| 777 std::string DeviceStatusCollector::GetAppVersion(std::string kiosk_app_id) { | |
| 778 Profile* profile = chromeos::ProfileHelper::Get()->GetProfileByUser( | |
| 779 user_manager::UserManager::Get()->GetActiveUser()); | |
| 780 extensions::ExtensionRegistry* registry = | |
| 781 extensions::ExtensionRegistry::Get(profile); | |
| 782 const extensions::Extension* extension = registry->GetExtensionById( | |
| 783 kiosk_app_id, extensions::ExtensionRegistry::EVERYTHING); | |
| 784 if (!extension) | |
| 785 return std::string(); | |
| 786 return extension->VersionString(); | |
| 715 } | 787 } |
| 716 | 788 |
| 717 void DeviceStatusCollector::OnSubmittedSuccessfully() { | 789 void DeviceStatusCollector::OnSubmittedSuccessfully() { |
| 718 TrimStoredActivityPeriods(last_reported_day_, duration_for_last_reported_day_, | 790 TrimStoredActivityPeriods(last_reported_day_, duration_for_last_reported_day_, |
| 719 std::numeric_limits<int64>::max()); | 791 std::numeric_limits<int64>::max()); |
| 720 } | 792 } |
| 721 | 793 |
| 722 void DeviceStatusCollector::OnOSVersion(const std::string& version) { | 794 void DeviceStatusCollector::OnOSVersion(const std::string& version) { |
| 723 os_version_ = version; | 795 os_version_ = version; |
| 724 } | 796 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 785 ScheduleGeolocationUpdateRequest(); | 857 ScheduleGeolocationUpdateRequest(); |
| 786 } | 858 } |
| 787 | 859 |
| 788 void DeviceStatusCollector::ReceiveVolumeInfo( | 860 void DeviceStatusCollector::ReceiveVolumeInfo( |
| 789 const std::vector<em::VolumeInfo>& info) { | 861 const std::vector<em::VolumeInfo>& info) { |
| 790 if (report_hardware_status_) | 862 if (report_hardware_status_) |
| 791 volume_info_ = info; | 863 volume_info_ = info; |
| 792 } | 864 } |
| 793 | 865 |
| 794 } // namespace policy | 866 } // namespace policy |
| OLD | NEW |