blob: 46defbcbb43c5ed65c95a237e80d3620e2e51c6f [file] [log] [blame]
Alex Deymo8c499142014-01-02 19:33:34 -08001// Copyright (c) 2014 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 CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_VARIABLE_H
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_VARIABLE_H
7
8#include <string>
9
10#include <base/time.h>
11
12namespace chromeos_policy_manager {
13
14// Interface to a Policy Manager variable to be implemented by the providers.
15template<typename T>
16class Variable {
17 public:
18 virtual ~Variable() {}
19
20 protected:
21 // Gets the current value of the variable. The current value is copied to a
22 // new object and returned. The caller of this method owns the object and
23 // should delete it.
24 //
25 // In case of and error getting the current value or the |timeout| timeout is
26 // exceeded, a NULL value is returned and the |errmsg| is set.
27 //
28 // The caller can pass a NULL value for |errmsg|, in which case the error
29 // message won't be set.
30 virtual const T* GetValue(base::TimeDelta timeout, std::string* errmsg) = 0;
31};
32
33} // namespace chromeos_policy_manager
34
35#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_VARIABLE_H