| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/policy/device_management_service_configuration.h" | 5 #include "chrome/browser/policy/device_management_service_configuration.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| 11 #include "chrome/common/chrome_version_info.h" | |
| 12 #include "components/policy/core/browser/browser_policy_connector.h" | 11 #include "components/policy/core/browser/browser_policy_connector.h" |
| 12 #include "components/version_info/version_info.h" |
| 13 | 13 |
| 14 #if defined(OS_CHROMEOS) | 14 #if defined(OS_CHROMEOS) |
| 15 #include "chromeos/system/statistics_provider.h" | 15 #include "chromeos/system/statistics_provider.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 namespace policy { | 18 namespace policy { |
| 19 | 19 |
| 20 DeviceManagementServiceConfiguration::DeviceManagementServiceConfiguration( | 20 DeviceManagementServiceConfiguration::DeviceManagementServiceConfiguration( |
| 21 const std::string& server_url) | 21 const std::string& server_url) |
| 22 : server_url_(server_url) { | 22 : server_url_(server_url) { |
| 23 } | 23 } |
| 24 | 24 |
| 25 DeviceManagementServiceConfiguration::~DeviceManagementServiceConfiguration() { | 25 DeviceManagementServiceConfiguration::~DeviceManagementServiceConfiguration() { |
| 26 } | 26 } |
| 27 | 27 |
| 28 std::string DeviceManagementServiceConfiguration::GetServerUrl() { | 28 std::string DeviceManagementServiceConfiguration::GetServerUrl() { |
| 29 return server_url_; | 29 return server_url_; |
| 30 } | 30 } |
| 31 | 31 |
| 32 std::string DeviceManagementServiceConfiguration::GetAgentParameter() { | 32 std::string DeviceManagementServiceConfiguration::GetAgentParameter() { |
| 33 chrome::VersionInfo version_info; | |
| 34 return base::StringPrintf("%s %s(%s)", | 33 return base::StringPrintf("%s %s(%s)", |
| 35 version_info.Name().c_str(), | 34 version_info::GetProductName().c_str(), |
| 36 version_info.Version().c_str(), | 35 version_info::GetVersionNumber().c_str(), |
| 37 version_info.LastChange().c_str()); | 36 version_info::GetLastChange().c_str()); |
| 38 } | 37 } |
| 39 | 38 |
| 40 std::string DeviceManagementServiceConfiguration::GetPlatformParameter() { | 39 std::string DeviceManagementServiceConfiguration::GetPlatformParameter() { |
| 41 std::string os_name = base::SysInfo::OperatingSystemName(); | 40 std::string os_name = base::SysInfo::OperatingSystemName(); |
| 42 std::string os_hardware = base::SysInfo::OperatingSystemArchitecture(); | 41 std::string os_hardware = base::SysInfo::OperatingSystemArchitecture(); |
| 43 | 42 |
| 44 #if defined(OS_CHROMEOS) | 43 #if defined(OS_CHROMEOS) |
| 45 chromeos::system::StatisticsProvider* provider = | 44 chromeos::system::StatisticsProvider* provider = |
| 46 chromeos::system::StatisticsProvider::GetInstance(); | 45 chromeos::system::StatisticsProvider::GetInstance(); |
| 47 | 46 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 66 os_major_version, | 65 os_major_version, |
| 67 os_minor_version, | 66 os_minor_version, |
| 68 os_bugfix_version); | 67 os_bugfix_version); |
| 69 #endif | 68 #endif |
| 70 | 69 |
| 71 return base::StringPrintf( | 70 return base::StringPrintf( |
| 72 "%s|%s|%s", os_name.c_str(), os_hardware.c_str(), os_version.c_str()); | 71 "%s|%s|%s", os_name.c_str(), os_hardware.c_str(), os_version.c_str()); |
| 73 } | 72 } |
| 74 | 73 |
| 75 } // namespace policy | 74 } // namespace policy |
| OLD | NEW |