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) |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 return; | 201 return; |
202 } | 202 } |
203 | 203 |
204 switch (response_code) { | 204 switch (response_code) { |
205 case kSuccess: { | 205 case kSuccess: { |
206 em::DeviceManagementResponse response; | 206 em::DeviceManagementResponse response; |
207 if (!response.ParseFromString(data)) { | 207 if (!response.ParseFromString(data)) { |
208 OnError(DeviceManagementBackend::kErrorResponseDecoding); | 208 OnError(DeviceManagementBackend::kErrorResponseDecoding); |
209 return; | 209 return; |
210 } | 210 } |
211 if (response.has_error() && | |
212 response.error() != em::DeviceManagementResponse_ErrorCode_SUCCESS) { | |
213 // TODO(pastarmovj): If we want to support legacy error codes in the | |
214 // protobuf this is the place to do so. | |
215 } | |
216 OnResponse(response); | 211 OnResponse(response); |
217 return; | 212 return; |
218 } | 213 } |
219 case kInvalidArgument: { | 214 case kInvalidArgument: { |
220 OnError(DeviceManagementBackend::kErrorRequestInvalid); | 215 OnError(DeviceManagementBackend::kErrorRequestInvalid); |
221 return; | 216 return; |
222 } | 217 } |
223 case kInvalidAuthCookieOrDMToken: { | 218 case kInvalidAuthCookieOrDMToken: { |
224 OnError(DeviceManagementBackend::kErrorServiceManagementTokenInvalid); | 219 OnError(DeviceManagementBackend::kErrorServiceManagementTokenInvalid); |
225 return; | 220 return; |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 void DeviceManagementBackendImpl::ProcessPolicyRequest( | 475 void DeviceManagementBackendImpl::ProcessPolicyRequest( |
481 const std::string& device_management_token, | 476 const std::string& device_management_token, |
482 const std::string& device_id, | 477 const std::string& device_id, |
483 const em::DevicePolicyRequest& request, | 478 const em::DevicePolicyRequest& request, |
484 DevicePolicyResponseDelegate* delegate) { | 479 DevicePolicyResponseDelegate* delegate) { |
485 AddJob(new DeviceManagementPolicyJob(this, device_management_token, device_id, | 480 AddJob(new DeviceManagementPolicyJob(this, device_management_token, device_id, |
486 request, delegate)); | 481 request, delegate)); |
487 } | 482 } |
488 | 483 |
489 } // namespace policy | 484 } // namespace policy |
OLD | NEW |