PolicyManager: New System provider.

The system provider exposes information about the device from
crossystem and the kernel boot command line options.

BUG=chromium:338587
TEST=Unit tests.

Change-Id: I2837a97740b63562155717cfe6a12fad69fd8cea
Reviewed-on: https://chromium-review.googlesource.com/191121
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/policy_manager/system_provider.h b/policy_manager/system_provider.h
new file mode 100644
index 0000000..b7f93c0
--- /dev/null
+++ b/policy_manager/system_provider.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_SYSTEM_PROVIDER_H_
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_SYSTEM_PROVIDER_H_
+
+#include <base/memory/scoped_ptr.h>
+
+#include "update_engine/policy_manager/provider.h"
+#include "update_engine/policy_manager/variable.h"
+
+namespace chromeos_policy_manager {
+
+// Provider for system information, mostly constant, such as the information
+// reported by crossystem, the kernel boot command line and the partition table.
+class SystemProvider : public Provider {
+ public:
+  // Returns true if the boot mode is normal or if it's unable to
+  // determine the boot mode. Returns false if the boot mode is
+  // developer.
+  Variable<bool>* var_is_normal_boot_mode() const {
+    return var_is_normal_boot_mode_.get();
+  }
+
+  // Returns whether this is an official Chrome OS build.
+  Variable<bool>* var_is_official_build() const {
+    return var_is_official_build_.get();
+  }
+
+ protected:
+  SystemProvider() {}
+
+  void set_var_is_normal_boot_mode(Variable<bool>* var_is_normal_boot_mode) {
+    var_is_normal_boot_mode_.reset(var_is_normal_boot_mode);
+  }
+
+  void set_var_is_official_build(Variable<bool>* var_is_official_build) {
+    var_is_official_build_.reset(var_is_official_build);
+  }
+
+ private:
+  scoped_ptr<Variable<bool>> var_is_normal_boot_mode_;
+  scoped_ptr<Variable<bool>> var_is_official_build_;
+
+  DISALLOW_COPY_AND_ASSIGN(SystemProvider);
+};
+
+}  // namespace chromeos_policy_manager
+
+#endif  // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_SYSTEM_PROVIDER_H_