| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_backend_impl.h" | 5 #include "chrome/browser/policy/device_management_backend_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 10 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 11 #include <sys/utsname.h> | 11 #include <sys/utsname.h> |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
| 15 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
| 16 #include "chrome/browser/policy/device_management_service.h" | 16 #include "chrome/browser/policy/device_management_service.h" |
| 17 #include "chrome/common/chrome_version_info.h" | 17 #include "chrome/common/chrome_version_info.h" |
| 18 #include "net/base/escape.h" | 18 #include "net/base/escape.h" |
| 19 #include "net/url_request/url_request_status.h" | 19 #include "net/url_request/url_request_status.h" |
| 20 | 20 |
| 21 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
| 22 #include "chrome/browser/chromeos/system_access.h" | 22 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 namespace policy { | 25 namespace policy { |
| 26 | 26 |
| 27 // Name constants for URL query parameters. | 27 // Name constants for URL query parameters. |
| 28 const char DeviceManagementBackendImpl::kParamRequest[] = "request"; | 28 const char DeviceManagementBackendImpl::kParamRequest[] = "request"; |
| 29 const char DeviceManagementBackendImpl::kParamDeviceType[] = "devicetype"; | 29 const char DeviceManagementBackendImpl::kParamDeviceType[] = "devicetype"; |
| 30 const char DeviceManagementBackendImpl::kParamAppType[] = "apptype"; | 30 const char DeviceManagementBackendImpl::kParamAppType[] = "apptype"; |
| 31 const char DeviceManagementBackendImpl::kParamDeviceID[] = "deviceid"; | 31 const char DeviceManagementBackendImpl::kParamDeviceID[] = "deviceid"; |
| 32 const char DeviceManagementBackendImpl::kParamAgent[] = "agent"; | 32 const char DeviceManagementBackendImpl::kParamAgent[] = "agent"; |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 413 |
| 414 std::string DeviceManagementBackendImpl::GetPlatformString() { | 414 std::string DeviceManagementBackendImpl::GetPlatformString() { |
| 415 static std::string platform; | 415 static std::string platform; |
| 416 if (!platform.empty()) | 416 if (!platform.empty()) |
| 417 return platform; | 417 return platform; |
| 418 | 418 |
| 419 std::string os_name(base::SysInfo::OperatingSystemName()); | 419 std::string os_name(base::SysInfo::OperatingSystemName()); |
| 420 std::string os_hardware(base::SysInfo::CPUArchitecture()); | 420 std::string os_hardware(base::SysInfo::CPUArchitecture()); |
| 421 | 421 |
| 422 #if defined(OS_CHROMEOS) | 422 #if defined(OS_CHROMEOS) |
| 423 chromeos::SystemAccess* sys_lib = chromeos::SystemAccess::GetInstance(); | 423 chromeos::system::StatisticsProvider* provider = |
| 424 chromeos::system::StatisticsProvider::GetInstance(); |
| 424 | 425 |
| 425 std::string hwclass; | 426 std::string hwclass; |
| 426 std::string board; | 427 std::string board; |
| 427 if (!sys_lib->GetMachineStatistic(kMachineInfoHWClass, &hwclass) || | 428 if (!provider->GetMachineStatistic(kMachineInfoHWClass, &hwclass) || |
| 428 !sys_lib->GetMachineStatistic(kMachineInfoBoard, &board)) { | 429 !provider->GetMachineStatistic(kMachineInfoBoard, &board)) { |
| 429 LOG(ERROR) << "Failed to get machine information"; | 430 LOG(ERROR) << "Failed to get machine information"; |
| 430 } | 431 } |
| 431 os_name += ",CrOS," + board; | 432 os_name += ",CrOS," + board; |
| 432 os_hardware += "," + hwclass; | 433 os_hardware += "," + hwclass; |
| 433 #endif | 434 #endif |
| 434 | 435 |
| 435 std::string os_version("-"); | 436 std::string os_version("-"); |
| 436 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) | 437 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) |
| 437 int32 os_major_version = 0; | 438 int32 os_major_version = 0; |
| 438 int32 os_minor_version = 0; | 439 int32 os_minor_version = 0; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 void DeviceManagementBackendImpl::ProcessPolicyRequest( | 484 void DeviceManagementBackendImpl::ProcessPolicyRequest( |
| 484 const std::string& device_management_token, | 485 const std::string& device_management_token, |
| 485 const std::string& device_id, | 486 const std::string& device_id, |
| 486 const em::DevicePolicyRequest& request, | 487 const em::DevicePolicyRequest& request, |
| 487 DevicePolicyResponseDelegate* delegate) { | 488 DevicePolicyResponseDelegate* delegate) { |
| 488 AddJob(new DeviceManagementPolicyJob(this, device_management_token, device_id, | 489 AddJob(new DeviceManagementPolicyJob(this, device_management_token, device_id, |
| 489 request, delegate)); | 490 request, delegate)); |
| 490 } | 491 } |
| 491 | 492 |
| 492 } // namespace policy | 493 } // namespace policy |
| OLD | NEW |