blob: d79227fb9404dc7a222e623dad0a55186daebcef [file] [log] [blame]
Alex Deymof9f12632014-04-17 13:51:26 -07001// Copyright 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_REAL_CONFIG_PROVIDER_H_
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_CONFIG_PROVIDER_H_
7
8#include <string>
9
10#include <base/memory/scoped_ptr.h>
11
12#include "update_engine/hardware_interface.h"
13#include "update_engine/policy_manager/config_provider.h"
14#include "update_engine/policy_manager/generic_variables.h"
15
16namespace chromeos_policy_manager {
17
18// ConfigProvider concrete implementation.
19class RealConfigProvider : public ConfigProvider {
20 public:
21 explicit RealConfigProvider(
22 chromeos_update_engine::HardwareInterface* hardware)
23 : hardware_(hardware) {}
24
25 Variable<bool>* var_is_oobe_enabled() override {
26 return var_is_oobe_enabled_.get();
27 }
28
29 private:
30 friend class PmRealConfigProviderTest;
31
32 virtual bool DoInit() override;
33
34 // Used for testing. Sets the root prefix, which is by default "". Call this
35 // method before calling Init() in order to mock out the place where the files
36 // are being read from.
37 void SetRootPrefix(const std::string& prefix) {
38 root_prefix_ = prefix;
39 }
40
41 scoped_ptr<ConstCopyVariable<bool>> var_is_oobe_enabled_;
42
43 chromeos_update_engine::HardwareInterface* hardware_;
44
45 // Prefix to prepend to the file paths. Useful for testing.
46 std::string root_prefix_;
47
48 DISALLOW_COPY_AND_ASSIGN(RealConfigProvider);
49};
50
51} // namespace chromeos_policy_manager
52
53#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_CONFIG_PROVIDER_H_