| 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/policy/cloud/device_management_service.h" | 5 #include "chrome/browser/policy/cloud/device_management_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 const int kDeviceIdConflict = 409; | 64 const int kDeviceIdConflict = 409; |
| 65 const int kDeviceNotFound = 410; | 65 const int kDeviceNotFound = 410; |
| 66 const int kPendingApproval = 412; | 66 const int kPendingApproval = 412; |
| 67 const int kInternalServerError = 500; | 67 const int kInternalServerError = 500; |
| 68 const int kServiceUnavailable = 503; | 68 const int kServiceUnavailable = 503; |
| 69 const int kPolicyNotFound = 902; // This error is not sent as HTTP status code. | 69 const int kPolicyNotFound = 902; // This error is not sent as HTTP status code. |
| 70 | 70 |
| 71 #if defined(OS_CHROMEOS) | 71 #if defined(OS_CHROMEOS) |
| 72 // Machine info keys. | 72 // Machine info keys. |
| 73 const char kMachineInfoHWClass[] = "hardware_class"; | 73 const char kMachineInfoHWClass[] = "hardware_class"; |
| 74 const char kMachineInfoBoard[] = "CHROMEOS_RELEASE_BOARD"; | |
| 75 #endif | 74 #endif |
| 76 | 75 |
| 77 bool IsProxyError(const net::URLRequestStatus status) { | 76 bool IsProxyError(const net::URLRequestStatus status) { |
| 78 switch (status.error()) { | 77 switch (status.error()) { |
| 79 case net::ERR_PROXY_CONNECTION_FAILED: | 78 case net::ERR_PROXY_CONNECTION_FAILED: |
| 80 case net::ERR_TUNNEL_CONNECTION_FAILED: | 79 case net::ERR_TUNNEL_CONNECTION_FAILED: |
| 81 case net::ERR_PROXY_AUTH_UNSUPPORTED: | 80 case net::ERR_PROXY_AUTH_UNSUPPORTED: |
| 82 case net::ERR_HTTPS_PROXY_TUNNEL_RESPONSE: | 81 case net::ERR_HTTPS_PROXY_TUNNEL_RESPONSE: |
| 83 case net::ERR_MANDATORY_PROXY_CONFIGURATION_FAILED: | 82 case net::ERR_MANDATORY_PROXY_CONFIGURATION_FAILED: |
| 84 case net::ERR_PROXY_CERTIFICATE_INVALID: | 83 case net::ERR_PROXY_CERTIFICATE_INVALID: |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return platform; | 169 return platform; |
| 171 | 170 |
| 172 std::string os_name(base::SysInfo::OperatingSystemName()); | 171 std::string os_name(base::SysInfo::OperatingSystemName()); |
| 173 std::string os_hardware(base::SysInfo::OperatingSystemArchitecture()); | 172 std::string os_hardware(base::SysInfo::OperatingSystemArchitecture()); |
| 174 | 173 |
| 175 #if defined(OS_CHROMEOS) | 174 #if defined(OS_CHROMEOS) |
| 176 chromeos::system::StatisticsProvider* provider = | 175 chromeos::system::StatisticsProvider* provider = |
| 177 chromeos::system::StatisticsProvider::GetInstance(); | 176 chromeos::system::StatisticsProvider::GetInstance(); |
| 178 | 177 |
| 179 std::string hwclass; | 178 std::string hwclass; |
| 180 std::string board; | 179 if (!provider->GetMachineStatistic(kMachineInfoHWClass, &hwclass)) |
| 181 if (!provider->GetMachineStatistic(kMachineInfoHWClass, &hwclass) || | |
| 182 !provider->GetMachineStatistic(kMachineInfoBoard, &board)) { | |
| 183 LOG(ERROR) << "Failed to get machine information"; | 180 LOG(ERROR) << "Failed to get machine information"; |
| 184 } | 181 os_name += ",CrOS," + base::SysInfo::GetLsbReleaseBoard(); |
| 185 os_name += ",CrOS," + board; | |
| 186 os_hardware += "," + hwclass; | 182 os_hardware += "," + hwclass; |
| 187 #endif | 183 #endif |
| 188 | 184 |
| 189 std::string os_version("-"); | 185 std::string os_version("-"); |
| 190 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) | 186 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) |
| 191 int32 os_major_version = 0; | 187 int32 os_major_version = 0; |
| 192 int32 os_minor_version = 0; | 188 int32 os_minor_version = 0; |
| 193 int32 os_bugfix_version = 0; | 189 int32 os_bugfix_version = 0; |
| 194 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, | 190 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, |
| 195 &os_minor_version, | 191 &os_minor_version, |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 } | 640 } |
| 645 } | 641 } |
| 646 | 642 |
| 647 const JobQueue::iterator elem = | 643 const JobQueue::iterator elem = |
| 648 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); | 644 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); |
| 649 if (elem != queued_jobs_.end()) | 645 if (elem != queued_jobs_.end()) |
| 650 queued_jobs_.erase(elem); | 646 queued_jobs_.erase(elem); |
| 651 } | 647 } |
| 652 | 648 |
| 653 } // namespace policy | 649 } // namespace policy |
| OLD | NEW |