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