Home | History | Annotate | Download | only in policy
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h"
      6 
      7 namespace policy {
      8 
      9 // static
     10 EnrollmentStatus EnrollmentStatus::ForStatus(Status status) {
     11   return EnrollmentStatus(status, DM_STATUS_SUCCESS,
     12                           CloudPolicyStore::STATUS_OK,
     13                           CloudPolicyValidatorBase::VALIDATION_OK);
     14 }
     15 
     16 // static
     17 EnrollmentStatus EnrollmentStatus::ForRegistrationError(
     18     DeviceManagementStatus client_status) {
     19   return EnrollmentStatus(STATUS_REGISTRATION_FAILED, client_status,
     20                           CloudPolicyStore::STATUS_OK,
     21                           CloudPolicyValidatorBase::VALIDATION_OK);
     22 }
     23 
     24 // static
     25 EnrollmentStatus EnrollmentStatus::ForFetchError(
     26     DeviceManagementStatus client_status) {
     27   return EnrollmentStatus(STATUS_POLICY_FETCH_FAILED, client_status,
     28                           CloudPolicyStore::STATUS_OK,
     29                           CloudPolicyValidatorBase::VALIDATION_OK);
     30 }
     31 
     32 // static
     33 EnrollmentStatus EnrollmentStatus::ForValidationError(
     34     CloudPolicyValidatorBase::Status validation_status) {
     35   return EnrollmentStatus(STATUS_VALIDATION_FAILED, DM_STATUS_SUCCESS,
     36                           CloudPolicyStore::STATUS_OK, validation_status);
     37 }
     38 
     39 // static
     40 EnrollmentStatus EnrollmentStatus::ForStoreError(
     41     CloudPolicyStore::Status store_error,
     42     CloudPolicyValidatorBase::Status validation_status) {
     43   return EnrollmentStatus(STATUS_STORE_ERROR, DM_STATUS_SUCCESS,
     44                           store_error, validation_status);
     45 }
     46 
     47 EnrollmentStatus::EnrollmentStatus(
     48     EnrollmentStatus::Status status,
     49     DeviceManagementStatus client_status,
     50     CloudPolicyStore::Status store_status,
     51     CloudPolicyValidatorBase::Status validation_status)
     52     : status_(status),
     53       client_status_(client_status),
     54       store_status_(store_status),
     55       validation_status_(validation_status) {}
     56 
     57 }  // namespace policy
     58