1*1a96fba6SXin Li // Copyright 2017 The Chromium OS Authors. All rights reserved. 2*1a96fba6SXin Li // Use of this source code is governed by a BSD-style license that can be 3*1a96fba6SXin Li // found in the LICENSE file. 4*1a96fba6SXin Li 5*1a96fba6SXin Li #ifndef LIBBRILLO_POLICY_POLICY_UTIL_H_ 6*1a96fba6SXin Li #define LIBBRILLO_POLICY_POLICY_UTIL_H_ 7*1a96fba6SXin Li 8*1a96fba6SXin Li #include <string> 9*1a96fba6SXin Li 10*1a96fba6SXin Li #include <base/files/file_path.h> 11*1a96fba6SXin Li #include <brillo/brillo_export.h> 12*1a96fba6SXin Li 13*1a96fba6SXin Li #include "bindings/device_management_backend.pb.h" 14*1a96fba6SXin Li 15*1a96fba6SXin Li namespace policy { 16*1a96fba6SXin Li 17*1a96fba6SXin Li // The detailed information of the result from loading the policy data. 18*1a96fba6SXin Li enum class BRILLO_EXPORT LoadPolicyResult { 19*1a96fba6SXin Li kSuccess = 0, 20*1a96fba6SXin Li kFileNotFound = 1, 21*1a96fba6SXin Li kFailedToReadFile = 2, 22*1a96fba6SXin Li kEmptyFile = 3, 23*1a96fba6SXin Li kInvalidPolicyData = 4 24*1a96fba6SXin Li }; 25*1a96fba6SXin Li 26*1a96fba6SXin Li // Reads and parses the policy data from |policy_path|. Returns the details 27*1a96fba6SXin Li // in LoadPolicyResult. In case response is |kSuccess|, |policy_data_str_out| 28*1a96fba6SXin Li // contains the raw data from the file, while |policy_out| contains the parsed 29*1a96fba6SXin Li // policy data. Otherwise the contents of |policy_data_str_out| and |policy_out| 30*1a96fba6SXin Li // is undefined. 31*1a96fba6SXin Li BRILLO_EXPORT LoadPolicyResult LoadPolicyFromPath( 32*1a96fba6SXin Li const base::FilePath& policy_path, 33*1a96fba6SXin Li std::string* policy_data_str_out, 34*1a96fba6SXin Li enterprise_management::PolicyFetchResponse* policy_out); 35*1a96fba6SXin Li 36*1a96fba6SXin Li } // namespace policy 37*1a96fba6SXin Li 38*1a96fba6SXin Li #endif // LIBBRILLO_POLICY_POLICY_UTIL_H_ 39