| 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_token_fetcher.h" | 5 #include "chrome/browser/policy/device_token_fetcher.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 switch (status) { | 201 switch (status) { |
| 202 case DM_STATUS_SUCCESS: { | 202 case DM_STATUS_SUCCESS: { |
| 203 const em::DeviceRegisterResponse& register_response = | 203 const em::DeviceRegisterResponse& register_response = |
| 204 response.register_response(); | 204 response.register_response(); |
| 205 if (register_response.has_device_management_token()) { | 205 if (register_response.has_device_management_token()) { |
| 206 UMA_HISTOGRAM_ENUMERATION(kMetricToken, kMetricTokenFetchOK, | 206 UMA_HISTOGRAM_ENUMERATION(kMetricToken, kMetricTokenFetchOK, |
| 207 kMetricTokenSize); | 207 kMetricTokenSize); |
| 208 | 208 |
| 209 if (data_store_->policy_register_type() == | 209 if (data_store_->policy_register_type() == |
| 210 em::DeviceRegisterRequest::DEVICE) { | 210 em::DeviceRegisterRequest::DEVICE) { |
| 211 // TODO(pastarmovj): Default to DEVICE_MODE_UNKNOWN once DM server has | |
| 212 // been updated. http://crosbug.com/26624 | |
| 213 DeviceMode mode = DEVICE_MODE_ENTERPRISE; | 211 DeviceMode mode = DEVICE_MODE_ENTERPRISE; |
| 214 if (register_response.has_enrollment_type()) { | 212 if (register_response.has_enrollment_type()) { |
| 215 mode = TranslateProtobufDeviceMode( | 213 mode = TranslateProtobufDeviceMode( |
| 216 register_response.enrollment_type()); | 214 register_response.enrollment_type()); |
| 217 } | 215 } |
| 218 if (mode == DEVICE_MODE_PENDING) { | 216 if (mode == DEVICE_MODE_PENDING) { |
| 219 LOG(ERROR) << "Enrollment mode missing or unknown!"; | 217 LOG(ERROR) << "Enrollment mode missing or unknown!"; |
| 220 SetState(STATE_BAD_ENROLLMENT_MODE); | 218 SetState(STATE_BAD_ENROLLMENT_MODE); |
| 221 return; | 219 return; |
| 222 } | 220 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 case STATE_UNMANAGED: | 349 case STATE_UNMANAGED: |
| 352 case STATE_ERROR: | 350 case STATE_ERROR: |
| 353 case STATE_TEMPORARY_ERROR: | 351 case STATE_TEMPORARY_ERROR: |
| 354 case STATE_BAD_AUTH: | 352 case STATE_BAD_AUTH: |
| 355 FetchTokenInternal(); | 353 FetchTokenInternal(); |
| 356 break; | 354 break; |
| 357 } | 355 } |
| 358 } | 356 } |
| 359 | 357 |
| 360 } // namespace policy | 358 } // namespace policy |
| OLD | NEW |