blob: b4a5a1ee17b9804d4ea058231b309cf334819836 [file] [log] [blame]
Alex Deymoc705cc82014-02-19 11:15:00 -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_POLICY_H
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_H
7
8#include "update_engine/policy_manager/evaluation_context.h"
9
10namespace chromeos_policy_manager {
11
12// The three different results of a policy request.
13enum EvalStatus {
14 EvalStatusFailed,
15 EvalStatusSucceeded,
16 EvalStatusAskMeAgainLater,
17};
18
19// The Policy class is an interface to the ensemble of policy requests that the
20// client can make. A derived class includes the policy implementations of
21// these.
22//
23// When compile-time selection of the policy is required due to missing or extra
24// parts in a given platform, a different Policy subclass can be used.
25class Policy {
26 public:
27 virtual ~Policy() {}
28
29 // List of policy requests. A policy request takes an EvaluationContext as the
30 // first argument, a returned error message, a returned value and optionally
31 // followed by one or more arbitrary constant arguments.
32 //
33 // When the implementation fails, the method returns EvalStatusFailed and sets
34 // the |error| string.
35
36 // UpdateCheckAllowed returns whether it is allowed to request an update check
37 // to Omaha.
38 virtual EvalStatus UpdateCheckAllowed(EvaluationContext* ec,
39 std::string* error,
40 bool* result) const = 0;
41
42 protected:
43 Policy() {}
44
45 private:
46 DISALLOW_COPY_AND_ASSIGN(Policy);
47};
48
49} // namespace chromeos_policy_manager
50
51#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_POLICY_H