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

Side by Side Diff: chrome/browser/chromeos/policy/device_status_collector.cc

Issue 2736903004: Add sound volume to device attribute reporting (Closed)
Patch Set: Simplified - bundling sound volume together with hardware status 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/device_status_collector_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 25 matching lines...) Expand all
36 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 36 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
37 #include "chrome/browser/chromeos/policy/device_local_account.h" 37 #include "chrome/browser/chromeos/policy/device_local_account.h"
38 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 38 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
39 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h" 39 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h"
40 #include "chrome/browser/chromeos/profiles/profile_helper.h" 40 #include "chrome/browser/chromeos/profiles/profile_helper.h"
41 #include "chrome/browser/chromeos/settings/cros_settings.h" 41 #include "chrome/browser/chromeos/settings/cros_settings.h"
42 #include "chrome/browser/policy/profile_policy_connector.h" 42 #include "chrome/browser/policy/profile_policy_connector.h"
43 #include "chrome/browser/policy/profile_policy_connector_factory.h" 43 #include "chrome/browser/policy/profile_policy_connector_factory.h"
44 #include "chrome/browser/profiles/profile_manager.h" 44 #include "chrome/browser/profiles/profile_manager.h"
45 #include "chrome/common/pref_names.h" 45 #include "chrome/common/pref_names.h"
46 #include "chromeos/audio/cras_audio_handler.h"
46 #include "chromeos/dbus/dbus_thread_manager.h" 47 #include "chromeos/dbus/dbus_thread_manager.h"
47 #include "chromeos/dbus/update_engine_client.h" 48 #include "chromeos/dbus/update_engine_client.h"
48 #include "chromeos/disks/disk_mount_manager.h" 49 #include "chromeos/disks/disk_mount_manager.h"
49 #include "chromeos/network/device_state.h" 50 #include "chromeos/network/device_state.h"
50 #include "chromeos/network/network_handler.h" 51 #include "chromeos/network/network_handler.h"
51 #include "chromeos/network/network_state.h" 52 #include "chromeos/network/network_state.h"
52 #include "chromeos/network/network_state_handler.h" 53 #include "chromeos/network/network_state_handler.h"
53 #include "chromeos/settings/cros_settings_names.h" 54 #include "chromeos/settings/cros_settings_names.h"
54 #include "chromeos/system/statistics_provider.h" 55 #include "chromeos/system/statistics_provider.h"
55 #include "components/arc/arc_bridge_service.h" 56 #include "components/arc/arc_bridge_service.h"
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 // Add CPU utilization and free RAM. Note that these stats are sampled in 983 // Add CPU utilization and free RAM. Note that these stats are sampled in
983 // regular intervals. Unlike CPU temp and volume info these are not one-time 984 // regular intervals. Unlike CPU temp and volume info these are not one-time
984 // sampled values, hence the difference in logic. 985 // sampled values, hence the difference in logic.
985 status->set_system_ram_total(base::SysInfo::AmountOfPhysicalMemory()); 986 status->set_system_ram_total(base::SysInfo::AmountOfPhysicalMemory());
986 status->clear_system_ram_free(); 987 status->clear_system_ram_free();
987 status->clear_cpu_utilization_pct(); 988 status->clear_cpu_utilization_pct();
988 for (const ResourceUsage& usage : resource_usage_) { 989 for (const ResourceUsage& usage : resource_usage_) {
989 status->add_cpu_utilization_pct(usage.cpu_usage_percent); 990 status->add_cpu_utilization_pct(usage.cpu_usage_percent);
990 status->add_system_ram_free(usage.bytes_of_ram_free); 991 status->add_system_ram_free(usage.bytes_of_ram_free);
991 } 992 }
993
994 // Get the current device sound volume level.
995 chromeos::CrasAudioHandler* audio_handler = chromeos::CrasAudioHandler::Get();
996 status->set_sound_volume(audio_handler->GetOutputVolumePercent());
997
992 return true; 998 return true;
993 } 999 }
994 1000
995 bool DeviceStatusCollector::GetOsUpdateStatus( 1001 bool DeviceStatusCollector::GetOsUpdateStatus(
996 em::DeviceStatusReportRequest* status) { 1002 em::DeviceStatusReportRequest* status) {
997 const base::Version platform_version(GetPlatformVersion()); 1003 const base::Version platform_version(GetPlatformVersion());
998 if (!platform_version.IsValid()) 1004 if (!platform_version.IsValid())
999 return false; 1005 return false;
1000 1006
1001 const std::string required_platform_version_string = 1007 const std::string required_platform_version_string =
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 1251
1246 void DeviceStatusCollector::OnOSVersion(const std::string& version) { 1252 void DeviceStatusCollector::OnOSVersion(const std::string& version) {
1247 os_version_ = version; 1253 os_version_ = version;
1248 } 1254 }
1249 1255
1250 void DeviceStatusCollector::OnOSFirmware(const std::string& version) { 1256 void DeviceStatusCollector::OnOSFirmware(const std::string& version) {
1251 firmware_version_ = version; 1257 firmware_version_ = version;
1252 } 1258 }
1253 1259
1254 } // namespace policy 1260 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/device_status_collector_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698