Alex Deymo | bd04b14 | 2014-03-18 15:00:05 -0700 | [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 | |
| 5 | #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_SYSTEM_PROVIDER_H_ |
| 6 | #define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_SYSTEM_PROVIDER_H_ |
| 7 | |
| 8 | #include <base/memory/scoped_ptr.h> |
| 9 | |
| 10 | #include "update_engine/policy_manager/provider.h" |
| 11 | #include "update_engine/policy_manager/variable.h" |
| 12 | |
| 13 | namespace chromeos_policy_manager { |
| 14 | |
| 15 | // Provider for system information, mostly constant, such as the information |
| 16 | // reported by crossystem, the kernel boot command line and the partition table. |
| 17 | class SystemProvider : public Provider { |
| 18 | public: |
| 19 | // Returns true if the boot mode is normal or if it's unable to |
| 20 | // determine the boot mode. Returns false if the boot mode is |
| 21 | // developer. |
| 22 | Variable<bool>* var_is_normal_boot_mode() const { |
| 23 | return var_is_normal_boot_mode_.get(); |
| 24 | } |
| 25 | |
| 26 | // Returns whether this is an official Chrome OS build. |
| 27 | Variable<bool>* var_is_official_build() const { |
| 28 | return var_is_official_build_.get(); |
| 29 | } |
| 30 | |
| 31 | protected: |
| 32 | SystemProvider() {} |
| 33 | |
| 34 | void set_var_is_normal_boot_mode(Variable<bool>* var_is_normal_boot_mode) { |
| 35 | var_is_normal_boot_mode_.reset(var_is_normal_boot_mode); |
| 36 | } |
| 37 | |
| 38 | void set_var_is_official_build(Variable<bool>* var_is_official_build) { |
| 39 | var_is_official_build_.reset(var_is_official_build); |
| 40 | } |
| 41 | |
| 42 | private: |
| 43 | scoped_ptr<Variable<bool>> var_is_normal_boot_mode_; |
| 44 | scoped_ptr<Variable<bool>> var_is_official_build_; |
| 45 | |
| 46 | DISALLOW_COPY_AND_ASSIGN(SystemProvider); |
| 47 | }; |
| 48 | |
| 49 | } // namespace chromeos_policy_manager |
| 50 | |
| 51 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_SYSTEM_PROVIDER_H_ |