OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/policy/device_management_service_configuration.h" | |
6 | |
7 #include "base/strings/stringprintf.h" | |
8 #include "base/sys_info.h" | |
9 #include "chrome/common/chrome_version_info.h" | |
10 #include "components/policy/core/browser/browser_policy_connector.h" | |
11 | |
12 #if defined(OS_CHROMEOS) | |
13 #include "chromeos/system/statistics_provider.h" | |
14 #endif | |
15 | |
16 namespace policy { | |
17 | |
18 DeviceManagementServiceConfiguration::~DeviceManagementServiceConfiguration() {} | |
19 | |
20 std::string DeviceManagementServiceConfiguration::GetServerUrl() { | |
21 return BrowserPolicyConnector::GetDeviceManagementUrl(); | |
Mattias Nissler (ping if slow)
2014/04/24 11:38:12
Can we just pass this in as a ctor parameter? That
davidyu
2014/04/25 01:45:40
Done.
| |
22 } | |
23 | |
24 std::string DeviceManagementServiceConfiguration::GetAgentParameter() { | |
25 chrome::VersionInfo version_info; | |
26 return base::StringPrintf("%s %s(%s)", | |
27 version_info.Name().c_str(), | |
28 version_info.Version().c_str(), | |
29 version_info.LastChange().c_str()); | |
30 } | |
31 | |
32 std::string DeviceManagementServiceConfiguration::GetPlatformParameter() { | |
33 std::string os_name = base::SysInfo::OperatingSystemName(); | |
34 std::string os_hardware = base::SysInfo::OperatingSystemArchitecture(); | |
35 | |
36 #if defined(OS_CHROMEOS) | |
37 chromeos::system::StatisticsProvider* provider = | |
38 chromeos::system::StatisticsProvider::GetInstance(); | |
39 | |
40 std::string hwclass; | |
41 if (!provider->GetMachineStatistic(chromeos::system::kHardwareClassKey, | |
42 &hwclass)) { | |
43 LOG(ERROR) << "Failed to get machine information"; | |
44 } | |
45 os_name += ",CrOS," + base::SysInfo::GetLsbReleaseBoard(); | |
46 os_hardware += "," + hwclass; | |
47 #endif | |
48 | |
49 std::string os_version("-"); | |
50 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) | |
51 int32 os_major_version = 0; | |
52 int32 os_minor_version = 0; | |
53 int32 os_bugfix_version = 0; | |
54 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, | |
55 &os_minor_version, | |
56 &os_bugfix_version); | |
57 os_version = base::StringPrintf("%d.%d.%d", | |
58 os_major_version, | |
59 os_minor_version, | |
60 os_bugfix_version); | |
61 #endif | |
62 | |
63 return base::StringPrintf( | |
64 "%s|%s|%s", os_name.c_str(), os_hardware.c_str(), os_version.c_str()); | |
65 } | |
66 | |
67 } // namespace policy | |
OLD | NEW |