blob: a46a6982605b7622cb52de6261c87e919310901e [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
Alex Deymo763e7db2015-08-27 21:08:08 -070023#include "update_engine/boot_control_interface.h"
Gilad Arnold48e13612014-05-16 10:18:05 -070024#include "update_engine/hardware_interface.h"
Alex Deymo63784a52014-05-28 10:46:14 -070025#include "update_engine/update_manager/system_provider.h"
Alex Deymobd04b142014-03-18 15:00:05 -070026
Alex Deymo63784a52014-05-28 10:46:14 -070027namespace chromeos_update_manager {
Alex Deymobd04b142014-03-18 15:00:05 -070028
29// SystemProvider concrete implementation.
30class RealSystemProvider : public SystemProvider {
31 public:
Gilad Arnold48e13612014-05-16 10:18:05 -070032 explicit RealSystemProvider(
Alex Deymo763e7db2015-08-27 21:08:08 -070033 chromeos_update_engine::HardwareInterface* hardware,
34 chromeos_update_engine::BootControlInterface* boot_control)
35 : hardware_(hardware), boot_control_(boot_control) {}
Alex Deymobd04b142014-03-18 15:00:05 -070036
Alex Deymo42c30c32014-04-24 18:41:18 -070037 // Initializes the provider and returns whether it succeeded.
38 bool Init();
39
Alex Vakulenko157fe302014-08-11 15:59:58 -070040 Variable<bool>* var_is_normal_boot_mode() override {
David Zeuthen21716e22014-04-23 15:42:05 -070041 return var_is_normal_boot_mode_.get();
42 }
43
Alex Vakulenko157fe302014-08-11 15:59:58 -070044 Variable<bool>* var_is_official_build() override {
David Zeuthen21716e22014-04-23 15:42:05 -070045 return var_is_official_build_.get();
46 }
47
Alex Vakulenko157fe302014-08-11 15:59:58 -070048 Variable<bool>* var_is_oobe_complete() override {
Gilad Arnold48e13612014-05-16 10:18:05 -070049 return var_is_oobe_complete_.get();
50 }
51
Alex Deymo763e7db2015-08-27 21:08:08 -070052 Variable<unsigned int>* var_num_slots() override {
53 return var_num_slots_.get();
Gilad Arnoldbfc44f72014-07-09 14:41:39 -070054 }
55
Alex Deymobd04b142014-03-18 15:00:05 -070056 private:
Ben Chan02f7c1d2014-10-18 15:18:02 -070057 std::unique_ptr<Variable<bool>> var_is_normal_boot_mode_;
58 std::unique_ptr<Variable<bool>> var_is_official_build_;
59 std::unique_ptr<Variable<bool>> var_is_oobe_complete_;
Alex Deymo763e7db2015-08-27 21:08:08 -070060 std::unique_ptr<Variable<unsigned int>> var_num_slots_;
Gilad Arnold48e13612014-05-16 10:18:05 -070061
62 chromeos_update_engine::HardwareInterface* hardware_;
Alex Deymo763e7db2015-08-27 21:08:08 -070063 chromeos_update_engine::BootControlInterface* boot_control_;
David Zeuthen21716e22014-04-23 15:42:05 -070064
Alex Deymobd04b142014-03-18 15:00:05 -070065 DISALLOW_COPY_AND_ASSIGN(RealSystemProvider);
66};
67
Alex Deymo63784a52014-05-28 10:46:14 -070068} // namespace chromeos_update_manager
Alex Deymobd04b142014-03-18 15:00:05 -070069
Gilad Arnold48415f12014-06-27 07:10:58 -070070#endif // UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_