Alex Deymo | c705cc8 | 2014-02-19 11:15:00 -0800 | [diff] [blame] | 1 | // 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 | |
Gilad Arnold | 2cbb385 | 2014-03-07 12:40:50 -0800 | [diff] [blame] | 5 | #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_DEFAULT_POLICY_H_ |
| 6 | #define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_DEFAULT_POLICY_H_ |
Alex Deymo | c705cc8 | 2014-02-19 11:15:00 -0800 | [diff] [blame] | 7 | |
| 8 | #include "update_engine/policy_manager/policy.h" |
| 9 | |
| 10 | namespace chromeos_policy_manager { |
| 11 | |
| 12 | // The DefaultPolicy is a safe Policy implementation that doesn't fail. The |
| 13 | // values returned by this policy are safe default in case of failure of the |
| 14 | // actual policy being used by the PolicyManager. |
| 15 | class DefaultPolicy : public Policy { |
| 16 | public: |
| 17 | DefaultPolicy() {} |
| 18 | virtual ~DefaultPolicy() {} |
| 19 | |
| 20 | // Policy overrides. |
Alex Deymo | 0d11c60 | 2014-04-23 20:12:20 -0700 | [diff] [blame^] | 21 | virtual EvalStatus UpdateCheckAllowed( |
| 22 | EvaluationContext* ec, State* state, std::string* error, |
| 23 | UpdateCheckParams* result) const override { |
| 24 | result->updates_enabled = true; |
Gilad Arnold | af2f6ae | 2014-04-28 14:14:52 -0700 | [diff] [blame] | 25 | return EvalStatus::kSucceeded; |
| 26 | } |
| 27 | |
| 28 | virtual EvalStatus UpdateDownloadAndApplyAllowed( |
| 29 | EvaluationContext* ec, State* state, std::string* error, |
| 30 | bool* result) const override { |
Alex Deymo | c705cc8 | 2014-02-19 11:15:00 -0800 | [diff] [blame] | 31 | *result = true; |
Alex Deymo | e636c3c | 2014-03-11 19:02:08 -0700 | [diff] [blame] | 32 | return EvalStatus::kSucceeded; |
Alex Deymo | c705cc8 | 2014-02-19 11:15:00 -0800 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | private: |
| 36 | DISALLOW_COPY_AND_ASSIGN(DefaultPolicy); |
| 37 | }; |
| 38 | |
| 39 | } // namespace chromeos_policy_manager |
| 40 | |
Gilad Arnold | 2cbb385 | 2014-03-07 12:40:50 -0800 | [diff] [blame] | 41 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_DEFAULT_POLICY_H_ |