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/device_management_service.h" | 5 #include "chrome/browser/policy/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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 const char kServiceTokenAuthHeader[] = "Authorization: GoogleLogin auth="; | 52 const char kServiceTokenAuthHeader[] = "Authorization: GoogleLogin auth="; |
53 const char kDMTokenAuthHeader[] = "Authorization: GoogleDMToken token="; | 53 const char kDMTokenAuthHeader[] = "Authorization: GoogleDMToken token="; |
54 | 54 |
55 // HTTP Error Codes of the DM Server with their concrete meanings in the context | 55 // HTTP Error Codes of the DM Server with their concrete meanings in the context |
56 // of the DM Server communication. | 56 // of the DM Server communication. |
57 const int kSuccess = 200; | 57 const int kSuccess = 200; |
58 const int kInvalidArgument = 400; | 58 const int kInvalidArgument = 400; |
59 const int kInvalidAuthCookieOrDMToken = 401; | 59 const int kInvalidAuthCookieOrDMToken = 401; |
60 const int kMissingLicenses = 402; | 60 const int kMissingLicenses = 402; |
61 const int kDeviceManagementNotAllowed = 403; | 61 const int kDeviceManagementNotAllowed = 403; |
62 const int kInvalidURL = 404; // This error is not coming from the GFE. | 62 const int kInvalidURL = 404; // This error is not coming from the GFE. |
63 const int kInvalidSerialNumber = 405; | 63 const int kInvalidSerialNumber = 405; |
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"; | 74 const char kMachineInfoBoard[] = "CHROMEOS_RELEASE_BOARD"; |
75 #endif | 75 #endif |
76 | 76 |
77 bool IsProxyError(const net::URLRequestStatus status) { | 77 bool IsProxyError(const net::URLRequestStatus status) { |
78 switch (status.error()) { | 78 switch (status.error()) { |
79 case net::ERR_PROXY_CONNECTION_FAILED: | 79 case net::ERR_PROXY_CONNECTION_FAILED: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 version_info.LastChange().c_str()); | 132 version_info.LastChange().c_str()); |
133 return agent; | 133 return agent; |
134 } | 134 } |
135 | 135 |
136 const std::string& GetPlatformString() { | 136 const std::string& GetPlatformString() { |
137 CR_DEFINE_STATIC_LOCAL(std::string, platform, ()); | 137 CR_DEFINE_STATIC_LOCAL(std::string, platform, ()); |
138 if (!platform.empty()) | 138 if (!platform.empty()) |
139 return platform; | 139 return platform; |
140 | 140 |
141 std::string os_name(base::SysInfo::OperatingSystemName()); | 141 std::string os_name(base::SysInfo::OperatingSystemName()); |
142 std::string os_hardware(base::SysInfo::CPUArchitecture()); | 142 std::string os_hardware(base::SysInfo::OperatingSystemArchitecture()); |
143 | 143 |
144 #if defined(OS_CHROMEOS) | 144 #if defined(OS_CHROMEOS) |
145 chromeos::system::StatisticsProvider* provider = | 145 chromeos::system::StatisticsProvider* provider = |
146 chromeos::system::StatisticsProvider::GetInstance(); | 146 chromeos::system::StatisticsProvider::GetInstance(); |
147 | 147 |
148 std::string hwclass; | 148 std::string hwclass; |
149 std::string board; | 149 std::string board; |
150 if (!provider->GetMachineStatistic(kMachineInfoHWClass, &hwclass) || | 150 if (!provider->GetMachineStatistic(kMachineInfoHWClass, &hwclass) || |
151 !provider->GetMachineStatistic(kMachineInfoBoard, &board)) { | 151 !provider->GetMachineStatistic(kMachineInfoBoard, &board)) { |
152 LOG(ERROR) << "Failed to get machine information"; | 152 LOG(ERROR) << "Failed to get machine information"; |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 } | 585 } |
586 } | 586 } |
587 | 587 |
588 const JobQueue::iterator elem = | 588 const JobQueue::iterator elem = |
589 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); | 589 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); |
590 if (elem != queued_jobs_.end()) | 590 if (elem != queued_jobs_.end()) |
591 queued_jobs_.erase(elem); | 591 queued_jobs_.erase(elem); |
592 } | 592 } |
593 | 593 |
594 } // namespace policy | 594 } // namespace policy |
OLD | NEW |