blob: 3fc2d8d532b23ea4abc68c6447c2cc1071b34b70 [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
2// Copyright (C) 2014 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
Alex Deymobd04b142014-03-18 15:00:05 -070016
Gilad Arnold48415f12014-06-27 07:10:58 -070017#ifndef UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_
18#define UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_
Alex Deymobd04b142014-03-18 15:00:05 -070019
Ben Chan02f7c1d2014-10-18 15:18:02 -070020#include <memory>
Alex Deymobd04b142014-03-18 15:00:05 -070021#include <string>
22
Gilad Arnold48e13612014-05-16 10:18:05 -070023#include "update_engine/hardware_interface.h"
Alex Deymo63784a52014-05-28 10:46:14 -070024#include "update_engine/update_manager/system_provider.h"
Alex Deymobd04b142014-03-18 15:00:05 -070025
Alex Deymo63784a52014-05-28 10:46:14 -070026namespace chromeos_update_manager {
Alex Deymobd04b142014-03-18 15:00:05 -070027
28// SystemProvider concrete implementation.
29class RealSystemProvider : public SystemProvider {
30 public:
Gilad Arnold48e13612014-05-16 10:18:05 -070031 explicit RealSystemProvider(
32 chromeos_update_engine::HardwareInterface* hardware)
33 : hardware_(hardware) {}
Alex Deymobd04b142014-03-18 15:00:05 -070034
Alex Deymo42c30c32014-04-24 18:41:18 -070035 // Initializes the provider and returns whether it succeeded.
36 bool Init();
37
Alex Vakulenko157fe302014-08-11 15:59:58 -070038 Variable<bool>* var_is_normal_boot_mode() override {
David Zeuthen21716e22014-04-23 15:42:05 -070039 return var_is_normal_boot_mode_.get();
40 }
41
Alex Vakulenko157fe302014-08-11 15:59:58 -070042 Variable<bool>* var_is_official_build() override {
David Zeuthen21716e22014-04-23 15:42:05 -070043 return var_is_official_build_.get();
44 }
45
Alex Vakulenko157fe302014-08-11 15:59:58 -070046 Variable<bool>* var_is_oobe_complete() override {
Gilad Arnold48e13612014-05-16 10:18:05 -070047 return var_is_oobe_complete_.get();
48 }
49
Alex Vakulenko157fe302014-08-11 15:59:58 -070050 Variable<bool>* var_is_boot_device_removable() override {
Gilad Arnoldbfc44f72014-07-09 14:41:39 -070051 return var_is_boot_device_removable_.get();
52 }
53
Alex Deymobd04b142014-03-18 15:00:05 -070054 private:
Ben Chan02f7c1d2014-10-18 15:18:02 -070055 std::unique_ptr<Variable<bool>> var_is_normal_boot_mode_;
56 std::unique_ptr<Variable<bool>> var_is_official_build_;
57 std::unique_ptr<Variable<bool>> var_is_oobe_complete_;
58 std::unique_ptr<Variable<bool>> var_is_boot_device_removable_;
Gilad Arnold48e13612014-05-16 10:18:05 -070059
60 chromeos_update_engine::HardwareInterface* hardware_;
David Zeuthen21716e22014-04-23 15:42:05 -070061
Alex Deymobd04b142014-03-18 15:00:05 -070062 DISALLOW_COPY_AND_ASSIGN(RealSystemProvider);
63};
64
Alex Deymo63784a52014-05-28 10:46:14 -070065} // namespace chromeos_update_manager
Alex Deymobd04b142014-03-18 15:00:05 -070066
Gilad Arnold48415f12014-06-27 07:10:58 -070067#endif // UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_