1// Copyright (c) 2011 The Chromium OS 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#ifndef LIBBRILLO_POLICY_LIBPOLICY_H_ 6#define LIBBRILLO_POLICY_LIBPOLICY_H_ 7 8#include <memory> 9#include <string> 10 11#include <base/macros.h> 12 13#pragma GCC visibility push(default) 14 15namespace policy { 16 17class DevicePolicy; 18 19// This class holds device settings that are to be enforced across all users. 20// 21// If there is a policy on disk at creation time, we will load it at verify 22// its signature. 23class PolicyProvider { 24 public: 25 PolicyProvider(); 26 virtual ~PolicyProvider(); 27 28 // Constructor for tests only! 29 explicit PolicyProvider(DevicePolicy* device_policy); 30 31 // This function will ensure the freshness of the contents that the getters 32 // are delivering. Normally contents are cached to prevent unnecessary load. 33 virtual bool Reload(); 34 35 virtual bool device_policy_is_loaded() const; 36 37 // Returns a value from the device policy cache. 38 virtual const DevicePolicy& GetDevicePolicy() const; 39 40 private: 41 std::unique_ptr<DevicePolicy> device_policy_; 42 bool device_policy_is_loaded_; 43 44 DISALLOW_COPY_AND_ASSIGN(PolicyProvider); 45}; 46} // namespace policy 47 48#pragma GCC visibility pop 49 50#endif // LIBBRILLO_POLICY_LIBPOLICY_H_ 51